
Darren Vincent Hart wrote: [...]
struct widget { boost::signal
sig; boost::signal keypress; bool test() { cout << "widget::test() - sig empty: " << (sig.empty() ? "true" : "false") << endl; sig(); return true; } }; [...] // bind to a widget signal handler, BROKEN //handler<bool> handler_b( boost::bind<bool>(&widget::sig, &widget_a) ); // <-- Broken [...] // store the function object returned by binding a widget signal, BROKEN //boost::function fp = boost::bind(&widget::sig, &widget_a); // <-- BROKEN // executre the functor returned by binding a widget signal, BROKEN // (builds, but doesn't really call widget_a.sig()) boost::bind(&widget::sig, &widget_a)(); // <-- Test if binding works at all, it doesn't
bind(&widget::sig, &widget_a)() gets you a reference to widget_a->sig since
&widget::sig is a data member. You still need to call it.
bool call(signal