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

Daniel Robertson danlrobertson89 at gmail.com
Wed Aug 12 22:34:55 PDT 2015


 include/basebmp/accessortraits.hxx |   14 ++++++++++----
 include/o3tl/compat_functional.hxx |    9 ---------
 2 files changed, 10 insertions(+), 13 deletions(-)

New commits:
commit 3babca3e849e1cb42225ca1c26e8f6156ad153e6
Author: Daniel Robertson <danlrobertson89 at gmail.com>
Date:   Tue Aug 11 20:31:51 2015 -0400

    tdf#92459 basebmp: replace project2nd
    
    Replace the use of project2nd in basebmp with a specialized functor
    similar to what is seen in paletteformats.hxx and
    pixelformatadapters.hxx. There should be no side effects due to this
    change.
    
    Change-Id: I1bbd723931e41986542e92bac773bbea68cfe5bd
    Reviewed-on: https://gerrit.libreoffice.org/17660
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: David Tardon <dtardon at redhat.com>
    Tested-by: David Tardon <dtardon at redhat.com>

diff --git a/include/basebmp/accessortraits.hxx b/include/basebmp/accessortraits.hxx
index eeabae0..d09f805 100644
--- a/include/basebmp/accessortraits.hxx
+++ b/include/basebmp/accessortraits.hxx
@@ -24,8 +24,6 @@
 #include <basebmp/accessoradapters.hxx>
 #include <basebmp/metafunctions.hxx>
 
-#include <o3tl/compat_functional.hxx>
-
 #include <functional>
 
 namespace basebmp
@@ -71,7 +69,15 @@ template< class Accessor,
         type;
 };
 
-
+/// given an Accessor and its value type return its value_type
+template< typename Accessor > struct ColorPassThrough
+{
+    typename Accessor::value_type operator()( const Accessor&,
+            const typename Accessor::value_type& x ) const
+    {
+        return x;
+    }
+};
 
 /** Traits template for Accessor
 
@@ -84,7 +90,7 @@ template< class Accessor > struct AccessorTraits
     typedef typename Accessor::value_type           value_type;
 
     /// Retrieve stand-alone color lookup function for given Accessor type
-    typedef o3tl::project2nd< Accessor, value_type > color_lookup;
+    typedef ColorPassThrough< Accessor > color_lookup;
 
     /// Retrieve raw pixel data accessor for given Accessor type
     typedef Accessor                                raw_accessor;
diff --git a/include/o3tl/compat_functional.hxx b/include/o3tl/compat_functional.hxx
index fa6fbd5..5220567 100644
--- a/include/o3tl/compat_functional.hxx
+++ b/include/o3tl/compat_functional.hxx
@@ -37,15 +37,6 @@
 
 namespace o3tl
 {
-// 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 {
-        return x;
-    }
-};
-
 /// Select first value of a pair
 template<typename P>
 struct select1st


More information about the Libreoffice-commits mailing list