Minor tweaks.

[SVN r12684]
This commit is contained in:
Peter Dimov
2002-02-04 11:15:40 +00:00
parent 6ed07733cb
commit c29cc62d66
8 changed files with 14 additions and 10 deletions

View File

@ -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>

View File

@ -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>

View File

@ -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

View File

@ -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>

View File

@ -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

View File

@ -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

View File

@ -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>

View File

@ -90,9 +90,7 @@ If an exception is thrown, the constructor has no effect.</p>
<pre>template&lt;typename Y&gt; weak_ptr</a>(shared_ptr&lt;Y&gt; const &amp; r); // never throws</pre> <pre>template&lt;typename Y&gt; weak_ptr</a>(shared_ptr&lt;Y&gt; const &amp; 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 &amp; r); // never throws <pre>weak_ptr(weak_ptr const &amp; r); // never throws
template&lt;typename Y&gt; weak_ptr(weak_ptr&lt;Y&gt; const &amp; r); // never throws</pre> template&lt;typename Y&gt; weak_ptr(weak_ptr&lt;Y&gt; const &amp; r); // never throws</pre>