Darren Vincent Hart wrote: [...]
struct handler { char key_; boost::signal
sig; handler(char key) : key_(key) { }
bool operator()(char key) { cout << "handler::operator() - received a " << key << endl; if (!sig.empty() && key == key_) { cout << "\texecuting slot\n\t"; sig(); } cout << endl; return true; } };
[...]
// THE PROBLEM IS HERE - HOW DO I BIND TO handler_a.test(char) ? widget_b.keypress.connect( boost::bind(&handler::operator(), &handler_a) ); // END PROBLEM
I think that you want widget_b.keypress.connect( boost::ref(handler_a) ); The reason for the error is that &handler::operator() takes two arguments (the implicit 'this' and 'char key') but you are trying to bind it to just one, &handler_a. The correct statement is widget_b.keypress.connect( boost::bind(&handler::operator(), &handler_a, _1) );