forked from boostorg/smart_ptr
Small improvements to make_shared documentation.
[SVN r83827]
This commit is contained in:
@ -29,85 +29,85 @@
|
||||
allowing finer control.</p>
|
||||
<h2><a name="Synopsis">Synopsis</a></h2>
|
||||
<pre>namespace boost {
|
||||
template<typename T>
|
||||
shared_ptr<T[]> <a href="#functions">make_shared</a>(size_t size);
|
||||
template<typename U> // U = T[]
|
||||
shared_ptr<U> <a href="#functions">make_shared</a>(size_t size);
|
||||
|
||||
template<typename T, typename A>
|
||||
shared_ptr<T[]> <a href="#functions">allocate_shared</a>(const A& allocator, size_t size);
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
template<typename T, typename... Args>
|
||||
shared_ptr<T[]> <a href="#functions">make_shared</a>(size_t size, Args&&... args);
|
||||
template<typename U, typename A> // U = T[]
|
||||
shared_ptr<U> <a href="#functions">allocate_shared</a>(const A& allocator, size_t size);
|
||||
|
||||
template<typename T, typename... Args>
|
||||
shared_ptr<T[N]> <a href="#functions">make_shared</a>(Args&&... args);
|
||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
template<typename U, typename... Args> // U = T[]
|
||||
shared_ptr<U> <a href="#functions">make_shared</a>(size_t size, Args&&... args);
|
||||
|
||||
template<typename T, typename A, typename... Args>
|
||||
shared_ptr<T[]> <a href="#functions">allocate_shared</a>(const A& allocator, size_t size, Args&&... args);
|
||||
template<typename U, typename... Args> // U = T[N]
|
||||
shared_ptr<U> <a href="#functions">make_shared</a>(Args&&... args);
|
||||
|
||||
template<typename T, typename A, typename... Args>
|
||||
shared_ptr<T[N]> <a href="#functions">allocate_shared</a>(const A& allocator, Args&&... args);
|
||||
template<typename U, typename A, typename... Args> // U = T[]
|
||||
shared_ptr<U> <a href="#functions">allocate_shared</a>(const A& allocator, size_t size, Args&&... args);
|
||||
|
||||
template<typename U, typename A, typename... Args> // U = T[N]
|
||||
shared_ptr<U> <a href="#functions">allocate_shared</a>(const A& allocator, Args&&... args);
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX)
|
||||
template<typename T, typename... Args>
|
||||
shared_ptr<T[N]> <a href="#functions">make_shared</a>(const T (&list)[N]);
|
||||
|
||||
template<typename T, typename... Args>
|
||||
shared_ptr<T[][N]> <a href="#functions">make_shared</a>(size_t size, const T (&list)[N]);
|
||||
#if !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX)
|
||||
template<typename U, typename... Args> // U = T[N]
|
||||
shared_ptr<U> <a href="#functions">make_shared</a>(const T (&list)[N]);
|
||||
|
||||
template<typename T, typename... Args>
|
||||
shared_ptr<T[M][N]> <a href="#functions">make_shared</a>(const T (&list)[N]);
|
||||
template<typename U, typename... Args> // U = T[][N]
|
||||
shared_ptr<U> <a href="#functions">make_shared</a>(size_t size, const T (&list)[N]);
|
||||
|
||||
template<typename T, typename A, typename... Args>
|
||||
shared_ptr<T[N]> <a href="#functions">allocate_shared</a>(const A& allocator, const T (&list)[N]);
|
||||
template<typename U, typename... Args> // U = T[M][N]
|
||||
shared_ptr<U> <a href="#functions">make_shared</a>(const T (&list)[N]);
|
||||
|
||||
template<typename T, typename A, typename... Args>
|
||||
shared_ptr<T[][N]> <a href="#functions">allocate_shared</a>(const A& allocator, size_t size, const T (&list)[N]);
|
||||
template<typename U, typename A, typename... Args> // U = T[N]
|
||||
shared_ptr<T[> <a href="#functions">allocate_shared</a>(const A& allocator, const T (&list)[N]);
|
||||
|
||||
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]);
|
||||
template<typename U, typename A, typename... Args> // U = T[][N]
|
||||
shared_ptr<U> <a href="#functions">allocate_shared</a>(const A& allocator, size_t size, const T (&list)[N]);
|
||||
|
||||
template<typename U, typename A, typename... Args> // U = T[M][N]
|
||||
shared_ptr<U> <a href="#functions">allocate_shared</a>(const A& allocator, const T (&list)[N]);
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
template<typename T, typename... Args>
|
||||
shared_ptr<T[]> <a href="#functions">make_shared</a>(initializer_list<T> list);
|
||||
template<typename U, typename... Args> // U = T[]
|
||||
shared_ptr<U> <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);
|
||||
template<typename U, typename A, typename... Args> // U = T[]
|
||||
shared_ptr<U> <a href="#functions">allocate_shared</a>(const A& allocator, initializer_list<T> list);
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
template<typename T>
|
||||
shared_ptr<T[]> <a href="#functions">make_shared</a>(size_t size, T&& value);
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
template<typename U> // U = T[]
|
||||
shared_ptr<U> <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 U> // U = T[N]
|
||||
shared_ptr<U> <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 U, typename A> // U = T[]
|
||||
shared_ptr<U> <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);
|
||||
template<typename U, typename A> // U = T[N]
|
||||
shared_ptr<U> <a href="#functions">allocate_shared</a>(const A& allocator, T&& value);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
template<typename T>
|
||||
shared_ptr<T[]> <a href="#functions">make_shared_noinit</a>(size_t size);
|
||||
template<typename U> // U = T[]
|
||||
shared_ptr<U> <a href="#functions">make_shared_noinit</a>(size_t size);
|
||||
|
||||
template<typename T>
|
||||
shared_ptr<T[N]> <a href="#functions">make_shared_noinit</a>();
|
||||
|
||||
template<typename T, typename A>
|
||||
shared_ptr<T[]> <a href="#functions">allocate_shared_noinit</a>(const A& allocator, size_t size);
|
||||
template<typename U> // U = T[N]
|
||||
shared_ptr<U> <a href="#functions">make_shared_noinit</a>();
|
||||
|
||||
template<typename T, typename A>
|
||||
shared_ptr<T[N]> <a href="#functions">allocate_shared_noinit</a>(const A& allocator);
|
||||
template<typename U, typename A> // U = T[]
|
||||
shared_ptr<U> <a href="#functions">allocate_shared_noinit</a>(const A& allocator, size_t size);
|
||||
|
||||
template<typename U, typename A> // U = T[N]
|
||||
shared_ptr<U> <a href="#functions">allocate_shared_noinit</a>(const A& allocator);
|
||||
}</pre>
|
||||
<h2><a name="functions">Free Functions</a></h2>
|
||||
<pre>template<typename T, typename... 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);</pre>
|
||||
<pre>template<typename U, typename... Args>
|
||||
shared_ptr<U> make_shared(size_t size, Args&&... args);
|
||||
template<typename U, typename A, typename... Args>
|
||||
shared_ptr<U> allocate_shared(const A& allocator, size_t size, Args&&... args);</pre>
|
||||
<blockquote>
|
||||
<p><b>Requires:</b> The expression
|
||||
<code>new(pointer) T(forward<Args>(args)...)</code>, where
|
||||
@ -121,7 +121,7 @@ template<typename T, typename A, typename... Args>
|
||||
<code>T</code> and size <code>size</code> and constructs an array
|
||||
of objects in it via the placement new expression
|
||||
<code>new(pointer) T()</code> or
|
||||
<code>new(pointer) T(forward<Args>(args)...)</code>.
|
||||
<code>new(pointer) T(args...)</code>.
|
||||
<code>allocate_shared</code> uses a copy of
|
||||
<code>allocator</code> to allocate memory. If an exception is thrown,
|
||||
has no effect.</p>
|
||||
@ -146,74 +146,74 @@ template<typename T, typename A, typename... Args>
|
||||
take any constructor arguments. These overloads invoke the default
|
||||
constructor of <code>T</code> for each array element.</p>
|
||||
</blockquote>
|
||||
<pre>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);</pre>
|
||||
<pre>template<typename U, typename... Args>
|
||||
shared_ptr<U> make_shared(Args&&... args);
|
||||
template<typename U, typename A, typename... Args>
|
||||
shared_ptr<U> allocate_shared(const A& allocator, Args&&... args);</pre>
|
||||
<blockquote>
|
||||
<p><b>Description:</b> These overloads of the utilities above are for a
|
||||
fixed size array.</p>
|
||||
</blockquote>
|
||||
<pre>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);</pre>
|
||||
<pre>template<typename U, typename... Args>
|
||||
shared_ptr<U> make_shared(initializer_list<T> list);
|
||||
template<typename U, typename A, typename... Args>
|
||||
shared_ptr<U> allocate_shared(const A& allocator, initializer_list<T> list);</pre>
|
||||
<blockquote>
|
||||
<p><b>Description:</b> These overloads initialize the array elements
|
||||
from the initializer list.</p>
|
||||
</blockquote>
|
||||
<pre>template<typename T, typename... Args>
|
||||
shared_ptr<T[N]> make_shared(const T (&list)[N]);
|
||||
template<typename T, typename A, typename... Args>
|
||||
shared_ptr<T[N]> allocate_shared(const A& allocator, const T (&list)[N]);</pre>
|
||||
<pre>template<typename U, typename... Args>
|
||||
shared_ptr<U> make_shared(const T (&list)[N]);
|
||||
template<typename U, typename A, typename... Args>
|
||||
shared_ptr<U> 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, typename... Args>
|
||||
shared_ptr<T[][N]> make_shared(size_t size, const T (&list)[N]);
|
||||
template<typename T, typename A, typename... Args>
|
||||
shared_ptr<T[][N]> allocate_shared(const A& allocator, size_t size, const T (&list)[N]);</pre>
|
||||
<pre>template<typename U, typename... Args>
|
||||
shared_ptr<U> make_shared(size_t size, const T (&list)[N]);
|
||||
template<typename U, typename A, typename... Args>
|
||||
shared_ptr<U> allocate_shared(const A& allocator, size_t size, const T (&list)[N]);</pre>
|
||||
<blockquote>
|
||||
<p><b>Description:</b> These overloads initialize inner array elements
|
||||
from the initializer list.</p>
|
||||
</blockquote>
|
||||
<pre>template<typename T, 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>
|
||||
<pre>template<typename U, typename... Args> // U = T[M][N]
|
||||
shared_ptr<U> make_shared(const T (&list)[N]);
|
||||
template<typename U, typename A, typename... Args> // U = T[M][N]
|
||||
shared_ptr<U> 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>
|
||||
<pre>template<typename U>
|
||||
shared_ptr<U> make_shared(size_t size, T&& value);
|
||||
template<typename U, typename A>
|
||||
shared_ptr<U> 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>
|
||||
<pre>template<typename U>
|
||||
shared_ptr<U> make_shared(T&& value);
|
||||
template<typename U, typename A>
|
||||
shared_ptr<U> 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>
|
||||
</blockquote>
|
||||
<pre>template<typename T>
|
||||
shared_ptr<T[]> make_shared_noinit(size_t size);
|
||||
template<typename T, typename A>
|
||||
shared_ptr<T[]> allocate_shared_noinit(const A& allocator, size_t size);</pre>
|
||||
<pre>template<typename U>
|
||||
shared_ptr<U> make_shared_noinit(size_t size);
|
||||
template<typename U, typename A>
|
||||
shared_ptr<U> allocate_shared_noinit(const A& allocator, size_t size);</pre>
|
||||
<blockquote>
|
||||
<p><b>Description:</b> These overloads do not perform any value
|
||||
initialization of elements.</p>
|
||||
</blockquote>
|
||||
<pre>template<typename T>
|
||||
shared_ptr<T[N]> make_shared_noinit();
|
||||
template<typename T, typename A>
|
||||
shared_ptr<T[N]> allocate_shared_noinit(const A& allocator);</pre>
|
||||
<pre>template<typename U>
|
||||
shared_ptr<U> make_shared_noinit();
|
||||
template<typename U, typename A>
|
||||
shared_ptr<U> allocate_shared_noinit(const A& allocator);</pre>
|
||||
<blockquote>
|
||||
<p><b>Description:</b> These overloads of the utilities above are for a
|
||||
fixed size array.</p>
|
||||
@ -221,7 +221,7 @@ template<typename T, typename A>
|
||||
<h2><a name="example">Example</a></h2>
|
||||
<p>An example of each overload of make_shared for arrays:</p>
|
||||
<blockquote>
|
||||
<pre>boost::shared_ptr<point[]> a1 = boost::make_shared<point[]>(size);
|
||||
<pre>boost::shared_ptr<int[]> a1 = boost::make_shared<int[]>(size);
|
||||
boost::shared_ptr<point[]> a2 = boost::make_shared<point[]>(size, x, y);
|
||||
boost::shared_ptr<point[5]> a3 = boost::make_shared<point[5]>(x, y);
|
||||
boost::shared_ptr<int[]> a4 = boost::make_shared<int[]>({1, 2, 3});
|
||||
|
Reference in New Issue
Block a user