From 4ea6decc7d9baa2944ccf4738c9b30a5db472c21 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Mon, 9 Sep 2002 17:44:33 +0000 Subject: [PATCH] scoped_ptr::reset changed to copy+swap (problem reported by Thomas Witt) [SVN r15239] --- include/boost/scoped_ptr.hpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/include/boost/scoped_ptr.hpp b/include/boost/scoped_ptr.hpp index 738ad1b..589bd36 100644 --- a/include/boost/scoped_ptr.hpp +++ b/include/boost/scoped_ptr.hpp @@ -61,10 +61,9 @@ public: void reset(T * p = 0) // never throws { - if (ptr != p) + if(ptr != p) { - checked_delete(ptr); - ptr = p; + this_type(p).swap(*this); } }