LibreOffice Module o3tl (master)  1
functional.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  *
4  * Copyright (c) 1994
5  * Hewlett-Packard Company
6  *
7  * Copyright (c) 1996-1998
8  * Silicon Graphics Computer Systems, Inc.
9  *
10  * Copyright (c) 1997
11  * Moscow Center for SPARC Technology
12  *
13  * Copyright (c) 1999
14  * Boris Fomitchev
15  *
16  * This material is provided "as is", with absolutely no warranty expressed
17  * or implied. Any use is at your own risk.
18  *
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.
24  *
25  */
26 
27 /*
28  * Lifted and paraphrased from STLport - with additions from Fridrich
29  * Strba and Thorsten Behrens
30  */
31 
32 #ifndef INCLUDED_O3TL_FUNCTIONAL_HXX
33 #define INCLUDED_O3TL_FUNCTIONAL_HXX
34 
35 namespace o3tl
36 {
38 template<typename P>
39 struct select1st
40 {
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;
45  }
46 };
47 
49 template<typename P>
50 struct select2nd
51 {
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;
56  }
57 };
58 
59 } // namespace o3tl
60 
61 #endif
62 
63 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
P::second_type result_type
Definition: functional.hxx:53
const result_type & operator()(const argument_type &cp) const
Definition: functional.hxx:43
Select first value of a pair.
Definition: functional.hxx:39
const result_type & operator()(const argument_type &cp) const
Definition: functional.hxx:54
P::first_type result_type
Definition: functional.hxx:42
Select second value of a pair.
Definition: functional.hxx:50