diff options
author | Daniel Robertson <danlrobertson89@gmail.com> | 2015-08-10 10:56:02 -0400 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2015-08-11 22:23:48 +0000 |
commit | ae6afadbc0c6ffcdbfd0db6bb3b0166295d5effd (patch) | |
tree | 4e34b33f1c9e7032374714829638953fc2607d2b /include/o3tl | |
parent | f6595f0b3389ffeefa10035d915a884b02d26c0e (diff) |
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@libreoffice.org>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'include/o3tl')
-rw-r--r-- | include/o3tl/compat_functional.hxx | 41 |
1 files changed, 16 insertions, 25 deletions
diff --git a/include/o3tl/compat_functional.hxx b/include/o3tl/compat_functional.hxx index 6d04e6744ca3..fa6fbd57d845 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; } }; |