diff options
author | Chris Robinson <[email protected]> | 2020-08-22 22:42:56 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2020-08-24 14:09:26 -0700 |
commit | 01f76f2b671c21c976b1f88c18845a53000afa6b (patch) | |
tree | 8c3be46866f4377985524b1fdab73b42f3994782 | |
parent | de060ce09a3b5fde8641316a7dbd7bdb8f695ffb (diff) |
Allow intrusive_ptr::reset to take a new pointer
-rw-r--r-- | common/intrusive_ptr.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/common/intrusive_ptr.h b/common/intrusive_ptr.h index 595c831d..cc82dea5 100644 --- a/common/intrusive_ptr.h +++ b/common/intrusive_ptr.h @@ -80,11 +80,11 @@ public: T* operator->() const noexcept { return mPtr; } T* get() const noexcept { return mPtr; } - void reset() noexcept + void reset(T *ptr=nullptr) noexcept { if(mPtr) mPtr->release(); - mPtr = nullptr; + mPtr = ptr; } T* release() noexcept |