Boost logo

Boost Users :

From: Jonathan Franklin (franklin.jonathan_at_[hidden])
Date: 2006-08-18 13:21:23


On 8/18/06, Scott Meyers <usenet_at_[hidden]> wrote:

> ... If A uses a
> shared_ptr to B and B uses a weak_ptr to A, B's life will be shorter than
> A's
> (its destructor will be invoked from A's destructor and will run to
> completion
> before A's does), so there is no advantage to a weak_ptr being able to
> tell if
> it dangles.

I may also be missing some context here, however I think the fact that we're
using a shared_ptr to B (instead of a scoped_ptr) indicates that we're not
guaranteed to be the only ones w/ a shared_ptr to B, in which case we can't
guarantee that B's life will be shorter than A's.

Jon



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