diff --git a/include/boost/detail/shared_array_nmt.hpp b/include/boost/detail/shared_array_nmt.hpp index e5137a3..570af13 100644 --- a/include/boost/detail/shared_array_nmt.hpp +++ b/include/boost/detail/shared_array_nmt.hpp @@ -72,6 +72,7 @@ public: void reset(T * p = 0) { + BOOST_ASSERT(p == 0 || p != px); shared_array(p).swap(*this); } diff --git a/include/boost/detail/shared_ptr_nmt.hpp b/include/boost/detail/shared_ptr_nmt.hpp index 8b268a2..5364e77 100644 --- a/include/boost/detail/shared_ptr_nmt.hpp +++ b/include/boost/detail/shared_ptr_nmt.hpp @@ -91,6 +91,7 @@ public: void reset(T * p = 0) { + BOOST_ASSERT(p == 0 || p != px); shared_ptr(p).swap(*this); } diff --git a/include/boost/shared_array.hpp b/include/boost/shared_array.hpp index 85741b2..5098dee 100644 --- a/include/boost/shared_array.hpp +++ b/include/boost/shared_array.hpp @@ -71,6 +71,7 @@ public: void reset(T * p = 0) { + BOOST_ASSERT(p == 0 || p != px); this_type(p).swap(*this); } diff --git a/include/boost/shared_ptr.hpp b/include/boost/shared_ptr.hpp index 996a1b5..db75b9e 100644 --- a/include/boost/shared_ptr.hpp +++ b/include/boost/shared_ptr.hpp @@ -33,7 +33,7 @@ #ifdef BOOST_MSVC // moved here to work around VC++ compiler crash # pragma warning(push) # pragma warning(disable:4284) // odd return type for operator-> -#endif +#endif namespace boost { @@ -144,9 +144,15 @@ public: void reset(T * p = 0) { + BOOST_ASSERT(p == 0 || p != px); this_type(p).swap(*this); } + template void reset(T * p, D d) + { + this_type(p, d).swap(*this); + } + typename detail::shared_ptr_traits::reference operator* () const // never throws { BOOST_ASSERT(px != 0);