On Feb 6, 2005, at 10:13 AM, Tony Juricic wrote:
Shame be where it belongs, after rading documentation, implementation, examples and test code, I am unable to write what should be simple signals code:
--------------------------------------------- *.h
typedef boost::function
Callback;
You should replace the Callback typedef with:
typedef boost::signal
boost::signal
mySignal; void Signal::Connect(Callback f) { // iterate over signal slots, if slot equals input f do nothing // otherwise connect f }
This operation is not possible with Signals: you can't get at the individual slots once they're connected. Essentially, Signals was designed with the idea that comparing function objects for equality when connecting/disconnecting is a bad idea, because it breaks down when the function objects you build are non-trivial (because it becomes hard to duplicate the function object when calling disconnect()). Doug