Darren Vincent Hart wrote:
Boost gurus,
I am using boost::bind in combination with boost::signals for a GUI toolkit. The signals return bool for convenience, but it is often desireable to bind a void function and connect it to a signal. Is there a convenient way to assign a return value for a void function.
As an example:
-----------------------------------------------------------------
struct panel { void print() { std::cout << "print" << std::endl; } }
struct widget { boost::signal
on_event; } panel p; widget w;
// is there some way to do something like this? w.on_event.connect(boost::bind_return(panel::print, &p, true));
You can do this with Lambda:
using namespace boost::lambda;
w.on_event.connect( (bind(panel::print, &p), true) );
but not with boost::bind, sorry.
Not out of the box, anyway.
template