Boost logo

Boost :

Subject: Re: [boost] [PATCH Boost.smart_ptr] Add intrusive_ptr<>::release()
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2013-12-04 12:09:06


On Wednesday 04 December 2013 11:30:47 Gottlob Frege wrote:
> On 12/2/13, Avi Kivity <avi_at_[hidden]> wrote:
> > This provides a way to escape from automatic reference counting, and
> > taking
> > manual control of the reference. Useful when interfacing to a C API that
> > expects a pointer with an elevated reference count.
> >
> >
> > + <p><b>Notes:</b> The returned pointer has an
> > elevated reference count. This
>
> I don't think "elevated reference count" is clear enough. How
> elevated? Elevated more?
>
> It should say that it does not decrement the reference count. Or
> "resets the intrusive_ptr without decrementing the reference count".

...without calling intrusive_ptr_release(), since technically intrusive_ptr
itself doesn't operate on counter.

> I don't think either name (release/detach) is clear enough. I'd
> prefer something like
>
> detach_retaining_count()
>
> which isn't quite right either, but I'd be happy with a name that was
> long, *ugly*, and clear. - Ugly because it is a dangerous function.

I don't think it is any more dangerous than unique_ptr::release(), so why
should it be ugly? Next to release(), detach() is my second preference.


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