|
Boost : |
From: Lee Brown (lee_at_[hidden])
Date: 2002-01-16 01:03:42
On Tuesday 15 January 2002 13:18, you wrote:
> > From: Peter Dimov [SMTP:pdimov_at_[hidden]]
> >
> > As for release(), I think that it needs to be dropped.
>
> I recently created a special-purpose smart pointer that releases the ref
> count of something relying on a C API. I wanted to write my functions that
> return such pointers to return smart pointer objects to ensure that the ref
> count was decreased even if I simply ignored the return value of such
> functions. However, when returning to the calling C API, I needed to turn
> over the raw pointer in the return value, relinquishing ownership of it. To
> do that, I call release() on my smart pointer class (which, based upon
> Andrei's insight, should be a non-member function).
>
> If I were using a Boost smart pointer without support for release(), how
> would I relinquish ownership()? That is, how do I tell the Boost smart
> pointer to not "deallocate" the pointer it holds, without release()?
Uh. do you have a simple code example? I am slow.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk