From efdc390bc9b05a5f536d8b97ac97da9c76508bd9 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Sat, 3 May 2008 20:12:25 +0000 Subject: [PATCH] intrusive_ptr::reset() added. [SVN r45089] --- include/boost/intrusive_ptr.hpp | 5 +++++ intrusive_ptr.html | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/include/boost/intrusive_ptr.hpp b/include/boost/intrusive_ptr.hpp index ace808b..8982fe9 100644 --- a/include/boost/intrusive_ptr.hpp +++ b/include/boost/intrusive_ptr.hpp @@ -126,6 +126,11 @@ public: return *this; } + void reset() + { + this_type().swap( *this ); + } + void reset( T * rhs ) { this_type( rhs ).swap( *this ); diff --git a/intrusive_ptr.html b/intrusive_ptr.html index c4eb899..16097dd 100644 --- a/intrusive_ptr.html +++ b/intrusive_ptr.html @@ -62,6 +62,8 @@ intrusive_ptr & operator=(intrusive_ptr const & r); template<class Y> intrusive_ptr & operator=(intrusive_ptr<Y> const & r); intrusive_ptr & operator=(T * r); + + void reset(); void reset(T * r); T & operator*() const; // never throws @@ -148,6 +150,10 @@ intrusive_ptr & operator=(T * r);

Returns: *this.

reset

+
void reset();
+
+

Effects: Equivalent to intrusive_ptr().swap(*this).

+
void reset(T * r);

Effects: Equivalent to intrusive_ptr(r).swap(*this).