diff --git a/src/IntrusivePtr.h b/src/IntrusivePtr.h index 7ad37031c8..cb09e9c9f8 100644 --- a/src/IntrusivePtr.h +++ b/src/IntrusivePtr.h @@ -137,12 +137,29 @@ public: return std::exchange(ptr_, nullptr); } - IntrusivePtr& operator=(IntrusivePtr other) noexcept + IntrusivePtr& operator=(const IntrusivePtr& other) noexcept + { + IntrusivePtr tmp{other}; + swap(tmp); + return *this; + } + + IntrusivePtr& operator=(IntrusivePtr&& other) noexcept { swap(other); return *this; } + IntrusivePtr& operator=(std::nullptr_t) noexcept + { + if ( ptr_ ) + { + Unref(ptr_); + ptr_ = nullptr; + } + return *this; + } + pointer get() const noexcept { return ptr_;