Boost logo

Boost :

Subject: [boost] make_shared_array
From: Peter Dimov (lists_at_[hidden])
Date: 2012-11-01 08:07:35


Glen Fernandes has kindly contributed an implementation of make_shared_array
and allocate_shared_array. These are like make_shared and allocate_shared,
except that they take a size_t argument N and allocate an array of N

Glen has made the functions return a shared_ptr, mostly because they are
non-intrusive and it's not possible to return a shared_array without changes
to shared_ptr and shared_array.

But we can make such changes when we put the functions in Boost. So the
question is, should we?

It makes almost no sense to have a function called make_shared_array that
does not, in fact, make a shared_array. On the other hand, Glen posits that
some people may prefer to use shared_ptr instead of shared_array in their
code for various reasons, one of which is that shared_array's default
constructor can throw.


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