Util--  1.1
utils.hh
Go to the documentation of this file.
1 /* -*- C++ -*-
2  * $Id: utils.hh 957 2005-03-07 16:01:20Z sjoyeux $
3  */
4 #ifndef UTILMM_FUNCTIONAL_UTILS_HEADER
5 # define UTILMM_FUNCTIONAL_UTILS_HEADER
6 
8 # include <functional>
9 
10 namespace utilmm {
11 
23  template<typename Ty>
24  struct identity :public std::unary_function<Ty, Ty> {
25  private:
26  typedef typename arg_traits<Ty>::type arg_type;
27 
28  public:
33  arg_type operator()(arg_type x) const {
34  return x;
35  }
36  }; // struct utilmm::identity<>
37 
49  template<class Pair>
50  struct select_1st
51  :public std::unary_function<Pair, typename Pair::first_type> {
57  typename Pair::first_type const &operator()(Pair const &p) const {
58  return p.first;
59  }
60  }; // struct utilmm::select_1st<>
61 
73  template<class Pair>
74  struct select_2nd
75  :public std::unary_function<Pair, typename Pair::second_type> {
81  typename Pair::second_type const &operator()(Pair const &p) const {
82  return p.second;
83  }
84  }; // struct utilmm::select_2nd<>
85 
86 } // namespace utilmm
87 
88 #endif // UTILMM_FUNCTIONAL_UTILS_HEADER
89 
Pair::first_type const & operator()(Pair const &p) const
call operator
Definition: utils.hh:57
Identity functor.
Definition: utils.hh:24
arg_type operator()(arg_type x) const
Identity call.
Definition: utils.hh:33
Pair::second_type const & operator()(Pair const &p) const
call operator
Definition: utils.hh:81
Second pair attribute access.
Definition: utils.hh:74
First pair attribute access.
Definition: utils.hh:50
Definition: auto_flag.hh:6
Definition of utilmm::arg_traits class.
computed_type type
argument type
Definition: arg_traits.hh:38

Generated on Mon Oct 22 2018 18:39:28 for Util-- by doxygen 1.8.13
SourceForge.net Project Page