![]() |
For each parameter that should be passed to the wrapped functor one lambda expression has to be passed into group(). Lambda selectors can be used as placeholders for the arguments passed into the new functor. Arguments that don't have a placeholder in one of the lambda expressions are dropped.
void foo(int, int); int bar(int); // argument binding ... sigc::group(&foo,10,sigc::_1)(20); //fixes the first argument and calls foo(10,20) sigc::group(&foo,sigc::_1,30)(40); //fixes the second argument and calls foo(40,30) // argument reordering ... sigc::group(&foo,sigc::_2,sigc::_1)(1,2); //calls foo(2,1) // argument hiding ... sigc::group(&foo,sigc::_1,sigc::_2)(1,2,3); //calls foo(1,2) // functor composition ... sigc::group(&foo,sigc::_1,sigc::group(&bar,sigc::_2))(1,2); //calls foo(1,bar(2)) // algebraic expressions ... sigc::group(&foo,sigc::_1*sigc::_2,sigc::_1/sigc::_2)(6,3); //calls foo(6*3,6/3)
sigc::signal<void,int,int> some_signal; void foo(int); some_signal.connect(sigc::group(&foo,sigc::_2));
int some_int; sigc::signal<void> some_signal; void foo(int&); some_signal.connect(sigc::group(&foo,sigc::ref(some_int)));
struct bar : public sigc::trackable {} some_bar; sigc::signal<void> some_signal; void foo(bar&); some_signal.connect(sigc::group(&foo,sigc::ref(some_bar))); // disconnected automatically if some_bar goes out of scope