[Libreoffice-commits] core.git: include/o3tl

Daniel Robertson danlrobertson89 at gmail.com
Tue Aug 11 15:24:08 PDT 2015


 include/o3tl/compat_functional.hxx |   41 ++++++++++++++-----------------------
 1 file changed, 16 insertions(+), 25 deletions(-)

New commits:
commit ae6afadbc0c6ffcdbfd0db6bb3b0166295d5effd
Author: Daniel Robertson <danlrobertson89 at gmail.com>
Date:   Mon Aug 10 10:56:02 2015 -0400

    tdf#92459 o3tl: remove unary_function
    
    Clean up o3tl/compat_functional.hxx select1st/select2nd. Remove the
    structs inheritance from the now deprecated unary_function. Remove
    project1st, as it is not used.
    
    Change-Id: I60c0f30c4b87417a331a4b38f62993cc3d1c9a51
    Reviewed-on: https://gerrit.libreoffice.org/17625
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/include/o3tl/compat_functional.hxx b/include/o3tl/compat_functional.hxx
index 6d04e67..fa6fbd5 100644
--- a/include/o3tl/compat_functional.hxx
+++ b/include/o3tl/compat_functional.hxx
@@ -32,48 +32,39 @@
 #ifndef INCLUDED_O3TL_COMPAT_FUNCTIONAL_HXX
 #define INCLUDED_O3TL_COMPAT_FUNCTIONAL_HXX
 
+#include <utility>
 #include <functional>
 
 namespace o3tl
 {
-
-/// Functor, given two parameters, return the first
-template<class T1,class T2>
-struct project1st : public std::binary_function<T1, T2, T1>
-{
-    T1 operator()(const T1& y, const T2&) const
-    {
-        return y;
-    }
-};
-
-/// Functor, given two parameters, return the second
-template<class T1,class T2>
+// Functor, given two parameters, return the second
+template<class T1, class T2>
 struct project2nd : public std::binary_function<T1, T2, T2>
 {
-    T2 operator()(const T1&, const T2& x) const
-    {
+    T2 operator()(const T1&, const T2& x) const {
         return x;
     }
 };
 
 /// Select first value of a pair
-template<class P>
-struct select1st : public std::unary_function<P, typename P::first_type>
+template<typename P>
+struct select1st
 {
-    const typename P::first_type& operator()(const P& y) const
-    {
-        return y.first;
+    typedef P argument_type;
+    typedef typename P::first_type result_type;
+    const result_type& operator()( const argument_type& cp ) const {
+        return cp.first;
     }
 };
 
 /// Select second value of a pair
-template<class P>
-struct select2nd : public std::unary_function<P, typename P::second_type>
+template<typename P>
+struct select2nd
 {
-    const typename P::second_type& operator()(const P& y) const
-    {
-        return y.second;
+    typedef P argument_type;
+    typedef typename P::second_type result_type;
+    const result_type& operator()( const argument_type& cp ) const {
+        return cp.second;
     }
 };
 


More information about the Libreoffice-commits mailing list