Boost logo

Boost :

From: Stewart, Robert (stewart_at_[hidden])
Date: 2002-01-15 15:18:18

> 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()?

Susquehanna International Group, LLP

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