yat  0.19pre
Public Member Functions | Related Functions | List of all members
theplu::yat::utility::compose_f_gx_hy< F, G, H > Class Template Reference

#include <yat/utility/stl_utility.h>

Inheritance diagram for theplu::yat::utility::compose_f_gx_hy< F, G, H >:

Public Member Functions

 compose_f_gx_hy (void)
 default constructor More...
 compose_f_gx_hy (F f, G g, H h)
F::result_type operator() (typename G::argument_type x, typename H::argument_type y) const
 Does the work.

Related Functions

(Note that these are not member functions.)

template<class F , class G , class H >
compose_f_gx_hy< F, G, H > make_compose_f_gx_hy (F f, G g, H h)

Detailed Description

template<class F, class G, class H>
class theplu::yat::utility::compose_f_gx_hy< F, G, H >

See The C++ Standard Library - A Tutorial and Reference by Nicolai M. Josuttis

If f is a binary functor, both g and h are unary functors, and return type of g (and h) is convertible to F's argument type, then compose_f_gx_hy can be used to create a functor equivalent to $ f(g(x), h(y)) $

See also
compose_f_gxy, compose_f_gx, and compose_f_gx_hx

Here is an example using the class to construct a functor that compares std::pairs ignoring second.

vector<pair<string, foo> > data;
data.push_back(make_pair("Orange", foo(2));
data.push_back(make_pair("Orange", foo(1));
data.push_back(make_pair("Apple", foo(10));
typedef PairFirst<const pair<string, foo> > PF;
compose_f_gx_hy<less<string>, PF, PF> compare;
sort(data.begin(), data.end(), compare);

Constructor & Destructor Documentation

template<class F, class G, class H>
theplu::yat::utility::compose_f_gx_hy< F, G, H >::compose_f_gx_hy ( void  )

default constructor

Requires that F, G, and H have default constructors

Friends And Related Function Documentation

template<class F , class G , class H >
compose_f_gx_hy< F, G, H > make_compose_f_gx_hy ( f,

Convenient function to create a compose_f_gx_hy.

See also

The documentation for this class was generated from the following file:

Generated on Mon Jan 18 2021 02:25:56 for yat by  doxygen 1.8.11