
Peter Dimov wrote:
Frank Mori Hess wrote:
Couldn't tracked objects could be copied from one slot to another by overloading slot::track to accept a slot as an argument? Then binding a slot to another slot with a different signature would might look like
signal.connect(signal_type::slot_type(slot, _2, _1).track(slot));
It's a bit murky whether track(slot) would only cause the tracked objects of slot to get tracked, or also track the slot itself (or its pimpl). I suppose it would depend on whether copies of slots are deep or share the same SlotFunction.
You don't need tracking for the above example; bind( slot, _2, _1 ) stores a copy of slot.
Now that I think about it, it can be implemented both ways. A slot that requires an explicit lock() before operator() would still need the .track. A slot that throws bad_weak_ptr from operator() would not. This brings us back to the problem of autodisconnects only happening on calls. :-/ It doesn't have to be either-or, though.