Boost logo

Boost Users :

Subject: Re: [Boost-users] [smart_ptr] weak_ptr pointer semantics
From: Dave Abrahams (dave_at_[hidden])
Date: 2011-11-11 17:26:48


on Fri Nov 11 2011, Tim Musson <Tim.Musson-AT-alltechmedusa.com> wrote:

> After re-reading your reply, I think your confusion comes from the
> following idea: "I still have weak_ptr<> which has a counter ". A
> line from the weat_ptr<> documentation states that "When the last
> shared_ptr to the object goes away and the object is deleted, the
> attempt to obtain a shared_ptr from the weak_ptr instances that refer
> to the deleted object will fail". So, weak_ptr does not have a
> counter,

Oh, but it does. There's a separate counter that counts related weak
pointers even after the "strong" refcount goes to zero. Whether or not
that has any relevance here, I don't know.

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

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