From c29cc62d66616ef76e70f6d7250d868c4fcf1e78 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Mon, 4 Feb 2002 11:15:40 +0000 Subject: [PATCH] Minor tweaks. [SVN r12684] --- include/boost/detail/shared_array_nmt.hpp | 2 +- include/boost/detail/shared_ptr_nmt.hpp | 2 +- include/boost/scoped_array.hpp | 3 ++- include/boost/scoped_ptr.hpp | 3 ++- include/boost/shared_array.hpp | 2 +- include/boost/shared_ptr.hpp | 4 +++- include/boost/weak_ptr.hpp | 4 +++- weak_ptr.htm | 4 +--- 8 files changed, 14 insertions(+), 10 deletions(-) diff --git a/include/boost/detail/shared_array_nmt.hpp b/include/boost/detail/shared_array_nmt.hpp index 570af13..3ff1954 100644 --- a/include/boost/detail/shared_array_nmt.hpp +++ b/include/boost/detail/shared_array_nmt.hpp @@ -12,7 +12,7 @@ // This software is provided "as is" without express or implied // 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 diff --git a/include/boost/detail/shared_ptr_nmt.hpp b/include/boost/detail/shared_ptr_nmt.hpp index 5364e77..79d5b5d 100644 --- a/include/boost/detail/shared_ptr_nmt.hpp +++ b/include/boost/detail/shared_ptr_nmt.hpp @@ -12,7 +12,7 @@ // This software is provided "as is" without express or implied // 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 diff --git a/include/boost/scoped_array.hpp b/include/boost/scoped_array.hpp index 74ecebe..c4fa3d0 100644 --- a/include/boost/scoped_array.hpp +++ b/include/boost/scoped_array.hpp @@ -9,7 +9,8 @@ // This software is provided "as is" without express or implied // 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 #include // in case ptrdiff_t not in std diff --git a/include/boost/scoped_ptr.hpp b/include/boost/scoped_ptr.hpp index 6648f09..e2a3ddf 100644 --- a/include/boost/scoped_ptr.hpp +++ b/include/boost/scoped_ptr.hpp @@ -9,7 +9,8 @@ // This software is provided "as is" without express or implied // 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 diff --git a/include/boost/shared_array.hpp b/include/boost/shared_array.hpp index 3c8775f..a820abc 100644 --- a/include/boost/shared_array.hpp +++ b/include/boost/shared_array.hpp @@ -12,7 +12,7 @@ // This software is provided "as is" without express or implied // 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 // for broken compiler workarounds diff --git a/include/boost/shared_ptr.hpp b/include/boost/shared_ptr.hpp index d601bab..e6411c3 100644 --- a/include/boost/shared_ptr.hpp +++ b/include/boost/shared_ptr.hpp @@ -12,7 +12,7 @@ // This software is provided "as is" without express or implied // 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 // for broken compiler workarounds @@ -109,7 +109,9 @@ public: shared_ptr(shared_ptr const & r, detail::dynamic_cast_tag): px(dynamic_cast(r.px)), pn(r.pn) { if (px == 0) // need to allocate new counter -- the cast failed + { pn = detail::shared_count(static_cast(0), deleter()); + } } #ifndef BOOST_NO_AUTO_PTR diff --git a/include/boost/weak_ptr.hpp b/include/boost/weak_ptr.hpp index 087ab12..f96856a 100644 --- a/include/boost/weak_ptr.hpp +++ b/include/boost/weak_ptr.hpp @@ -11,7 +11,7 @@ // This software is provided "as is" without express or implied // 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 @@ -68,7 +68,9 @@ public: weak_ptr(weak_ptr const & r, detail::dynamic_cast_tag): px(dynamic_cast(r.px)), pn(r.pn) { if (px == 0) // need to allocate new counter -- the cast failed + { pn = detail::weak_count(); + } } template diff --git a/weak_ptr.htm b/weak_ptr.htm index 545195f..10a0c2c 100644 --- a/weak_ptr.htm +++ b/weak_ptr.htm @@ -90,9 +90,7 @@ If an exception is thrown, the constructor has no effect.

template<typename Y> weak_ptr(shared_ptr<Y> const & r); // never throws

Constructs a weak_ptr, as if by storing a copy of the pointer stored in r. Afterwards, the use count for all copies is unchanged. -When the last shared_ptr is destroyed, the use count and stored pointer become 0. -The only exception which may be thrown by this constructor is std::bad_alloc. -If an exception is thrown, the constructor has no effect.

+When the last shared_ptr is destroyed, the use count and stored pointer become 0.

weak_ptr(weak_ptr const & r); // never throws
 template<typename Y> weak_ptr(weak_ptr<Y> const & r); // never throws