Boost logo

Boost :

Subject: Re: [boost] scoped_ptr deleter
From: Howard Hinnant (howard.hinnant_at_[hidden])
Date: 2009-09-16 12:28:13


On Sep 16, 2009, at 12:10 PM, Gottlob Frege wrote:

> On Wed, Sep 16, 2009 at 11:47 AM, Howard Hinnant
> <howard.hinnant_at_[hidden]> wrote:
>>
>> const unique_ptr<MyClass, MyDeleter<A>> p(...);
>>
>
> scoped_ptr<MyClass, MyDeleter<A>> p(...);
>
>>
>> -Howard
>>
>
> If you had the scoped_ptr as you described, which would you then use -
> const unique_ptr or scoped_ptr?
> My first thought is that scoped_ptr is better named, making it easier
> to understand for readers/maintainers.
> ?

I would have a slight preference for const unique_ptr because it
doesn't have swap or reset. It is *really* const. Beyond that it
probably wouldn't matter much as I find myself typedefing most of my
uses to something more descriptive within the context I'm using it,
and easier to type. E.g.:

typedef const unique_ptr<node_pointer, node_allocator> node_holder;

-Howard


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