|
Boost : |
Subject: Re: [boost] [smart_ptr] scoped_array / shared_array (size_t) constructor
From: Olaf van der Spek (ml_at_[hidden])
Date: 2011-10-28 14:05:07
On Thu, Oct 27, 2011 at 10:00 PM, Ivan Sorokin <vanyacpp_at_[hidden]> wrote:
> On 27.10.2011 01:14, Olaf van der Spek wrote:
>
>>> Maybe off-topic, but why should one prefer scoped_array to vector? Just
>>> curious, I never used it myself.
>>
>> And it can be used when construction of elements (like int) is
>> unwanted.
>>
>
> Then "new T[sz]" will be better than "new T[sz]()".
That's also my preference.
>> 2. What should happen when size = 0? Should it call new T[0] or
>> should it just use NULL?
>
> Will two overloads scoped_ptr(T*) and scoped_ptr(size_t) conflict with each
> other, when somebody calls scoped_ptr<T>(0)?
Maybe. Why would one use scoped_ptr<T>(0) instead of scoped_ptr<T>() though?
-- Olaf
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk