From 0c0fa877cfa2cd5e882f2aedfcd0601f0dd6876a Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Fri, 20 Dec 2013 16:32:48 -0800 Subject: [PATCH] Add ScopedPointer::reset --- beast/smart_ptr/ScopedPointer.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/beast/smart_ptr/ScopedPointer.h b/beast/smart_ptr/ScopedPointer.h index 5e16c6451..3e1cf791b 100644 --- a/beast/smart_ptr/ScopedPointer.h +++ b/beast/smart_ptr/ScopedPointer.h @@ -185,6 +185,15 @@ public: */ ObjectType* release() { ObjectType* const o = object; object = nullptr; return o; } + void reset (ObjectType* object_) + { + if (object != object_) + { + ContainerDeletePolicy ::destroy (object); + object = object_; + } + } + //============================================================================== /** Swaps this object with that of another ScopedPointer. The two objects simply exchange their pointers.