Compare commits

..

1 Commits

Author SHA1 Message Date
Marshall Clow
41a7957c23 Release 1.53.0
[SVN r82734]
2013-02-04 18:11:49 +00:00
8 changed files with 120 additions and 142 deletions

View File

@@ -33,10 +33,10 @@ namespace boost {
struct rebind {
typedef allocate_array_helper<A, T[], U> other;
};
allocate_array_helper(const A& allocator_, std::size_t size_, T** data_)
: allocator(allocator_),
size(sizeof(T) * size_),
data(data_) {
allocate_array_helper(const A& allocator, std::size_t size, T** data)
: allocator(allocator),
size(sizeof(T) * size),
data(data) {
}
template<class U>
allocate_array_helper(const allocate_array_helper<A, T[], U>& other)
@@ -107,9 +107,9 @@ namespace boost {
struct rebind {
typedef allocate_array_helper<A, T[N], U> other;
};
allocate_array_helper(const A& allocator_, T** data_)
: allocator(allocator_),
data(data_) {
allocate_array_helper(const A& allocator, T** data)
: allocator(allocator),
data(data) {
}
template<class U>
allocate_array_helper(const allocate_array_helper<A, T[N], U>& other)

View File

@@ -19,8 +19,8 @@ namespace boost {
template<typename T>
class array_deleter<T[]> {
public:
array_deleter(std::size_t size_)
: size(size_),
array_deleter(std::size_t size)
: size(size),
object(0) {
}
~array_deleter() {

View File

@@ -31,9 +31,9 @@ namespace boost {
struct rebind {
typedef make_array_helper<T[], U> other;
};
make_array_helper(std::size_t size_, T** data_)
: size(sizeof(T) * size_),
data(data_) {
make_array_helper(std::size_t size, T** data)
: size(sizeof(T) * size),
data(data) {
}
template<class U>
make_array_helper(const make_array_helper<T[], U>& other)
@@ -72,7 +72,7 @@ namespace boost {
memory->~Y();
}
template<typename U>
bool operator==(const make_array_helper<T[], U>&) const {
bool operator==(const make_array_helper<T[], U>& other) const {
return true;
}
template<typename U>
@@ -99,8 +99,8 @@ namespace boost {
struct rebind {
typedef make_array_helper<T[N], U> other;
};
make_array_helper(T** data_)
: data(data_) {
make_array_helper(T** data)
: data(data) {
}
template<class U>
make_array_helper(const make_array_helper<T[N], U>& other)
@@ -138,7 +138,7 @@ namespace boost {
memory->~Y();
}
template<typename U>
bool operator==(const make_array_helper<T[N], U>&) const {
bool operator==(const make_array_helper<T[N], U>& other) const {
return true;
}
template<typename U>

View File

@@ -200,7 +200,7 @@ public:
}
catch( ... )
{
D::operator_fn( p ); // delete p
D()( p ); // delete p
throw;
}
@@ -210,7 +210,7 @@ public:
if( pi_ == 0 )
{
D::operator_fn( p ); // delete p
D()( p ); // delete p
boost::throw_exception( std::bad_alloc() );
}
@@ -286,7 +286,7 @@ public:
}
catch(...)
{
D::operator_fn( p );
D()( p );
if( pi_ != 0 )
{
@@ -306,7 +306,7 @@ public:
}
else
{
D::operator_fn( p );
D()( p );
boost::throw_exception( std::bad_alloc() );
}

View File

@@ -87,10 +87,6 @@ public:
destroy();
}
static void operator_fn( T* ) // operator() can't be static
{
}
void * address() BOOST_NOEXCEPT
{
return storage_.data_;

View File

@@ -485,7 +485,7 @@ public:
#endif // BOOST_NO_AUTO_PTR
#if !defined( BOOST_NO_CXX11_SMART_PTR ) && !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
#if !defined( BOOST_NO_CXX11_SMART_PTR )
template< class Y, class D >
shared_ptr( std::unique_ptr< Y, D > && r ): px( r.get() ), pn()
@@ -550,7 +550,7 @@ public:
#endif // BOOST_NO_AUTO_PTR
#if !defined( BOOST_NO_CXX11_SMART_PTR ) && !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
#if !defined( BOOST_NO_CXX11_SMART_PTR )
template<class Y, class D>
shared_ptr & operator=( std::unique_ptr<Y, D> && r )

View File

@@ -29,86 +29,85 @@
allowing finer control.</p>
<h2><a name="Synopsis">Synopsis</a></h2>
<pre>namespace boost {
template&lt;typename U&gt; // U = T[]
shared_ptr&lt;U&gt; <a href="#functions">make_shared</a>(size_t size);
template&lt;typename T&gt;
shared_ptr&lt;T[]&gt; <a href="#functions">make_shared</a>(size_t size);
template&lt;typename U, typename A&gt; // U = T[]
shared_ptr&lt;U&gt; <a href="#functions">allocate_shared</a>(const A&amp; allocator, size_t size);
template&lt;typename T, typename A&gt;
shared_ptr&lt;T[]&gt; <a href="#functions">allocate_shared</a>(const A&amp; allocator, size_t size);
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) &amp;&amp; !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
template&lt;typename T, typename... Args&gt;
shared_ptr&lt;T[]&gt; <a href="#functions">make_shared</a>(size_t size, Args&amp;&amp;... args);
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) &amp;&amp; !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
template&lt;typename U, typename... Args&gt; // U = T[]
shared_ptr&lt;U&gt; <a href="#functions">make_shared</a>(size_t size, Args&amp;&amp;... args);
template&lt;typename T, typename... Args&gt;
shared_ptr&lt;T[N]&gt; <a href="#functions">make_shared</a>(Args&amp;&amp;... args);
template&lt;typename U, typename... Args&gt; // U = T[N]
shared_ptr&lt;U&gt; <a href="#functions">make_shared</a>(Args&amp;&amp;... args);
template&lt;typename T, typename A, typename... Args&gt;
shared_ptr&lt;T[]&gt; <a href="#functions">allocate_shared</a>(const A&amp; allocator, size_t size, Args&amp;&amp;... args);
template&lt;typename U, typename A, typename... Args&gt; // U = T[]
shared_ptr&lt;U&gt; <a href="#functions">allocate_shared</a>(const A&amp; allocator, size_t size, Args&amp;&amp;... args);
template&lt;typename U, typename A, typename... Args&gt; // U = T[N]
shared_ptr&lt;U&gt; <a href="#functions">allocate_shared</a>(const A&amp; allocator, Args&amp;&amp;... args);
template&lt;typename T, typename A, typename... Args&gt;
shared_ptr&lt;T[N]&gt; <a href="#functions">allocate_shared</a>(const A&amp; allocator, Args&amp;&amp;... args);
#endif
#if !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX)
template&lt;typename T, typename... Args&gt;
shared_ptr&lt;T[N]&gt; <a href="#functions">make_shared</a>(const T (&amp;list)[N]);
#if !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX)
template&lt;typename U, typename... Args&gt; // U = T[N]
shared_ptr&lt;U&gt; <a href="#functions">make_shared</a>(const T (&amp;list)[N]);
template&lt;typename T, typename... Args&gt;
shared_ptr&lt;T[][N]&gt; <a href="#functions">make_shared</a>(size_t size, const T (&amp;list)[N]);
template&lt;typename U, typename... Args&gt; // U = T[][N]
shared_ptr&lt;U&gt; <a href="#functions">make_shared</a>(size_t size, const T (&amp;list)[N]);
template&lt;typename T, typename... Args&gt;
shared_ptr&lt;T[M][N]&gt; <a href="#functions">make_shared</a>(const T (&amp;list)[N]);
template&lt;typename U, typename... Args&gt; // U = T[M][N]
shared_ptr&lt;U&gt; <a href="#functions">make_shared</a>(const T (&amp;list)[N]);
template&lt;typename T, typename A, typename... Args&gt;
shared_ptr&lt;T[N]&gt; <a href="#functions">allocate_shared</a>(const A&amp; allocator, const T (&amp;list)[N]);
template&lt;typename U, typename A, typename... Args&gt; // U = T[N]
shared_ptr&lt;T[&gt; <a href="#functions">allocate_shared</a>(const A&amp; allocator, const T (&amp;list)[N]);
template&lt;typename T, typename A, typename... Args&gt;
shared_ptr&lt;T[][N]&gt; <a href="#functions">allocate_shared</a>(const A&amp; allocator, size_t size, const T (&amp;list)[N]);
template&lt;typename U, typename A, typename... Args&gt; // U = T[][N]
shared_ptr&lt;U&gt; <a href="#functions">allocate_shared</a>(const A&amp; allocator, size_t size, const T (&amp;list)[N]);
template&lt;typename U, typename A, typename... Args&gt; // U = T[M][N]
shared_ptr&lt;U&gt; <a href="#functions">allocate_shared</a>(const A&amp; allocator, const T (&amp;list)[N]);
template&lt;typename T, typename A, typename... Args&gt;
shared_ptr&lt;T[M][N]&gt; <a href="#functions">allocate_shared</a>(const A&amp; allocator, const T (&amp;list)[N]);
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
template&lt;typename U, typename... Args&gt; // U = T[]
shared_ptr&lt;U&gt; <a href="#functions">make_shared</a>(initializer_list&lt;T&gt; list);
template&lt;typename T, typename... Args&gt;
shared_ptr&lt;T[]&gt; <a href="#functions">make_shared</a>(initializer_list&lt;T&gt; list);
template&lt;typename U, typename A, typename... Args&gt; // U = T[]
shared_ptr&lt;U&gt; <a href="#functions">allocate_shared</a>(const A&amp; allocator, initializer_list&lt;T&gt; list);
template&lt;typename T, typename A, typename... Args&gt;
shared_ptr&lt;T[]&gt; <a href="#functions">allocate_shared</a>(const A&amp; allocator, initializer_list&lt;T&gt; list);
#endif
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
template&lt;typename U&gt; // U = T[]
shared_ptr&lt;U&gt; <a href="#functions">make_shared</a>(size_t size, T&amp;&amp; value);
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
template&lt;typename T&gt;
shared_ptr&lt;T[]&gt; <a href="#functions">make_shared</a>(size_t size, T&amp;&amp; value);
template&lt;typename U&gt; // U = T[N]
shared_ptr&lt;U&gt; <a href="#functions">make_shared</a>(T&amp;&amp; value);
template&lt;typename T&gt;
shared_ptr&lt;T[N]&gt; <a href="#functions">make_shared</a>(T&amp;&amp; value);
template&lt;typename U, typename A&gt; // U = T[]
shared_ptr&lt;U&gt; <a href="#functions">allocate_shared</a>(const A&amp; allocator, size_t size, T&amp;&amp; value);
template&lt;typename T, typename A&gt;
shared_ptr&lt;T[]&gt; <a href="#functions">allocate_shared</a>(const A&amp; allocator, size_t size, T&amp;&amp; value);
template&lt;typename U, typename A&gt; // U = T[N]
shared_ptr&lt;U&gt; <a href="#functions">allocate_shared</a>(const A&amp; allocator, T&amp;&amp; value);
template&lt;typename T, typename A&gt;
shared_ptr&lt;T[N]&gt; <a href="#functions">allocate_shared</a>(const A&amp; allocator, T&amp;&amp; value);
#endif
#endif
template&lt;typename U&gt; // U = T[]
shared_ptr&lt;U&gt; <a href="#functions">make_shared_noinit</a>(size_t size);
template&lt;typename T&gt;
shared_ptr&lt;T[]&gt; <a href="#functions">make_shared_noinit</a>(size_t size);
template&lt;typename U&gt; // U = T[N]
shared_ptr&lt;U&gt; <a href="#functions">make_shared_noinit</a>();
template&lt;typename T&gt;
shared_ptr&lt;T[N]&gt; <a href="#functions">make_shared_noinit</a>();
template&lt;typename T, typename A&gt;
shared_ptr&lt;T[]&gt; <a href="#functions">allocate_shared_noinit</a>(const A&amp; allocator, size_t size);
template&lt;typename U, typename A&gt; // U = T[]
shared_ptr&lt;U&gt; <a href="#functions">allocate_shared_noinit</a>(const A&amp; allocator, size_t size);
template&lt;typename U, typename A&gt; // U = T[N]
shared_ptr&lt;U&gt; <a href="#functions">allocate_shared_noinit</a>(const A&amp; allocator);
template&lt;typename T, typename A&gt;
shared_ptr&lt;T[N]&gt; <a href="#functions">allocate_shared_noinit</a>(const A&amp; allocator);
}</pre>
<h2><a name="functions">Free Functions</a></h2>
<pre>template&lt;typename U, typename... Args&gt; // U = T[]
shared_ptr&lt;U&gt; make_shared(size_t size, Args&amp;&amp;... args);
template&lt;typename U, typename A, typename... Args&gt; // U = T[]
shared_ptr&lt;U&gt; allocate_shared(const A&amp; allocator, size_t size, Args&amp;&amp;... args);</pre>
<pre>template&lt;typename T, typename... Args&gt;
shared_ptr&lt;T[]&gt; make_shared(size_t size, Args&amp;&amp;... args);
template&lt;typename T, typename A, typename... Args&gt;
shared_ptr&lt;T[]&gt; allocate_shared(const A&amp; allocator, size_t size, Args&amp;&amp;... args);</pre>
<blockquote>
<p><b>Requires:</b> The expression
<code>new(pointer) T(forward&lt;Args&gt;(args)...)</code>, where
@@ -122,7 +121,7 @@ shared_ptr&lt;U&gt; allocate_shared(const A&amp; allocator, size_t size, Args&am
<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(args...)</code>.
<code>new(pointer) T(forward&lt;Args&gt;(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>
@@ -147,83 +146,74 @@ shared_ptr&lt;U&gt; allocate_shared(const A&amp; allocator, size_t size, Args&am
take any constructor arguments. These overloads invoke the default
constructor of <code>T</code> for each array element.</p>
</blockquote>
<pre>template&lt;typename U, typename... Args&gt; // U = T[N]
shared_ptr&lt;U&gt; make_shared(Args&amp;&amp;... args);
template&lt;typename U, typename A, typename... Args&gt; // U = T[N]
shared_ptr&lt;U&gt; allocate_shared(const A&amp; allocator, Args&amp;&amp;... args);</pre>
<pre>template&lt;typename T, typename... Args&gt;
shared_ptr&lt;T[N]&gt; make_shared(Args&amp;&amp;... args);
template&lt;typename T, typename A, typename... Args&gt;
shared_ptr&lt;T[N]&gt; allocate_shared(const A&amp; allocator, Args&amp;&amp;... args);</pre>
<blockquote>
<p><b>Description:</b> These overloads of the utilities above are for a
fixed size array.</p>
</blockquote>
<pre>template&lt;typename U, typename... Args&gt; // U = T[]
shared_ptr&lt;U&gt; make_shared(initializer_list&lt;T&gt; list);
template&lt;typename U, typename A, typename... Args&gt; // U = T[]
shared_ptr&lt;U&gt; allocate_shared(const A&amp; allocator, initializer_list&lt;T&gt; list);</pre>
<pre>template&lt;typename T, typename... Args&gt;
shared_ptr&lt;T[]&gt; make_shared(initializer_list&lt;T&gt; list);
template&lt;typename T, typename A, typename... Args&gt;
shared_ptr&lt;T[]&gt; allocate_shared(const A&amp; allocator, initializer_list&lt;T&gt; list);</pre>
<blockquote>
<p><b>Description:</b> These overloads initialize the array elements
from the initializer list.</p>
</blockquote>
<pre>template&lt;typename U, typename... Args&gt; // U = T[N]
shared_ptr&lt;U&gt; make_shared(const T (&amp;list)[N]);
template&lt;typename U, typename A, typename... Args&gt; // U = T[N]
shared_ptr&lt;U&gt; allocate_shared(const A&amp; allocator, const T (&amp;list)[N]);</pre>
<pre>template&lt;typename T, typename... Args&gt;
shared_ptr&lt;T[N]&gt; make_shared(const T (&amp;list)[N]);
template&lt;typename T, typename A, typename... Args&gt;
shared_ptr&lt;T[N]&gt; allocate_shared(const A&amp; allocator, const T (&amp;list)[N]);</pre>
<blockquote>
<p><b>Description:</b> These overloads of the utilities above are for a
fixed size array.</p>
</blockquote>
<pre>template&lt;typename U, typename... Args&gt; // U = T[][N]
shared_ptr&lt;U&gt; make_shared(size_t size, const T (&amp;list)[N]);
template&lt;typename U, typename A, typename... Args&gt; // U = T[][N]
shared_ptr&lt;U&gt; allocate_shared(const A&amp; allocator, size_t size, const T (&amp;list)[N]);</pre>
<pre>template&lt;typename T, typename... Args&gt;
shared_ptr&lt;T[][N]&gt; make_shared(size_t size, const T (&amp;list)[N]);
template&lt;typename T, typename A, typename... Args&gt;
shared_ptr&lt;T[][N]&gt; allocate_shared(const A&amp; allocator, size_t size, const T (&amp;list)[N]);</pre>
<blockquote>
<p><b>Description:</b> These overloads initialize inner array elements
from the initializer list.</p>
</blockquote>
<pre>template&lt;typename U, typename... Args&gt; // U = T[M][N]
shared_ptr&lt;U&gt; make_shared(const T (&amp;list)[N]);
template&lt;typename U, typename A, typename... Args&gt; // U = T[M][N]
shared_ptr&lt;U&gt; allocate_shared(const A&amp; allocator, const T (&amp;list)[N]);</pre>
<pre>template&lt;typename T, typename... Args&gt;
shared_ptr&lt;T[M][N]&gt; make_shared(const T (&amp;list)[N]);
template&lt;typename T, typename A, typename... Args&gt;
shared_ptr&lt;T[M][N]&gt; allocate_shared(const A&amp; allocator, const T (&amp;list)[N]);</pre>
<blockquote>
<p><b>Description:</b> These overloads of the utilities above are for a
fixed size array.</p>
</blockquote>
<pre>template&lt;typename U&gt; // U = T[]
shared_ptr&lt;U&gt; make_shared(size_t size, T&amp;&amp; value);
template&lt;typename U, typename A&gt; // U = T[]
shared_ptr&lt;U&gt; allocate_shared(const A&amp; allocator, size_t size, T&amp;&amp; value);</pre>
</blockquote>
<pre>template&lt;typename T&gt;
shared_ptr&lt;T[]&gt; make_shared(size_t size, T&amp;&amp; value);
template&lt;typename T, typename A&gt;
shared_ptr&lt;T[]&gt; allocate_shared(const A&amp; allocator, size_t size, T&amp;&amp; value);</pre>
<blockquote>
<p><b>Description:</b> These overloads initialize array elements with
the given value.</p>
</blockquote>
<pre>template&lt;typename U&gt; // U = T[N]
shared_ptr&lt;U&gt; make_shared(T&amp;&amp; value);
template&lt;typename U, typename A&gt; // U = T[N]
shared_ptr&lt;U&gt; allocate_shared(const A&amp; allocator, T&amp;&amp; value);</pre>
<pre>template&lt;typename T&gt;
shared_ptr&lt;T[N]&gt; make_shared(T&amp;&amp; value);
template&lt;typename T, typename A&gt;
shared_ptr&lt;T[N]&gt; allocate_shared(const A&amp; allocator, T&amp;&amp; value);</pre>
<blockquote>
<p><b>Description:</b> These overloads of the utilities above are for a
fixed size array.</p>
</blockquote>
<pre>template&lt;typename U&gt; // U = T[]
shared_ptr&lt;U&gt; make_shared_noinit(size_t size);
template&lt;typename U, typename A&gt; // U = T[]
shared_ptr&lt;U&gt; allocate_shared_noinit(const A&amp; allocator, size_t size);</pre>
<pre>template&lt;typename T&gt;
shared_ptr&lt;T[]&gt; make_shared_noinit(size_t size);
template&lt;typename T, typename A&gt;
shared_ptr&lt;T[]&gt; allocate_shared_noinit(const A&amp; allocator, size_t size);</pre>
<blockquote>
<p><b>Description:</b> These overloads do not perform any value
initialization of elements.</p>
</blockquote>
<pre>template&lt;typename U&gt; // U = T[N]
shared_ptr&lt;U&gt; make_shared_noinit();
template&lt;typename U, typename A&gt; // U = T[N]
shared_ptr&lt;U&gt; allocate_shared_noinit(const A&amp; allocator);</pre>
<pre>template&lt;typename T&gt;
shared_ptr&lt;T[N]&gt; make_shared_noinit();
template&lt;typename T, typename A&gt;
shared_ptr&lt;T[N]&gt; allocate_shared_noinit(const A&amp; allocator);</pre>
<blockquote>
<p><b>Description:</b> These overloads of the utilities above are for a
fixed size array.</p>
@@ -231,7 +221,7 @@ shared_ptr&lt;U&gt; allocate_shared_noinit(const A&amp; allocator);</pre>
<h2><a name="example">Example</a></h2>
<p>An example of each overload of make_shared for arrays:</p>
<blockquote>
<pre>boost::shared_ptr&lt;int[]&gt; a1 = boost::make_shared&lt;int[]&gt;(size);
<pre>boost::shared_ptr&lt;point[]&gt; a1 = boost::make_shared&lt;point[]&gt;(size);
boost::shared_ptr&lt;point[]&gt; a2 = boost::make_shared&lt;point[]&gt;(size, x, y);
boost::shared_ptr&lt;point[5]&gt; a3 = boost::make_shared&lt;point[5]&gt;(x, y);
boost::shared_ptr&lt;int[]&gt; a4 = boost::make_shared&lt;int[]&gt;({1, 2, 3});

View File

@@ -61,8 +61,8 @@ shared_ptr&lt;void&gt; p2( new int(5) );
the template parameter. There is almost no difference between using an unsized array, <code>T[]</code>,
and a sized array, <code>T[N]</code>; the latter just enables <code>operator[]</code> to perform a range check
on the index.</p>
<blockquote><em>Example:</em><br /><pre>shared_ptr&lt;double[1024]&gt; p1( new double[1024] );
shared_ptr&lt;double[]&gt; p2( new double[n] );
<blockquote><em>Example:</em><br /><pre>shared_ptr&lt;double[1024]&gt; p1( new double(1024) );
shared_ptr&lt;double[]&gt; p2( new double(n) );
</pre></blockquote>
<h2 id="BestPractices">Best Practices</h2>
@@ -262,12 +262,8 @@ shared_ptr(std::nullptr_t); // never throws</pre>
the pointer <code>p</code>.
Otherwise, constructs a <code>shared_ptr</code> that <em>owns</em>
<code>p</code> and a deleter of an unspecified type that calls <code>delete[] p</code>.</p>
<p><b>Postconditions:</b> <code>use_count() == 1 &amp;&amp; get() == p</code>.
If <code>T</code> is not an array type and <code>p</code> is unambiguously convertible to <code>
<a href="enable_shared_from_this.html">enable_shared_from_this</a>&lt;V&gt;*</code>
for some <code>V</code>, <code>p-&gt;shared_from_this()</code> returns a copy of
<code>*this</code>.</p>
<p><b>Throws:</b> <code>std::bad_alloc</code>, or an implementation-defined
<p><b>Postconditions:</b> <code>use_count() == 1 &amp;&amp; get() == p</code>.</p>
<p><b>Throws:</b> <code>std::bad_alloc</code>, or an implementation-defined
exception when a resource other than memory could not be obtained.</p>
<p><b>Exception safety:</b> If an exception is thrown, the constructor calls
<code>delete[] p</code>, when <code>T</code> is an array type,
@@ -300,11 +296,7 @@ template&lt;class D, class A&gt; shared_ptr(std::nullptr_t p, D d, A a);</pre>
<p><b>Effects:</b> Constructs a <code>shared_ptr</code> that <em>owns</em> the pointer <code>
p</code> and the deleter <code>d</code>. The constructors taking an allocator <code>a</code>
allocate memory using a copy of <code>a</code>.</p>
<p><b>Postconditions:</b> <code>use_count() == 1 &amp;&amp; get() == p</code>.
If <code>T</code> is not an array type and <code>p</code> is unambiguously convertible to <code>
<a href="enable_shared_from_this.html">enable_shared_from_this</a>&lt;V&gt;*</code>
for some <code>V</code>, <code>p-&gt;shared_from_this()</code> returns a copy of
<code>*this</code>.</p>
<p><b>Postconditions:</b> <code>use_count() == 1 &amp;&amp; get() == p</code>.</p>
<p><b>Throws:</b> <code>std::bad_alloc</code>, or an implementation-defined
exception when a resource other than memory could not be obtained.</p>
<p><b>Exception safety:</b> If an exception is thrown, <code>d(p)</code> is called.</p>