ESyS-Particle  2.3.2
Functional.h
Go to the documentation of this file.
1 
2 // //
3 // Copyright (c) 2003-2014 by The University of Queensland //
4 // Centre for Geoscience Computing //
5 // http://earth.uq.edu.au/centre-geoscience-computing //
6 // //
7 // Primary Business: Brisbane, Queensland, Australia //
8 // Licensed under the Open Software License version 3.0 //
9 // http://www.opensource.org/licenses/osl-3.0.php //
10 // //
12 
13 #ifndef ESYS_LSMFUNCTIONAL_H
14 #define ESYS_LSMFUNCTIONAL_H
15 
16 #if HAVE_CONFIG_H
17 #include "config.h"
18 #endif
19 
20 #if HAVE_EXT_FUNCTIONAL
21 #include <ext/functional>
22 #endif
23 #if HAVE_FUNCTIONAL
24 #include <functional>
25 #endif
26 
27 #if HAVE_STD__SELECT1ST_PAIR_
28 namespace ext {
29 template <class _Pair> struct select1st
30  : public std::select1st<_Pair> {};
31 }
32 #elif HAVE___GNU_CXX__SELECT1ST_PAIR_
33 namespace ext {
34 template <class _Pair> struct select1st
35  : public __gnu_cxx::select1st<_Pair> {};
36 }
37 #elif !HAVE_EXT__SELECT1ST_PAIR_
38 namespace ext
39 {
40  template <class _Pair>
41  struct select1st
42  : public std::unary_function<_Pair, typename _Pair::first_type>
43  {
44  typename _Pair::first_type&
45  operator()(_Pair& __x) const
46  { return __x.first; }
47 
48  const typename _Pair::first_type&
49  operator()(const _Pair& __x) const
50  { return __x.first; }
51  };
52 }
53 #endif
54 
55 #if HAVE_STD__SELECT2ND_PAIR_
56 namespace ext {
57 template <class _Pair> struct select2nd
58  : public std::select2nd<_Pair> {};
59 }
60 #elif HAVE___GNU_CXX__SELECT2ND_PAIR_
61 namespace ext {
62 template <class _Pair> struct select2nd
63  : public __gnu_cxx::select2nd<_Pair> {};
64 }
65 #elif !HAVE_EXT__SELECT2ND_PAIR_
66 namespace ext
67 {
68  template <class _Pair>
69  struct select2nd
70  : public std::unary_function<_Pair, typename _Pair::second_type>
71  {
72  typename _Pair::second_type&
73  operator()(_Pair& __x) const
74  { return __x.second; }
75 
76  const typename _Pair::second_type&
77  operator()(const _Pair& __x) const
78  { return __x.second; }
79  };
80 }
81 #endif
82 
83 #endif