forked from boostorg/smart_ptr
Add examples back to documentation
This commit is contained in:
@ -1,10 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
(c) 2014 Glen Joseph Fernandes
|
Copyright 2014 Glen Joseph Fernandes
|
||||||
<glenjofe -at- gmail.com>
|
(glenjofe@gmail.com)
|
||||||
|
|
||||||
Distributed under the Boost Software
|
Distributed under the Boost Software License, Version 1.0.
|
||||||
License, Version 1.0.
|
(http://www.boost.org/LICENSE_1_0.txt)
|
||||||
http://boost.org/LICENSE_1_0.txt
|
|
||||||
*/
|
*/
|
||||||
#ifndef BOOST_MAKE_UNIQUE_HPP_INCLUDED
|
#ifndef BOOST_MAKE_UNIQUE_HPP_INCLUDED
|
||||||
#define BOOST_MAKE_UNIQUE_HPP_INCLUDED
|
#define BOOST_MAKE_UNIQUE_HPP_INCLUDED
|
||||||
|
@ -105,8 +105,7 @@ const <em>E</em>& v);</code>
|
|||||||
<div id="requirements">
|
<div id="requirements">
|
||||||
<h2>Common Requirements</h2>
|
<h2>Common Requirements</h2>
|
||||||
<h3><code>template<class T, class A><br>shared_ptr<T>
|
<h3><code>template<class T, class A><br>shared_ptr<T>
|
||||||
<a href="#functions">allocate_shared</a>(const A& a,
|
allocate_shared(const A& a, <em>args</em>);</code></h3>
|
||||||
<em>args</em>);</code></h3>
|
|
||||||
<dl>
|
<dl>
|
||||||
<dt><strong>Requires:</strong></dt>
|
<dt><strong>Requires:</strong></dt>
|
||||||
<dd><code>T</code> is of the form <code>E[N]</code> or
|
<dd><code>T</code> is of the form <code>E[N]</code> or
|
||||||
@ -190,6 +189,9 @@ allocate_shared(const A& a, std::size_t n);</code></h3>
|
|||||||
<dt><strong>Remarks:</strong></dt>
|
<dt><strong>Remarks:</strong></dt>
|
||||||
<dd>This overload shall only participate in overload resolution when
|
<dd>This overload shall only participate in overload resolution when
|
||||||
<code>T</code> is of the form <code>E[]</code>.</dd>
|
<code>T</code> is of the form <code>E[]</code>.</dd>
|
||||||
|
<dt><strong>Example:</strong></dt>
|
||||||
|
<dd><code>boost::allocate_shared<int[]<!--
|
||||||
|
-->>(std::allocator<int>(), 8);</code></dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@ -202,6 +204,9 @@ allocate_shared(const A& a);</code></h3>
|
|||||||
<dt><strong>Remarks:</strong></dt>
|
<dt><strong>Remarks:</strong></dt>
|
||||||
<dd>This overload shall only participate in overload resolution when
|
<dd>This overload shall only participate in overload resolution when
|
||||||
<code>T</code> is of the form <code>E[N]</code>.</dd>
|
<code>T</code> is of the form <code>E[N]</code>.</dd>
|
||||||
|
<dt><strong>Example:</strong></dt>
|
||||||
|
<dd><code>boost::allocate_shared<int[8]<!--
|
||||||
|
-->>(std::allocator<int>());</code></dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@ -216,6 +221,9 @@ initialized to <code>v</code>.</dd>
|
|||||||
<dt><strong>Remarks:</strong></dt>
|
<dt><strong>Remarks:</strong></dt>
|
||||||
<dd>This overload shall only participate in overload resolution when
|
<dd>This overload shall only participate in overload resolution when
|
||||||
<code>T</code> is of the form <code>E[]</code>.</dd>
|
<code>T</code> is of the form <code>E[]</code>.</dd>
|
||||||
|
<dt><strong>Example:</strong></dt>
|
||||||
|
<dd><code>boost::allocate_shared<double[]<!--
|
||||||
|
-->>(std::allocator<double>(), 8, 1.0);</code></dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@ -229,6 +237,9 @@ where each array element of type <code>E</code> is initialized to
|
|||||||
<dt><strong>Remarks:</strong></dt>
|
<dt><strong>Remarks:</strong></dt>
|
||||||
<dd>This overload shall only participate in overload resolution when
|
<dd>This overload shall only participate in overload resolution when
|
||||||
<code>T</code> is of the form <code>E[N]</code>.</dd>
|
<code>T</code> is of the form <code>E[N]</code>.</dd>
|
||||||
|
<dt><strong>Example:</strong></dt>
|
||||||
|
<dd><code>boost::allocate_shared<double[8]<!--
|
||||||
|
-->>(std::allocator<double>(), 1.0);</code></dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@ -241,6 +252,9 @@ allocate_shared_noinit(const A& a, std::size_t n);</code></h3>
|
|||||||
<dt><strong>Remarks:</strong></dt>
|
<dt><strong>Remarks:</strong></dt>
|
||||||
<dd>This overload shall only participate in overload resolution when
|
<dd>This overload shall only participate in overload resolution when
|
||||||
<code>T</code> is of the form <code>E[]</code>.</dd>
|
<code>T</code> is of the form <code>E[]</code>.</dd>
|
||||||
|
<dt><strong>Example:</strong></dt>
|
||||||
|
<dd><code>boost::allocate_shared_noinit<int[]<!--
|
||||||
|
-->>(std::allocator<int>(), 8);</code></dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@ -253,6 +267,9 @@ allocate_shared_noinit(const A& a);</code></h3>
|
|||||||
<dt><strong>Remarks:</strong></dt>
|
<dt><strong>Remarks:</strong></dt>
|
||||||
<dd>This overload shall only participate in overload resolution when
|
<dd>This overload shall only participate in overload resolution when
|
||||||
<code>T</code> is of the form <code>E[N]</code>.</dd>
|
<code>T</code> is of the form <code>E[N]</code>.</dd>
|
||||||
|
<dt><strong>Example:</strong></dt>
|
||||||
|
<dd><code>boost::allocate_shared_noinit<int[8]<!--
|
||||||
|
-->>(std::allocator<int>());</code></dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@ -265,6 +282,8 @@ make_shared(std::size_t n);</code></h3>
|
|||||||
<dt><strong>Remarks:</strong></dt>
|
<dt><strong>Remarks:</strong></dt>
|
||||||
<dd>This overload shall only participate in overload resolution when
|
<dd>This overload shall only participate in overload resolution when
|
||||||
<code>T</code> is of the form <code>E[]</code>.</dd>
|
<code>T</code> is of the form <code>E[]</code>.</dd>
|
||||||
|
<dt><strong>Example:</strong></dt>
|
||||||
|
<dd><code>boost::make_shared<int[]>(8);</code></dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@ -277,6 +296,8 @@ make_shared();</code></h3>
|
|||||||
<dt><strong>Remarks:</strong></dt>
|
<dt><strong>Remarks:</strong></dt>
|
||||||
<dd>This overload shall only participate in overload resolution when
|
<dd>This overload shall only participate in overload resolution when
|
||||||
<code>T</code> is of the form <code>E[N]</code>.</dd>
|
<code>T</code> is of the form <code>E[N]</code>.</dd>
|
||||||
|
<dt><strong>Example:</strong></dt>
|
||||||
|
<dd><code>boost::make_shared<int[8]>();</code></dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@ -289,6 +310,8 @@ make_shared(std::size_t n, const <em>E</em>& v);</code></h3>
|
|||||||
<dt><strong>Remarks:</strong></dt>
|
<dt><strong>Remarks:</strong></dt>
|
||||||
<dd>This overload shall only participate in overload resolution when
|
<dd>This overload shall only participate in overload resolution when
|
||||||
<code>T</code> is of the form <code>E[]</code>.</dd>
|
<code>T</code> is of the form <code>E[]</code>.</dd>
|
||||||
|
<dt><strong>Example:</strong></dt>
|
||||||
|
<dd><code>boost::make_shared<double[]>(8, 1.0);</code></dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@ -301,7 +324,8 @@ make_shared(const <em>E</em>& v);</code></h3>
|
|||||||
<dt><strong>Remarks:</strong></dt>
|
<dt><strong>Remarks:</strong></dt>
|
||||||
<dd>This overload shall only participate in overload resolution when
|
<dd>This overload shall only participate in overload resolution when
|
||||||
<code>T</code> is of the form <code>E[N].</code></dd>
|
<code>T</code> is of the form <code>E[N].</code></dd>
|
||||||
</dl>
|
<dt><strong>Example:</strong></dt>
|
||||||
|
<dd><code>boost::make_shared<double[8]>(1.0);</code></dd></dl>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<h3><code>template<class T><br>shared_ptr<T>
|
<h3><code>template<class T><br>shared_ptr<T>
|
||||||
@ -313,6 +337,8 @@ make_shared_noinit(std::size_t n);</code></h3>
|
|||||||
<dt><strong>Remarks:</strong></dt>
|
<dt><strong>Remarks:</strong></dt>
|
||||||
<dd>This overload shall only participate in overload resolution when
|
<dd>This overload shall only participate in overload resolution when
|
||||||
<code>T</code> is of the form <code>E[]</code>.</dd>
|
<code>T</code> is of the form <code>E[]</code>.</dd>
|
||||||
|
<dt><strong>Example:</strong></dt>
|
||||||
|
<dd><code>boost::make_shared_noinit<int[]>(8);</code></dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@ -325,6 +351,8 @@ make_shared_noinit();</code></h3>
|
|||||||
<dt><strong>Remarks:</strong></dt>
|
<dt><strong>Remarks:</strong></dt>
|
||||||
<dd>This overload shall only participate in overload resolution when
|
<dd>This overload shall only participate in overload resolution when
|
||||||
<code>T</code> is of the form <code>E[N]</code>.</dd>
|
<code>T</code> is of the form <code>E[N]</code>.</dd>
|
||||||
|
<dt><strong>Example:</strong></dt>
|
||||||
|
<dd><code>boost::make_shared_noinit<int[8]>();</code></dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -58,8 +58,7 @@ function template <code>make_unique</code> for convenient creation of
|
|||||||
<div id="requirements">
|
<div id="requirements">
|
||||||
<h2>Common Requirements</h2>
|
<h2>Common Requirements</h2>
|
||||||
<h3><code>template<class T, <em>Args</em>><br>
|
<h3><code>template<class T, <em>Args</em>><br>
|
||||||
std::unique_ptr<T>
|
std::unique_ptr<T> make_unique(<em>args</em>);</code></h3>
|
||||||
<a href="#functions">make_unique</a>(<em>args</em>);</code></h3>
|
|
||||||
<dl>
|
<dl>
|
||||||
<dt><strong>Effects:</strong></dt>
|
<dt><strong>Effects:</strong></dt>
|
||||||
<dd>Allocates storage for an object of type <code>T</code> (or
|
<dd>Allocates storage for an object of type <code>T</code> (or
|
||||||
@ -109,6 +108,8 @@ initialized to <code>std::forward<Args>(args)...</code>.</dd>
|
|||||||
<dt><strong>Remarks:</strong></dt>
|
<dt><strong>Remarks:</strong></dt>
|
||||||
<dd>This overload shall only participate in overload resolution when
|
<dd>This overload shall only participate in overload resolution when
|
||||||
<code>T</code> is not an array type.</dd>
|
<code>T</code> is not an array type.</dd>
|
||||||
|
<dt><strong>Example:</strong></dt>
|
||||||
|
<dd><code>boost::make_unique<double>(1.0);</code></dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@ -121,7 +122,8 @@ initialized to <code>std::move(value)</code>.</dd>
|
|||||||
<dt><strong>Remarks:</strong></dt>
|
<dt><strong>Remarks:</strong></dt>
|
||||||
<dd>This overload shall only participate in overload resolution when
|
<dd>This overload shall only participate in overload resolution when
|
||||||
<code>T</code> is not an array type.</dd>
|
<code>T</code> is not an array type.</dd>
|
||||||
</dl>
|
<dt><strong>Example:</strong></dt>
|
||||||
|
<dd><code>boost::make_unique<point>({1.0, -1.0});</code></dd></dl>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<h3><code>template<class T><br>std::unique_ptr<T>
|
<h3><code>template<class T><br>std::unique_ptr<T>
|
||||||
@ -133,6 +135,8 @@ make_unique(std::size_t size);</code></h3>
|
|||||||
<dt><strong>Remarks:</strong></dt>
|
<dt><strong>Remarks:</strong></dt>
|
||||||
<dd>This overload shall only participate in overload resolution when
|
<dd>This overload shall only participate in overload resolution when
|
||||||
<code>T</code> is of the form <code>E[]</code>.</dd>
|
<code>T</code> is of the form <code>E[]</code>.</dd>
|
||||||
|
<dt><strong>Example:</strong></dt>
|
||||||
|
<dd><code>boost::make_unique<int[]>(8);</code></dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@ -145,6 +149,8 @@ type <code>T</code>.</dd>
|
|||||||
<dt><strong>Remarks:</strong></dt>
|
<dt><strong>Remarks:</strong></dt>
|
||||||
<dd>This overload shall only participate in overload resolution when
|
<dd>This overload shall only participate in overload resolution when
|
||||||
<code>T</code> is not an array type.</dd>
|
<code>T</code> is not an array type.</dd>
|
||||||
|
<dt><strong>Example:</strong></dt>
|
||||||
|
<dd><code>boost::make_unique_noinit<std::tm>();</code></dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@ -157,6 +163,8 @@ type <code>E[size]</code>.</dd>
|
|||||||
<dt><strong>Remarks:</strong></dt>
|
<dt><strong>Remarks:</strong></dt>
|
||||||
<dd>This overload shall only participate in overload resolution when
|
<dd>This overload shall only participate in overload resolution when
|
||||||
<code>T</code> is of the form <code>E[]</code>.</dd>
|
<code>T</code> is of the form <code>E[]</code>.</dd>
|
||||||
|
<dt><strong>Example:</strong></dt>
|
||||||
|
<dd><code>boost::make_unique_noinit<char[]>(64);</code></dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user