mirror of
https://github.com/boostorg/smart_ptr.git
synced 2025-07-31 21:24:40 +02:00
Merge branch 'develop'
This commit is contained in:
@@ -68,13 +68,13 @@
|
||||
}</pre>
|
||||
<h2><a name="common">Common Requirements</a></h2>
|
||||
<pre>template<class U>
|
||||
shared_ptr<U> make_shared(<em>args</em>);
|
||||
template<class U, class A>
|
||||
shared_ptr<U> allocate_shared(const A& allocator, <em>args</em>);
|
||||
template<class U>
|
||||
shared_ptr<U> make_shared_noinit(<em>args</em>);
|
||||
template<class U, class A>
|
||||
shared_ptr<U> allocate_shared_noinit(const A& allocator, <em>args</em>);</pre>
|
||||
shared_ptr<U> make_shared(<em>args</em>);</pre>
|
||||
<pre>template<class U, class A>
|
||||
shared_ptr<U> allocate_shared(const A& allocator, <em>args</em>);</pre>
|
||||
<pre>template<class U>
|
||||
shared_ptr<U> make_shared_noinit(<em>args</em>);</pre>
|
||||
<pre>template<class U, class A>
|
||||
shared_ptr<U> allocate_shared_noinit(const A& allocator, <em>args</em>);</pre>
|
||||
<blockquote>
|
||||
<p><b>Requires:</b> <code>U</code> is of the form <code>T[]</code> or
|
||||
<code>T[N]</code>. <code>A</code> shall be an <em>Allocator</em>, as
|
||||
@@ -158,9 +158,9 @@ template<class U, class A>
|
||||
</blockquote>
|
||||
<h2><a name="functions">Free Functions</a></h2>
|
||||
<pre>template<class U>
|
||||
shared_ptr<U> make_shared(size_t size);
|
||||
template<class U, class A>
|
||||
shared_ptr<U> allocate_shared(const A& allocator, size_t size);</pre>
|
||||
shared_ptr<U> make_shared(size_t size);</pre>
|
||||
<pre>template<class U, class A>
|
||||
shared_ptr<U> allocate_shared(const A& allocator, size_t size);</pre>
|
||||
<blockquote>
|
||||
<p><b>Returns:</b> A <code>shared_ptr</code> to a value-initialized
|
||||
object of type <code>T[size]</code>.</p>
|
||||
@@ -168,14 +168,14 @@ template<class U, class A>
|
||||
resolution when <code>U</code> is of the form <code>T[]</code>.</p>
|
||||
<p><b>Examples:</b></p>
|
||||
<blockquote>
|
||||
<pre>boost::shared_ptr<int[]> a1 = boost::make_shared<int[]>(size);
|
||||
boost::shared_ptr<int[][2]> a2 = boost::make_shared<int[][2]>(size);</pre>
|
||||
<pre>boost::shared_ptr<int[]> a1 = boost::make_shared<int[]>(size);</pre>
|
||||
<pre>boost::shared_ptr<int[][2]> a2 = boost::make_shared<int[][2]>(size);</pre>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
<pre>template<class U>
|
||||
shared_ptr<U> make_shared();
|
||||
template<class U, class A>
|
||||
shared_ptr<U> allocate_shared(const A& allocator);</pre>
|
||||
shared_ptr<U> make_shared();</pre>
|
||||
<pre>template<class U, class A>
|
||||
shared_ptr<U> allocate_shared(const A& allocator);</pre>
|
||||
<blockquote>
|
||||
<p><b>Returns:</b> A <code>shared_ptr</code> to a value-initialized
|
||||
object of type <code>T[N]</code>.</p>
|
||||
@@ -183,14 +183,14 @@ template<class U, class A>
|
||||
resolution when <code>U</code> is of the form <code>T[N]</code>.</p>
|
||||
<p><b>Examples:</b></p>
|
||||
<blockquote>
|
||||
<pre>boost::shared_ptr<int[8]> a1 = boost::make_shared<int[8]>();
|
||||
boost::shared_ptr<int[4][2]> a2 = boost::make_shared<int[4][2]>();</pre>
|
||||
<pre>boost::shared_ptr<int[8]> a1 = boost::make_shared<int[8]>();</pre>
|
||||
<pre>boost::shared_ptr<int[4][2]> a2 = boost::make_shared<int[4][2]>();</pre>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
<pre>template<class U>
|
||||
shared_ptr<U> make_shared(size_t size, const T& value);
|
||||
template<class U, class A>
|
||||
shared_ptr<U> allocate_shared(const A& allocator, size_t size, const T& value);</pre>
|
||||
shared_ptr<U> make_shared(size_t size, const T& value);</pre>
|
||||
<pre>template<class U, class A>
|
||||
shared_ptr<U> allocate_shared(const A& allocator, size_t size, const T& value);</pre>
|
||||
<blockquote>
|
||||
<p><b>Returns:</b> A <code>shared_ptr</code> to an object of type
|
||||
<code>T[size]</code>, where each array element of type <code>T</code>
|
||||
@@ -199,14 +199,14 @@ template<class U, class A>
|
||||
resolution when <code>U</code> is of the form <code>T[]</code>.</p>
|
||||
<p><b>Examples:</b></p>
|
||||
<blockquote>
|
||||
<pre>boost::shared_ptr<int[]> a1 = boost::make_shared<int[]>(size, 1);
|
||||
boost::shared_ptr<int[][2]> a2 = boost::make_shared<int[][2]>(size, {1, 2});</pre>
|
||||
<pre>boost::shared_ptr<int[]> a1 = boost::make_shared<int[]>(size, 1);</pre>
|
||||
<pre>boost::shared_ptr<int[][2]> a2 = boost::make_shared<int[][2]>(size, {1, 2});</pre>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
<pre>template<class U>
|
||||
shared_ptr<U> make_shared(const T& value);
|
||||
template<class U, class A>
|
||||
shared_ptr<U> allocate_shared(const A& allocator, const T& value);</pre>
|
||||
shared_ptr<U> make_shared(const T& value);</pre>
|
||||
<pre>template<class U, class A>
|
||||
shared_ptr<U> allocate_shared(const A& allocator, const T& value);</pre>
|
||||
<blockquote>
|
||||
<p><b>Returns:</b> A <code>shared_ptr</code> to an object of type
|
||||
<code>T[N]</code>, where each array element of type <code>T</code> is
|
||||
@@ -215,14 +215,14 @@ template<class U, class A>
|
||||
resolution when <code>U</code> is of the form <code>T[N]</code>.</p>
|
||||
<p><b>Examples:</b></p>
|
||||
<blockquote>
|
||||
<pre>boost::shared_ptr<int[8]> a1 = boost::make_shared<int[8]>(1);
|
||||
boost::shared_ptr<int[4][2]> a2 = boost::make_shared<int[4][2]>({1, 2});</pre>
|
||||
<pre>boost::shared_ptr<int[8]> a1 = boost::make_shared<int[8]>(1);</pre>
|
||||
<pre>boost::shared_ptr<int[4][2]> a2 = boost::make_shared<int[4][2]>({1, 2});</pre>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
<pre>template<class U>
|
||||
shared_ptr<U> make_shared_noinit(size_t size);
|
||||
template<class U, class A>
|
||||
shared_ptr<U> allocate_shared_noinit(const A& allocator, size_t size);</pre>
|
||||
shared_ptr<U> make_shared_noinit(size_t size);</pre>
|
||||
<pre>template<class U, class A>
|
||||
shared_ptr<U> allocate_shared_noinit(const A& allocator, size_t size);</pre>
|
||||
<blockquote>
|
||||
<p><b>Returns:</b> A <code>shared_ptr</code> to a default-initialized
|
||||
object of type <code>T[size]</code>.</p>
|
||||
@@ -230,14 +230,14 @@ template<class U, class A>
|
||||
resolution when <code>U</code> is of the form <code>T[]</code>.</p>
|
||||
<p><b>Examples:</b></p>
|
||||
<blockquote>
|
||||
<pre>boost::shared_ptr<int[]> a1 = boost::make_shared_noinit<int[]>(size);
|
||||
boost::shared_ptr<int[][2]> a2 = boost::make_shared_noinit<int[][2]>(size);</pre>
|
||||
<pre>boost::shared_ptr<int[]> a1 = boost::make_shared_noinit<int[]>(size);</pre>
|
||||
<pre>boost::shared_ptr<int[][2]> a2 = boost::make_shared_noinit<int[][2]>(size);</pre>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
<pre>template<class U>
|
||||
shared_ptr<U> make_shared_noinit();
|
||||
template<class U, class A>
|
||||
shared_ptr<U> allocate_shared_noinit(const A& allocator);</pre>
|
||||
shared_ptr<U> make_shared_noinit();</pre>
|
||||
<pre>template<class U, class A>
|
||||
shared_ptr<U> allocate_shared_noinit(const A& allocator);</pre>
|
||||
<blockquote>
|
||||
<p><b>Returns:</b> A <code>shared_ptr</code> to a default-initialized
|
||||
object of type <code>T[N]</code>.</p>
|
||||
@@ -245,16 +245,17 @@ template<class U, class A>
|
||||
resolution when <code>U</code> is of the form <code>T[N]</code>.</p>
|
||||
<p><b>Examples:</b></p>
|
||||
<blockquote>
|
||||
<pre>boost::shared_ptr<int[8]> a1 = boost::make_shared_noinit<int[8]>();
|
||||
boost::shared_ptr<int[4][2]> a2 = boost::make_shared_noinit<int[4][2]>();</pre>
|
||||
<pre>boost::shared_ptr<int[8]> a1 = boost::make_shared_noinit<int[8]>();</pre>
|
||||
<pre>boost::shared_ptr<int[4][2]> a2 = boost::make_shared_noinit<int[4][2]>();</pre>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
<h2><a name="history">History</a></h2>
|
||||
<p>February 2017. Glen Fernandes rewrote allocate_shared and make_shared
|
||||
for a more optimal and more maintainable implementation.</p>
|
||||
<p>February 2014. Glen Fernandes updated overloads of make_shared and
|
||||
allocate_shared to conform to the specification in C++ standard paper
|
||||
<a href="#N3870">N3870</a>, including resolving C++ standard library
|
||||
defect report 2070, and reduced the spatial overhead of the internal
|
||||
bookkeeping structures.</p>
|
||||
defect report <a href="#2070">DR2070</a>.</p>
|
||||
<p>November 2012. Glen Fernandes contributed implementations of
|
||||
make_shared and allocate_shared for arrays.</p>
|
||||
<h2><a name="references">References</a></h2>
|
||||
@@ -262,6 +263,10 @@ boost::shared_ptr<int[4][2]> a2 = boost::make_shared_noinit<int[4][2]&g
|
||||
<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3870.html">
|
||||
Extending make_shared to Support Arrays, Revision 1</a>, Peter Dimov
|
||||
& Glen Fernandes, January, 2014.</p>
|
||||
<p><a name="DR2070">DR2070</a>,
|
||||
<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html">
|
||||
allocate_shared should use allocator_traits<A>::construct</a>,
|
||||
Jonathan Wakely, July, 2011.</p>
|
||||
<hr>
|
||||
<p>$Date$</p>
|
||||
<p><small>Copyright 2012-2014 Glen Fernandes. Distributed under the
|
||||
|
@@ -136,6 +136,9 @@
|
||||
<p>Functions which destroy objects of the pointed to type are prohibited from
|
||||
throwing exceptions by the <a href="#common_requirements">common requirements</a>.</p>
|
||||
<h2><a name="History">History</a> and Acknowledgements</h2>
|
||||
<p>February 2017. Glen Fernandes rewrote <b>allocate_shared</b>
|
||||
and <b>make_shared</b> for arrays for a more optimal and more
|
||||
maintainable implementation.</p>
|
||||
<p>February 2014. Glen Fernandes updated overloads of <b>make_shared</b> and
|
||||
<b>allocate_shared</b> to conform to the specification in C++ standard paper
|
||||
<a href="#D&F-14">[D&F-14]</a>, and implemented <b>make_unique</b> for
|
||||
|
Reference in New Issue
Block a user