Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / include / o3tl / functional.hxx
blob9ca86924f8d79defcacd6cb031caf4a887854257
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
4 * Copyright (c) 1994
5 * Hewlett-Packard Company
7 * Copyright (c) 1996-1998
8 * Silicon Graphics Computer Systems, Inc.
10 * Copyright (c) 1997
11 * Moscow Center for SPARC Technology
13 * Copyright (c) 1999
14 * Boris Fomitchev
16 * This material is provided "as is", with absolutely no warranty expressed
17 * or implied. Any use is at your own risk.
19 * Permission to use or copy this software for any purpose is hereby granted
20 * without fee, provided the above notices are retained on all copies.
21 * Permission to modify the code and to distribute modified code is granted,
22 * provided the above notices are retained, and a notice that the code was
23 * modified is included with the above copyright notice.
28 * Lifted and paraphrased from STLport - with additions from Fridrich
29 * Strba and Thorsten Behrens
32 #ifndef INCLUDED_O3TL_FUNCTIONAL_HXX
33 #define INCLUDED_O3TL_FUNCTIONAL_HXX
35 namespace o3tl
37 /// Select first value of a pair
38 template<typename P>
39 struct select1st
41 typedef P argument_type;
42 typedef typename P::first_type result_type;
43 const result_type& operator()( const argument_type& cp ) const {
44 return cp.first;
48 /// Select second value of a pair
49 template<typename P>
50 struct select2nd
52 typedef P argument_type;
53 typedef typename P::second_type result_type;
54 const result_type& operator()( const argument_type& cp ) const {
55 return cp.second;
59 } // namespace o3tl
61 #endif
63 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */