forked from boostorg/smart_ptr
Update unit tests for make_unique
This commit is contained in:
1 parent
324347b9ec
commit
650537da60
10 files changed
+270
-290
No files matched your search
+13
-15
@@ -21,10 +21,8 @@
|
||||
template<class U> // U is not array
|
||||
unique_ptr<U> <a href="#functions">make_unique</a>();
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
template<class U, class... Args> // U is not array
|
||||
unique_ptr<U> <a href="#functions">make_unique</a>(Args&&... args);
|
||||
#endif
|
||||
|
||||
template<class U> // U is not array
|
||||
unique_ptr<U> <a href="#functions">make_unique</a>(U&& value);
|
||||
@@ -40,9 +38,9 @@
|
||||
}</pre>
|
||||
<h2><a name="common">Common Requirements</a></h2>
|
||||
<pre>template<class U>
|
||||
unique_ptr<U> make_unique(<em>args</em>);
|
||||
template<class U>
|
||||
unique_ptr<U> make_unique_noinit(<em>args</em>);</pre>
|
||||
unique_ptr<U> make_unique(<em>args</em>);</pre>
|
||||
<pre>template<class U>
|
||||
unique_ptr<U> make_unique_noinit(<em>args</em>);</pre>
|
||||
<blockquote>
|
||||
<p><b>Effects:</b> Allocates memory for an object of type <code>U</code>
|
||||
(or <code>T[size]</code> when <code>U</code> is <code>T[]</code>,
|
||||
@@ -82,8 +80,8 @@ unique_ptr<U> make_unique(Args&&... args);</pre>
|
||||
resolution when <code>U</code> is not an array type.</p>
|
||||
<p><b>Examples:</b></p>
|
||||
<blockquote>
|
||||
<pre>unique_ptr<float> p1 = boost::make_unique<float>();
|
||||
unique_ptr<point> p2 = boost::make_unique<point>(x, y);</pre>
|
||||
<pre>unique_ptr<float> p1 = boost::make_unique<float>();</pre>
|
||||
<pre>unique_ptr<point> p2 = boost::make_unique<point>(x, y);</pre>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
<pre>template<class U>
|
||||
@@ -95,8 +93,8 @@ unique_ptr<U> make_unique(U&& value);</pre>
|
||||
resolution when <code>U</code> is not an array type.</p>
|
||||
<p><b>Examples:</b></p>
|
||||
<blockquote>
|
||||
<pre>unique_ptr<string> p1 = boost::make_unique<string>({'a', 'b'});
|
||||
unique_ptr<point> p2 = boost::make_unique<point>({-10, 25});</pre>
|
||||
<pre>unique_ptr<string> p1 = boost::make_unique<string>({'a', 'b'});</pre>
|
||||
<pre>unique_ptr<point> p2 = boost::make_unique<point>({-10, 25});</pre>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
<pre>template<class U>
|
||||
@@ -108,8 +106,8 @@ unique_ptr<U> make_unique(size_t size);</pre>
|
||||
resolution when <code>U</code> is of the form <code>T[]</code>.</p>
|
||||
<p><b>Examples:</b></p>
|
||||
<blockquote>
|
||||
<pre>unique_ptr<double[]> p1 = boost::make_unique<double[]>(4);
|
||||
unique_ptr<int[][2]> p2 = boost::make_unique<int[][2]>(2);</pre>
|
||||
<pre>unique_ptr<double[]> p1 = boost::make_unique<double[]>(4);</pre>
|
||||
<pre>unique_ptr<int[][2]> p2 = boost::make_unique<int[][2]>(2);</pre>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
<pre>template<class U>
|
||||
@@ -121,8 +119,8 @@ unique_ptr<U> make_unique_noinit();</pre>
|
||||
resolution when <code>U</code> is not an array type.</p>
|
||||
<p><b>Examples:</b></p>
|
||||
<blockquote>
|
||||
<pre>unique_ptr<float> p1 = boost::make_unique_noinit<float>();
|
||||
unique_ptr<point> p2 = boost::make_unique_noinit<point>();</pre>
|
||||
<pre>unique_ptr<float> p1 = boost::make_unique_noinit<float>();</pre>
|
||||
<pre>unique_ptr<point> p2 = boost::make_unique_noinit<point>();</pre>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
<pre>template<class U>
|
||||
@@ -134,8 +132,8 @@ unique_ptr<U> make_unique_noinit(size_t size);</pre>
|
||||
resolution when <code>U</code> is of the form <code>T[]</code>.</p>
|
||||
<p><b>Examples:</b></p>
|
||||
<blockquote>
|
||||
<pre>unique_ptr<double[]> p1 = boost::make_unique_noinit<double[]>(4);
|
||||
unique_ptr<int[][2]> p2 = boost::make_unique_noinit<int[][2]>(2);</pre>
|
||||
<pre>unique_ptr<double[]> p1 = boost::make_unique_noinit<double[]>(4);</pre>
|
||||
<pre>unique_ptr<int[][2]> p2 = boost::make_unique_noinit<int[][2]>(2);</pre>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
<h2><a name="history">History</a></h2>
|
||||
|
||||
Reference in new issue
Block a user