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


"Sean Kelly" <sean_at_[hidden]> wrote in message
news:20040114163629.U55905_at_seattle.f4.ca...
> Currently, there's no way to force a shared_ptr to release something
once
> 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
pass
> it on to another code segment. While I could pass a shared_ptr, I
would
> prefer to use auto_ptr to convey that ownsership is indeed being
> transferred. This is particularly important in a few cases where
the
> transferral is between threads and I don't want to use an
interlocked
> version of shared_ptr.
>
> I understand the danger of providing such a method, but to me the
presense
> of use_count() and unique() implies that there are instances where
the
> programmer might want to do something like this. Are there any
other
> 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.

Jonathan