diff options
author | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2015-08-17 14:40:17 +0200 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2015-08-17 16:38:30 +0000 |
commit | ad1f0d1f1a195a00cf2ec2848745fdc6186bfbb1 (patch) | |
tree | caff9162236ce0271dabf7bbb0c9fbb3673092d6 /include/o3tl/functional.hxx | |
parent | 9c4d75bea581266ccfc186da4db2c04901c9f862 (diff) |
o3tl: rename compat_functional header
After the cleanup, the stuff there really stands on its own (and the
remaining usage of select1st/2nd is more descriptive than lambdas).
Change-Id: I0aba131d5dc550189f8130d167dc94167e404540
Reviewed-on: https://gerrit.libreoffice.org/17806
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'include/o3tl/functional.hxx')
-rw-r--r-- | include/o3tl/functional.hxx | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/include/o3tl/functional.hxx b/include/o3tl/functional.hxx new file mode 100644 index 000000000000..b1341e2112b7 --- /dev/null +++ b/include/o3tl/functional.hxx @@ -0,0 +1,65 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996-1998 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* + * Lifted and paraphrased from STLport - with additions from Fridrich + * Strba and Thorsten Behrens + */ + +#ifndef INCLUDED_O3TL_COMPAT_FUNCTIONAL_HXX +#define INCLUDED_O3TL_COMPAT_FUNCTIONAL_HXX + +#include <sal/config.h> + +namespace o3tl +{ +/// Select first value of a pair +template<typename P> +struct select1st +{ + 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<typename P> +struct select2nd +{ + typedef P argument_type; + typedef typename P::second_type result_type; + const result_type& operator()( const argument_type& cp ) const { + return cp.second; + } +}; + +} // namespace o3tl + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |