Boost logo

Boost :

Subject: Re: [boost] [smart_ptr] scoped_array / shared_array (size_t) constructor
From: Olaf van der Spek (ml_at_[hidden])
Date: 2011-11-04 12:35:11


On Fri, Nov 4, 2011 at 5:02 PM, Andrey Semashev
<andrey.semashev_at_[hidden]> wrote:
>> > That sounds like a good idea.
>>
>> Great. Does anyone else have comments / concerns about a (size_t)
>> constructor?
>
> I still don't like the idea. If you really want to add this feature, please

Why not?

> retain the current interface intact. You could add a special manipulator to
> make the allpcation request explicit, like this:

What *exactly* is the interface you'd like to retain?

>  boost::scoped_array< int > p(boost::allocate_count(10));
>
> Here allocate_count is a simple class that holds the size of the array to be
> allocated. Alternatively, Boost.Parameter could be used, but it is quite heavy
> for such basic tools like smart pointers.

-- 
Olaf

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