18 Aug
2006
18 Aug
'06
5:21 p.m.
On 8/18/06, Scott Meyers
... 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