diff --git a/make_shared_array.html b/make_shared_array.html
index f1e08bc..f2dbe40 100644
--- a/make_shared_array.html
+++ b/make_shared_array.html
@@ -12,12 +12,14 @@
Synopsis
Free Functions
Example
+ History
One criticism of Boost shared_array is
- the lack of utility similar to make_shared
- which ensures only a single allocation for an array. A second criticism
- is Boost shared_array
does not support custom allocators
- and so also lacks an allocate_shared
utility.
Originally the Boost function templates make_shared
and
+ allocate_shared
were for efficient allocation of single
+ objects only. There was a need to have efficient, single, allocation of
+ arrays. One criticism of shared_array was
+ always the lack of a make_shared utility
+ which ensures only a single allocation for an array.
The header files <boost/smart_ptr/make_shared_array.hpp> and
<boost/smart_ptr/allocate_shared_array.hpp> provide new function
templates, make_shared
and allocate_shared
,
@@ -55,10 +57,10 @@
shared_ptr<T[N]> make_shared(initializer_list<T> list);
template<typename T, typename... Args>
- shared_ptr<T[][N]> make_shared(size_t size, initializer_list<T> list);
+ shared_ptr<T[][N]> make_shared(size_t size, initializer_list<T[N]> list);
template<typename T, typename... Args>
- shared_ptr<T[M][N]> make_shared(initializer_list<T> list);
+ shared_ptr<T[M][N]> make_shared(initializer_list<T[N]> list);
template<typename T, typename A, typename... Args>
shared_ptr<T[]> allocate_shared(const A& allocator, initializer_list<T> list);
@@ -67,10 +69,10 @@
shared_ptr<T[N]> allocate_shared(const A& allocator, initializer_list<T> list);
template<typename T, typename A, typename... Args>
- shared_ptr<T[][N]> allocate_shared(const A& allocator, size_t size, initializer_list<T> list);
+ shared_ptr<T[][N]> allocate_shared(const A& allocator, size_t size, initializer_list<T[N]> list);
template<typename T, typename A, typename... Args>
- shared_ptr<T[M][N]> allocate_shared(const A& allocator, initializer_list<T> list);
+ shared_ptr<T[M][N]> allocate_shared(const A& allocator, initializer_list<T[N]> list);
#endif
template<typename T>
@@ -81,9 +83,9 @@
}
template<typename T, typename... Args> - shared_ptr<T> make_shared(size_t size, Args&&... args); + shared_ptr<T[]> make_shared(size_t size, Args&&... args); template<typename T, typename A, typename... Args> - shared_ptr<T> allocate_shared(const A& allocator, size_t size, Args&&... args);+ shared_ptr<T[]> allocate_shared(const A& allocator, size_t size, Args&&... args);
+Requires: The expression
new(pointer) T(forward<Args>(args)...)
, where @@ -122,6 +124,58 @@ template<typename T, typename A, typename... Args> take any constructor arguments. These overloads invoke the default constructor ofT
for each array element.
template<typename T, typename... Args> + shared_ptr<T[N]> make_shared(Args&&... args); +template<typename T, typename A, typename... Args> + shared_ptr<T[N]> allocate_shared(const A& allocator, Args&&... args);+
++Description: These overloads of the utilities above are for a + fixed size array.
+
template<typename T, typename... Args> + shared_ptr<T[]> make_shared(initializer_list<T> list); +template<typename T, typename A, typename... Args> + shared_ptr<T[]> allocate_shared(const A& allocator, initializer_list<T> list);+
++Description: These overloads initialize the array elements + from the initializer list.
+
template<typename T, typename... Args> + shared_ptr<T[N]> make_shared(initializer_list<T> list); +template<typename T, typename A, typename... Args> + shared_ptr<T[N]> allocate_shared(const A& allocator, initializer_list<T> list);+
++Description: These overloads of the utilities above are for a + fixed size array.
+
template<typename T, typename... Args> + shared_ptr<T[][N]> make_shared(size_t size, initializer_list<T[N]> list); +template<typename T, typename A, typename... Args> + shared_ptr<T[][N]> allocate_shared(const A& allocator, size_t size, initializer_list<T[N]> list);+
++Description: These overloads initialize inner array elements + from the initializer list.
+
template<typename T, typename... Args> + shared_ptr<T[M][N]> make_shared(initializer_list<T[N]> list); +template<typename T, typename A, typename... Args> + shared_ptr<T[M][N]> allocate_shared(const A& allocator, initializer_list<T[N]> list);+
++Description: These overloads of the utilities above are for a + fixed size array.
+
template<typename T> + shared_ptr<T[]> make_shared_noinit(size_t size);+
++Description: This overload does not perform value + initialization of elements.
+
template<typename T> + shared_ptr<T[N]> make_shared_noinit();+
+Description: This overload of the utility above is used for a + fixed size array.
+
An example of each overload of make_shared for arrays:
@@ -135,6 +189,9 @@ boost::shared_ptr<int[5][3]> a7 = boost::make_shared<int[5][3]>({1, boost::shared_ptr<int[]> a8 = boost::make_shared_noinit<int[]>(size); boost::shared_ptr<int[5]> a9 = boost::make_shared_noinit<int[5]>();+
November 2012. Glen Fernandes contributed implementations of + make_shared and allocate_shared for arrays.
$Date: 2012-10-30 10:12:25 -0800 (Tue, 30 Oct 2012) $
Copyright 2012 Glen Fernandes. Distributed under the Boost