Boost logo

Boost :

From: Jonathan Turkanis (technews_at_[hidden])
Date: 2004-01-14 20:27:44

"Sean Kelly" <sean_at_[hidden]> wrote in message
> Currently, there's no way to force a shared_ptr to release something
> it has been given ownership of it. I've run into instances where I
use a
> shared_ptr to hold an object in an STL container and then I want to
> it on to another code segment. While I could pass a shared_ptr, I
> prefer to use auto_ptr to convey that ownsership is indeed being
> transferred. This is particularly important in a few cases where
> transferral is between threads and I don't want to use an
> version of shared_ptr.
> I understand the danger of providing such a method, but to me the
> of use_count() and unique() implies that there are instances where
> programmer might want to do something like this. Are there any
> reasons why a release method hasn't been included aside from the
> possibility of double destruction?

Also the possibility of incorrect destruction, since the released
pointer, even if unique, becomes decoupled from its deleter.


Boost list run by bdawes at, gregod at, cpdaniel at, john at