diff --git a/src/IntrusivePtr.h b/src/IntrusivePtr.h index 767aae197c..3af6fc6fc0 100644 --- a/src/IntrusivePtr.h +++ b/src/IntrusivePtr.h @@ -123,10 +123,7 @@ public: */ pointer release() noexcept { - auto result = ptr_; - if ( result ) - ptr_ = nullptr; - return result; + return std::exchange(ptr_, nullptr); } IntrusivePtr& operator=(IntrusivePtr other) noexcept