25 Dec
2004
25 Dec
'04
1:33 a.m.
Reece Dunn wrote:
The handler is currently defined as boost::signal< bool ( event * ev )
, such that ev is the OS-specific event structure and the return value indicates is the message has been processed (and processing should be stopped). Since the signal has a non-member signature, you need a make_handler( Object * ob, bool ( Object::* h )( event * ev )) helper that constructs a function object that will call the member function.
Better would be boost::signal< boost::function<bool ( event * ev )> >. That way the programmer can pass any type of C++ function as the handler, not just member functions of classes from a monolithic bas class. Boost::bind<> is very good at creating function types which boost::function objects can hold.