mirror of
https://github.com/boostorg/smart_ptr.git
synced 2025-10-18 10:25:25 +02:00
Add additional overload for allocate_shared and make_shared array forms that take initializer list of T for the array types T[M][N]
[SVN r81341]
This commit is contained in:
@@ -56,7 +56,10 @@
|
||||
|
||||
template<typename T, typename... Args>
|
||||
shared_ptr<T[][N]> <a href="#functions">make_shared</a>(size_t size, initializer_list<T> list);
|
||||
|
||||
|
||||
template<typename T, typename... Args>
|
||||
shared_ptr<T[M][N]> <a href="#functions">make_shared</a>(initializer_list<T> list);
|
||||
|
||||
template<typename T, typename A, typename... Args>
|
||||
shared_ptr<T[]> <a href="#functions">allocate_shared</a>(const A& allocator, initializer_list<T> list);
|
||||
|
||||
@@ -65,6 +68,9 @@
|
||||
|
||||
template<typename T, typename A, typename... Args>
|
||||
shared_ptr<T[][N]> <a href="#functions">allocate_shared</a>(const A& allocator, size_t size, initializer_list<T> list);
|
||||
|
||||
template<typename T, typename A, typename... Args>
|
||||
shared_ptr<T[M][N]> <a href="#functions">allocate_shared</a>(const A& allocator, initializer_list<T> list);
|
||||
#endif
|
||||
|
||||
template<typename T>
|
||||
@@ -117,7 +123,15 @@ template<typename T, typename A, typename... Args>
|
||||
constructor of <code>T</code> for each array element.</p>
|
||||
</blockquote>
|
||||
<h2><a name="example">Example</a></h2>
|
||||
<pre>boost::shared_ptr<int[]> array = boost::make_shared<int[]>(size);</pre>
|
||||
<pre>boost::shared_ptr<int[]> a1 = boost::make_shared<int[]>(size);
|
||||
boost::shared_ptr<point[5]> a2 = boost::make_shared<point[5]>(x, y);
|
||||
boost::shared_ptr<int[5]> a3 = boost::make_shared<int[5]>();
|
||||
boost::shared_ptr<int[]> a4 = boost::make_shared<int[]>({1, 2, 3});
|
||||
boost::shared_ptr<int[3]> a5 = boost::make_shared<int[3]>({1, 2, 3});
|
||||
boost::shared_ptr<int[][3]> a6 = boost::make_shared<int[][3]>(size, {1, 2, 3});
|
||||
boost::shared_ptr<int[5][3]> a7 = boost::make_shared<int[5][3]>({1, 2, 3});
|
||||
boost::shared_ptr<int[]> a8 = boost::make_shared_noinit<int[]>(size);
|
||||
boost::shared_ptr<int[5]> a9 = boost::make_shared_noinit<int[5]>();</pre>
|
||||
<hr>
|
||||
<p>$Date: 2012-10-30 10:12:25 -0800 (Tue, 30 Oct 2012) $</p>
|
||||
<p><small>Copyright 2012 Glen Fernandes. Distributed under the Boost
|
||||
|
Reference in New Issue
Block a user