Boost logo

Boost :

Subject: Re: [boost] make_shared_array
From: Peter Dimov (lists_at_[hidden])
Date: 2012-11-01 20:37:18

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. So how

make_shared_array<T>( size_t n, Args&&... args )
    // uses new(pv) T( args... )

make_shared_array_noinit<T>( size_t n )
    // uses new(pv) T

allocate_shared_array<T>( A const& a, size_t n, Args&&... args )
    // uses new(pv) T( args... ) for now, but
    // A::construct( pv, args... ) at some point
    // when std::allocator_traits becomes widespread

Boost list run by bdawes at, gregod at, cpdaniel at, john at