![]() |
![]() |
![]() |
Classes | |
struct | sigc::hide_functor<-1, T_functor > |
Adaptor that adds a dummy parameter to the wrapped functor. More... | |
struct | sigc::hide_functor<0, T_functor> |
Adaptor that adds a dummy parameter to the wrapped functor. More... | |
struct | sigc::hide_functor<1, T_functor> |
Adaptor that adds a dummy parameter to the wrapped functor. More... | |
struct | sigc::hide_functor<2, T_functor> |
Adaptor that adds a dummy parameter to the wrapped functor. More... | |
struct | sigc::hide_functor<3, T_functor> |
Adaptor that adds a dummy parameter to the wrapped functor. More... | |
struct | sigc::hide_functor<4, T_functor> |
Adaptor that adds a dummy parameter to the wrapped functor. More... | |
struct | sigc::hide_functor<5, T_functor> |
Adaptor that adds a dummy parameter to the wrapped functor. More... | |
struct | sigc::hide_functor<6, T_functor> |
Adaptor that adds a dummy parameter to the wrapped functor. More... | |
Functions | |
template<class T_action, int I_location, class T_functor> | |
void | sigc::visit_each (const T_action& _A_action, const hide_functor<I_location, T_functor>& _A_target) |
Performs a functor on each of the targets of a functor. | |
template<int I_location, class T_functor> | |
hide_functor < I_location, T_functor > | sigc::hide (const T_functor& _A_func) |
Creates an adaptor of type sigc::hide_functor which adds a dummy parameter to the passed functor. | |
template<class T_functor> | |
retype_return_functor <void, T_functor> | sigc::hide_return (const T_functor& _A_functor) |
Creates an adaptor of type sigc::retype_return_functor which drops the return value of the passed functor. |
Thus you can discard one or more of the arguments of a signal.
You may optionally specify the zero-based position of the parameter to ignore as a template argument. The default is to ignore the last parameter. (A value of -1
adds a parameter at the end so sigc::hide<-1>() gives the same result as sigc::hide().)
The type of the parameter can optionally be specified if not deduced.
void foo(int, int); // single argument hiding ... sigc::hide(&foo)(1,2,3); // adds a dummy parameter at the back and calls foo(1,2) sigc::hide<-1>(&foo)(1,2,3); // same as sigc::hide(&foo)(1,2,3) (calls foo(1,2)) sigc::hide<0>(&foo)(1,2,3); // adds a dummy parameter at the beginning and calls foo(2,3) sigc::hide<1>(&foo)(1,2,3); // adds a dummy parameter in the middle and calls foo(1,3) sigc::hide<2>(&foo)(1,2,3); // adds a dummy parameter at the back and calls foo(1,2) // multiple argument hiding ... sigc::hide(sigc::hide(&foo))(1,2,3,4); // adds two dummy parameters at the back and calls foo(1,2)
sigc::signal<void,int> some_signal; void foo(); some_signal.connect(sigc::hide(&foo));
For a more powerful version of this functionality see the lambda library adaptor sigc::group() which can bind, hide and reorder arguments arbitrarily. Although sigc::group() is more flexible, sigc::hide() provides a means of hiding parameters when then total number of parameters called is variable.
hide_functor<-1, T_functor > sigc::hide | ( | const T_functor & | _A_func | ) | [inline] |
Creates an adaptor of type sigc::hide_functor which adds a dummy parameter to the passed functor.
The optional template argument I_location specifies the zero-based position of the dummy parameter in the returned functor (-1
stands for the last parameter).
_A_func | Functor that should be wrapped. |
_A_func | Functor that should be wrapped. |
retype_return_functor<void, T_functor> sigc::hide_return | ( | const T_functor & | _A_functor | ) | [inline] |
Creates an adaptor of type sigc::retype_return_functor which drops the return value of the passed functor.
_A_functor | Functor that should be wrapped. |
void sigc::visit_each | ( | const T_action & | _A_action, | |
const hide_functor< I_location, T_functor > & | _A_target | |||
) | [inline] |
Performs a functor on each of the targets of a functor.
The function overload for sigc::hide_functor performs a functor on the functor stored in the sigc::hide_functor object.