Boost logo

Boost Users :

Subject: Re: [Boost-users] [smart_ptr] weak_ptr / shared_ptr interaction
From: Alexander Heinrich (alexander.tobias.heinrich_at_[hidden])
Date: 2009-07-03 12:20:41


> Both s1 and s2 should now have use_count of 2 at this point, since there
> are 2 shared_ptrs sharing ownership of the same pointee.
>
> The post-condition expression is correct; the value of r.use_count()
> was changed by the construction of the new shared_ptr.

Thanks for your reply. So you're saying that the behavior of shared_ptr is
correct (perfectly fine with me). But then I have to say, that the
documentation of shared_ptr located under
http://www.boost.org/doc/libs/1_39_0/libs/smart_ptr/shared_ptr.htm#constructors
is wrong, because it says that if you construct a shared_ptr from a weak_ptr
(!) the use_count will *not* change.



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