mirror of
https://github.com/boostorg/smart_ptr.git
synced 2026-02-22 18:25:08 +01:00
Add overloads of make_shared and allocate_shared for arrays for E&& where E is typename boost::detail::array_base<T>::type
[SVN r81700]
This commit is contained in:
@@ -75,6 +75,20 @@
|
||||
|
||||
template<typename T, typename A, typename... Args>
|
||||
shared_ptr<T[M][N]> <a href="#functions">allocate_shared</a>(const A& allocator, const T (&list)[N]);
|
||||
|
||||
#if defined(BOOST_HAS_RVALUE_REFS)
|
||||
template<typename T>
|
||||
shared_ptr<T[]> <a href="#functions">make_shared</a>(size_t size, T&& value);
|
||||
|
||||
template<typename T>
|
||||
shared_ptr<T[N]> <a href="#functions">make_shared</a>(T&& value);
|
||||
|
||||
template<typename T, typename A>
|
||||
shared_ptr<T[]> <a href="#functions">allocate_shared</a>(const A& allocator, size_t size, T&& value);
|
||||
|
||||
template<typename T, typename A>
|
||||
shared_ptr<T[N]> <a href="#functions">allocate_shared</a>(const A& allocator, T&& value);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
template<typename T>
|
||||
@@ -162,6 +176,22 @@ template<typename T, typename A, typename... Args>
|
||||
shared_ptr<T[M][N]> make_shared(const T (&list)[N]);
|
||||
template<typename T, typename A, typename... Args>
|
||||
shared_ptr<T[M][N]> allocate_shared(const A& allocator, const T (&list)[N]);</pre>
|
||||
<blockquote>
|
||||
<p><b>Description:</b> These overloads of the utilities above are for a
|
||||
fixed size array.</p>
|
||||
</blockquote>
|
||||
<pre>template<typename T>
|
||||
shared_ptr<T[]> make_shared(size_t size, T&& value);
|
||||
template<typename T, typename A>
|
||||
shared_ptr<T[]> allocate_shared(const A& allocator, size_t size, T&& value);</pre>
|
||||
<blockquote>
|
||||
<p><b>Description:</b> These overloads initialize array elements with
|
||||
the given value.</p>
|
||||
</blockquote>
|
||||
<pre>template<typename T>
|
||||
shared_ptr<T[N]> make_shared(T&& value);
|
||||
template<typename T, typename A>
|
||||
shared_ptr<T[N]> allocate_shared(const A& allocator, T&& value);</pre>
|
||||
<blockquote>
|
||||
<p><b>Description:</b> These overloads of the utilities above are for a
|
||||
fixed size array.</p>
|
||||
@@ -188,8 +218,10 @@ 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>
|
||||
boost::shared_ptr<point[]> a8 = boost::make_shared<point[]>(4, {x, y});
|
||||
boost::shared_ptr<point[4]> a9 = boost::make_shared<point[4]>({x, y});
|
||||
boost::shared_ptr<int[]> a10 = boost::make_shared_noinit<int[]>(size);
|
||||
boost::shared_ptr<int[5]> a11 = boost::make_shared_noinit<int[5]>();</pre>
|
||||
</blockquote>
|
||||
<h2><a name="history">History</a></h2>
|
||||
<p>November 2012. Glen Fernandes contributed implementations of
|
||||
|
||||
Reference in New Issue
Block a user