Boost logo

Boost :

From: Alexander Terekhov (terekhov_at_[hidden])
Date: 2003-10-09 10:28:12


Peter Dimov wrote:
[...]
> That's shared_ptr::reset. p_ is not necessarily a shared_ptr. The technique
> describes how a deleter can be used to hold another smart pointer.
>
> The code as written assumes that p_.reset() is nothrow. The catch(...)
> suggestion is for the case where p_.reset() only gives the basic guarantee.

Show me please a "smart" pointer with basic reset().

[...]
> > also wrote "~weak_ptr(); Effects: Destroys this weak_ptr but has no
> > effect on the object its stored pointer points to.".
>
> That is correct. ~weak_ptr does not destroy the object (invoke the deleter),
> but it can destroy the deleter, if *this is the last remaining reference to
> it.

Yeah, but this, in turn, might "release" another smart pointer if a
deleter happens to hold another smart pointer that doesn't offer the
nothrow guarantee for its reset(), right?

regards,
alexander.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk