Lambda grouping
To set a widget’s sensitivity based on the results of two boolean functions:
sigc::connection cnx = my_signal.connect( sigc::compose( sigc::group(sigc::mem_fun(widget, &Gtk::Widget::set_sensitive), sigc::_1 && sigc::_2), sigc::mem_fun(this, &MyClass::GetBool1), sigc::mem_fun(this, &MyClass::GetBool2));
The sigc::group is like sigc::compose in that it calls a function and passes something to it. However, what it passes is one or more expressions using sigc::_1, sigc::_2, etc. These represent the parameters passed to this functor when called.
To pass the results of functions to the functor, you must wrap the whole thing in sigc::compose. Then it’s just a matter of passing expressions to be used for sigc::_1, etc.
NOTE: Make sure that you call cnx.disconnect() during cleanup, as some versions of libsigc++ have a bug where connections are not auto-disconnected when using sigc::group.
Hi, can you tell me what auto-disconnect bug you are referring to?