Boost logo

Boost Users :

From: Felipe Magno de Almeida (felipe.m.almeida_at_[hidden])
Date: 2006-03-21 13:14:58


On 3/21/06, Nat Goodspeed <ngoodspeed_at_[hidden]> wrote:

[snipped]

> >
> > 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

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net