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