Boost logo

Boost Users :

From: Darren Vincent Hart (dvhart_at_[hidden])
Date: 2003-09-09 12:35:12

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<bool ()> 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));


Many thanks in advance,

Darren Hart

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at