|
Boost : |
Subject: Re: [boost] make_shared_array
From: Giovanni Piero Deretta (gpderetta_at_[hidden])
Date: 2012-11-02 09:33:06
On Fri, Nov 2, 2012 at 12:37 AM, Peter Dimov <lists_at_[hidden]> wrote:
> Olaf van der Spek wrote:
>
> Does Glen's make_shared_array have variants for both initialized and
>> uninitialized allocations (for builtin types)?
>>
>
> This is a thorny issue. Some people want initialized allocations, some
> don't. I'm personally in the initialized camp, so I think that
> make_shared_array should initialize. But there is a legitimate need to
> allocate big uninitialized arrays. We probably ought to provide both.
>
what about a boost::uninitialized object which is implicitly convertible to
any T and will return an uninitialized T? On existing code (think
std::vector<int> x(my_size, boost::uninitialized) ) there is hope that
optimizing compilers may see the dead read and optimize initialization
loops away, while new code may explicitly overload on the
boost::uninitialized type.
-- gpd
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk