Douglas Gregor wrote:
On Wednesday 27 August 2003 04:51 pm, Edward Diener wrote:
If so, it provides an alternative trackable model to the derivation one in the current Boost.Signals library but with its own downside. The major one would be that the object must be dynamically allocated. Whereas in the current implementation this is not necessary. The plus side is that it would no longer be necessary to derive from a particular base class in order to be trackable. So there are definite tradeoffs both ways. If the library were willing to live with and create multiple means that the object be trackable, which I see as perfectly viable and in the spririt of C++, I would say it should create your choice also.
I've had plans to support something like what Peter suggests for a while (he suggested it a while ago <g>), but unfortunately it's a little more complicated than just catching bad_weak_ptr because of the slot_call_iterator. You actually have to figure out what weak_ptrs are sitting around and check if they can be locked ahead of time.
I didn't mean to say that it should be done, no matter how difficult it might be, only that if it were easily doable it might be a good addition to Boost.Signals as an alternative way of tracking objects.