Util--  1.1
binary_compose.hh
Go to the documentation of this file.
1 /* -*- C++ -*-
2  * $Id: binary_compose.hh 957 2005-03-07 16:01:20Z sjoyeux $
3  */
4 #ifndef UTILMM_FUNCTIONAL_BINARY_COMPOSE_HEADER
5 # define UTILMM_FUNCTIONAL_BINARY_COMPOSE_HEADER
6 
7 # include <functional>
8 
10 
11 namespace utilmm {
12 
34  template<class BinaryFun, class UnaryFun1, class UnaryFun2>
36  :public std::binary_function<typename UnaryFun1::argument_type,
37  typename UnaryFun2::argument_type,
38  typename BinaryFun::result_type> {
39  private:
40  BinaryFun bin_fn;
41  UnaryFun1 fun_1;
42  UnaryFun2 fun_2;
43 
44  typedef typename
46  typedef typename
48 
49  public:
64  binary_compose_2(BinaryFun const &bin, UnaryFun1 const &one,
65  UnaryFun2 const &two)
66  :bin_fn(bin), fun_1(one), fun_2(two) {}
67 
77  typename BinaryFun::result_type operator()(first_arg a, second_arg b)
78  const {
79  return bin_fn(fun_1(a), fun_2(b));
80  }
81 
82  }; // class utilmm::binary_compose_2<>
83 
100  template<class Bin, class Fun1, class Fun2>
101  binary_compose_2<Bin, Fun1, Fun2> compose2_2(Bin const &f, Fun1 const &a,
102  Fun2 const &b) {
103  return binary_compose_2<Bin, Fun1, Fun2>(f, a, b);
104  }
105 
106 } // namespace utilmm
107 
108 #endif // UTILMM_FUNCTIONAL_BINARY_COMPOSE_HEADER
109 
binary_compose_2< Bin, Fun1, Fun2 > compose2_2(Bin const &f, Fun1 const &a, Fun2 const &b)
Composition function.
Definition: binary_compose.hh:101
BinaryFun::result_type operator()(first_arg a, second_arg b) const
Call operator.
Definition: binary_compose.hh:77
Definition: auto_flag.hh:6
Definition of utilmm::arg_traits class.
Binary functor composition with two unary functors.
Definition: binary_compose.hh:35
computed_type type
argument type
Definition: arg_traits.hh:38
binary_compose_2(BinaryFun const &bin, UnaryFun1 const &one, UnaryFun2 const &two)
Constructor.
Definition: binary_compose.hh:64

Generated on Mon Sep 24 2018 17:06:40 for Util-- by doxygen 1.8.13
SourceForge.net Project Page