diff --git a/Foundation/include/Poco/AutoPtr.h b/Foundation/include/Poco/AutoPtr.h index ae2c3d680..c3235715a 100644 --- a/Foundation/include/Poco/AutoPtr.h +++ b/Foundation/include/Poco/AutoPtr.h @@ -134,6 +134,36 @@ public: return *this; } + void reset() + { + if (_ptr) + { + _ptr->release(); + _ptr = 0; + } + } + + void reset(C* ptr) + { + assign(ptr); + } + + void reset(C* ptr, bool shared) + { + assign(ptr, shared); + } + + void reset(const AutoPtr& ptr) + { + assign(ptr); + } + + template + void reset(const AutoPtr& ptr) + { + assign(ptr); + } + AutoPtr& operator = (C* ptr) { return assign(ptr); diff --git a/Foundation/include/Poco/SharedPtr.h b/Foundation/include/Poco/SharedPtr.h index 156c24e1f..899d44883 100644 --- a/Foundation/include/Poco/SharedPtr.h +++ b/Foundation/include/Poco/SharedPtr.h @@ -182,6 +182,27 @@ public: return *this; } + void reset() + { + assign(0); + } + + void reset(C* ptr) + { + assign(ptr); + } + + void reset(const SharedPtr& ptr) + { + assign(ptr); + } + + template + void reset(const SharedPtr& ptr) + { + assign(ptr); + } + SharedPtr& operator = (C* ptr) { return assign(ptr);