libsigc++: compose()
sigc::compose() combines two or three arbitrary functors. More...
Classes | |
struct | sigc::compose1_functor< T_setter, T_getter > |
Adaptor that combines two functors. More... | |
struct | sigc::compose2_functor< T_setter, T_getter1, T_getter2 > |
Adaptor that combines three functors. More... | |
Functions | |
template<typename T_setter , typename T_getter > | |
compose1_functor< T_setter, T_getter > | sigc::compose (const T_setter& setter, const T_getter& getter) |
Creates an adaptor of type sigc::compose1_functor which combines two functors. More... | |
template<typename T_setter , typename T_getter1 , typename T_getter2 > | |
compose2_functor< T_setter, T_getter1, T_getter2 > | sigc::compose (const T_setter& setter, const T_getter1& getter1, const T_getter2& getter2) |
Creates an adaptor of type sigc::compose2_functor which combines three functors. More... | |
Detailed Description
sigc::compose() combines two or three arbitrary functors.
On invocation, parameters are passed on to one or two getter functor(s). The return value(s) are then passed on to the setter function.
- Examples:
- float square_root(float a) { return sqrtf(a); }square_root(9))
The functor sigc::compose() returns can be passed directly into sigc::signal::connect().
- Example:
- sigc::signal(float(float, float)> some_signal;some_signal.connect(sigc::compose(&square_root, &sum));
Function Documentation
template <typename T_setter , typename T_getter >
|
inline |
Creates an adaptor of type sigc::compose1_functor which combines two functors.
- Parameters
-
setter Functor that receives the return value of the invocation of getter. getter Functor to invoke from operator()().
- Returns
- Adaptor that executes setter with the value returned from invocation of getter.
template <typename T_setter , typename T_getter1 , typename T_getter2 >
|
inline |
Creates an adaptor of type sigc::compose2_functor which combines three functors.
- Parameters
-
setter Functor that receives the return values of the invocation of getter1 and getter2. getter1 Functor to invoke from operator()(). getter2 Functor to invoke from operator()().
- Returns
- Adaptor that executes setter with the values return from invocation of getter1 and getter2.