mirror of
https://github.com/boostorg/smart_ptr.git
synced 2025-07-30 12:47:28 +02:00
Minor tweaks.
[SVN r12684]
This commit is contained in:
@ -12,7 +12,7 @@
|
|||||||
// This software is provided "as is" without express or implied
|
// This software is provided "as is" without express or implied
|
||||||
// warranty, and with no claim as to its suitability for any purpose.
|
// warranty, and with no claim as to its suitability for any purpose.
|
||||||
//
|
//
|
||||||
// See http://www.boost.org for most recent version including documentation.
|
// See http://www.boost.org/libs/smart_ptr/shared_array.htm for documentation.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
// This software is provided "as is" without express or implied
|
// This software is provided "as is" without express or implied
|
||||||
// warranty, and with no claim as to its suitability for any purpose.
|
// warranty, and with no claim as to its suitability for any purpose.
|
||||||
//
|
//
|
||||||
// See http://www.boost.org for most recent version including documentation.
|
// See http://www.boost.org/libs/smart_ptr/shared_ptr.htm for documentation.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
|
@ -9,7 +9,8 @@
|
|||||||
// This software is provided "as is" without express or implied
|
// This software is provided "as is" without express or implied
|
||||||
// warranty, and with no claim as to its suitability for any purpose.
|
// warranty, and with no claim as to its suitability for any purpose.
|
||||||
//
|
//
|
||||||
// See http://www.boost.org for most recent version including documentation.
|
// See http://www.boost.org/libs/smart_ptr/scoped_array.htm for documentation.
|
||||||
|
//
|
||||||
|
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
#include <boost/config.hpp> // in case ptrdiff_t not in std
|
#include <boost/config.hpp> // in case ptrdiff_t not in std
|
||||||
|
@ -9,7 +9,8 @@
|
|||||||
// This software is provided "as is" without express or implied
|
// This software is provided "as is" without express or implied
|
||||||
// warranty, and with no claim as to its suitability for any purpose.
|
// warranty, and with no claim as to its suitability for any purpose.
|
||||||
//
|
//
|
||||||
// See http://www.boost.org for most recent version including documentation.
|
// See http://www.boost.org/libs/smart_ptr/scoped_ptr.htm for documentation.
|
||||||
|
//
|
||||||
|
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
// This software is provided "as is" without express or implied
|
// This software is provided "as is" without express or implied
|
||||||
// warranty, and with no claim as to its suitability for any purpose.
|
// warranty, and with no claim as to its suitability for any purpose.
|
||||||
//
|
//
|
||||||
// See http://www.boost.org for most recent version including documentation.
|
// See http://www.boost.org/libs/smart_ptr/shared_array.htm for documentation.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include <boost/config.hpp> // for broken compiler workarounds
|
#include <boost/config.hpp> // for broken compiler workarounds
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
// This software is provided "as is" without express or implied
|
// This software is provided "as is" without express or implied
|
||||||
// warranty, and with no claim as to its suitability for any purpose.
|
// warranty, and with no claim as to its suitability for any purpose.
|
||||||
//
|
//
|
||||||
// See http://www.boost.org for most recent version including documentation.
|
// See http://www.boost.org/libs/smart_ptr/shared_ptr.htm for documentation.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include <boost/config.hpp> // for broken compiler workarounds
|
#include <boost/config.hpp> // for broken compiler workarounds
|
||||||
@ -109,7 +109,9 @@ public:
|
|||||||
shared_ptr(shared_ptr<Y> const & r, detail::dynamic_cast_tag): px(dynamic_cast<element_type *>(r.px)), pn(r.pn)
|
shared_ptr(shared_ptr<Y> const & r, detail::dynamic_cast_tag): px(dynamic_cast<element_type *>(r.px)), pn(r.pn)
|
||||||
{
|
{
|
||||||
if (px == 0) // need to allocate new counter -- the cast failed
|
if (px == 0) // need to allocate new counter -- the cast failed
|
||||||
|
{
|
||||||
pn = detail::shared_count(static_cast<element_type *>(0), deleter());
|
pn = detail::shared_count(static_cast<element_type *>(0), deleter());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef BOOST_NO_AUTO_PTR
|
#ifndef BOOST_NO_AUTO_PTR
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
// This software is provided "as is" without express or implied
|
// This software is provided "as is" without express or implied
|
||||||
// warranty, and with no claim as to its suitability for any purpose.
|
// warranty, and with no claim as to its suitability for any purpose.
|
||||||
//
|
//
|
||||||
// See http://www.boost.org for most recent version including documentation.
|
// See http://www.boost.org/libs/smart_ptr/weak_ptr.htm for documentation.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <boost/shared_ptr.hpp>
|
||||||
@ -68,7 +68,9 @@ public:
|
|||||||
weak_ptr(weak_ptr<Y> const & r, detail::dynamic_cast_tag): px(dynamic_cast<element_type *>(r.px)), pn(r.pn)
|
weak_ptr(weak_ptr<Y> const & r, detail::dynamic_cast_tag): px(dynamic_cast<element_type *>(r.px)), pn(r.pn)
|
||||||
{
|
{
|
||||||
if (px == 0) // need to allocate new counter -- the cast failed
|
if (px == 0) // need to allocate new counter -- the cast failed
|
||||||
|
{
|
||||||
pn = detail::weak_count();
|
pn = detail::weak_count();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Y>
|
template<typename Y>
|
||||||
|
@ -90,9 +90,7 @@ If an exception is thrown, the constructor has no effect.</p>
|
|||||||
<pre>template<typename Y> weak_ptr</a>(shared_ptr<Y> const & r); // never throws</pre>
|
<pre>template<typename Y> weak_ptr</a>(shared_ptr<Y> const & r); // never throws</pre>
|
||||||
<p>Constructs a <b>weak_ptr</b>, as if by storing a copy of the pointer stored in <b>r</b>.
|
<p>Constructs a <b>weak_ptr</b>, as if by storing a copy of the pointer stored in <b>r</b>.
|
||||||
Afterwards, the <a href="#use_count">use count</a> for all copies is unchanged.
|
Afterwards, the <a href="#use_count">use count</a> for all copies is unchanged.
|
||||||
When the last <b>shared_ptr</b> is destroyed, the use count and stored pointer become 0.
|
When the last <b>shared_ptr</b> is destroyed, the use count and stored pointer become 0.</p>
|
||||||
The only exception which may be thrown by this constructor is <b>std::bad_alloc</b>.
|
|
||||||
If an exception is thrown, the constructor has no effect.</p>
|
|
||||||
|
|
||||||
<pre>weak_ptr(weak_ptr const & r); // never throws
|
<pre>weak_ptr(weak_ptr const & r); // never throws
|
||||||
template<typename Y> weak_ptr(weak_ptr<Y> const & r); // never throws</pre>
|
template<typename Y> weak_ptr(weak_ptr<Y> const & r); // never throws</pre>
|
||||||
|
Reference in New Issue
Block a user