From b1a1ab99aa489a8d696f9a3a6726a3c7bc09061d Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Tue, 12 Feb 2002 20:38:31 +0000 Subject: [PATCH] Bug fixes. [SVN r12787] --- include/boost/weak_ptr.hpp | 4 ++-- shared_ptr_test.cpp | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/boost/weak_ptr.hpp b/include/boost/weak_ptr.hpp index d3a01fe..624cded 100644 --- a/include/boost/weak_ptr.hpp +++ b/include/boost/weak_ptr.hpp @@ -135,12 +135,12 @@ public: operator bool_type() const // never throws { - return use_count() == 0? 0: &this_type::use_count; + return px == 0 || use_count() == 0? 0: &this_type::use_count; } bool operator! () const // never throws { - return use_count() == 0; + return px == 0 || use_count() == 0; } void swap(this_type & other) // never throws diff --git a/shared_ptr_test.cpp b/shared_ptr_test.cpp index b5f80ed..749d8ee 100644 --- a/shared_ptr_test.cpp +++ b/shared_ptr_test.cpp @@ -249,6 +249,8 @@ int test_main(int, char * []) test_eq(wp2, wp4); wp1 = p2; + test_is_zero(wp1); + wp1 = p4; wp1 = wp3; wp1 = wp2;