
On 3/21/06, Nat Goodspeed
Couldnt be a weak_ptr ?
[Nat] It could. But AFAICT the big advantage of a weak_ptr over a dumb base* pointer is that a weak_ptr can detect when the referenced object has been deleted. Since our base-class destructor unregisters the object, deleting the registered pointer, that becomes a non-issue. So for this use case, I see no particular advantage to using weak_ptr rather than a dumb pointer.
weak-ptr is thread-safe. So, if someone was trying to work with the pointer while the class gets its reference counting to zero there wouldnt be a race condition. But I dont know how important it was to your project. Probably you enforced that this couldnt be possible somehow. [snipped] Best regards, -- Felipe Magno de Almeida