From: Sven Van Echelpoel (sven.vanechelpoel_at_[hidden])
Date: 2003-04-22 04:13:45
>Sven Van Echelpoel wrote:
>> Is there a reason why siganls aren't copyable?
>Can you briefly describe what the copy semantics should be?
For my application each copy of a signal should reference the same slot
list, so that clients can connect slots to a signal after that signal
(or better a copy of it) is stored somewhere (See the example of the
event recorder in my original posting). Simply removing the noncopyable
base class does the trick for me, as the shared_ptr to the
implementation in signal_base provides exactly these semantics (by now I
have tried it in a simple test project and it seems to work).
Maybe this behavior may be a bit weird in some case and it may be more
appropriate to have each signal have its own copy of the slot list after
a copy, but that's not what I need. This sort of stuff is exactly why I
asked this question in the first place, since I can always work around
it by binding the arguments a to boost::function<> object that
references the signal instead of directly binding the arguments to the
signal. So instead of:
events_.push_back( bind( ev, i ) );
I have to write something like:
events_.push_back( bind( function<void(int)>( ref( ev ) ), i ) );
I guess I'm just being lazy.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk