Completely rework return values from storage operations

This commit is contained in:
Tim Wojtulewicz 2025-02-24 14:37:11 -07:00
parent 8ddda016ff
commit 9ed3e33f97
50 changed files with 859 additions and 586 deletions

View file

@ -144,10 +144,7 @@ public:
}
IntrusivePtr& operator=(std::nullptr_t) noexcept {
if ( ptr_ ) {
Unref(ptr_);
ptr_ = nullptr;
}
reset();
return *this;
}
@ -161,6 +158,23 @@ public:
explicit operator bool() const noexcept { return ptr_ != nullptr; }
void reset() noexcept {
if ( ptr_ ) {
Unref(ptr_);
ptr_ = nullptr;
}
}
void reset(T* ptr) {
if ( ptr_ )
Unref(ptr_);
if ( ptr )
Ref(ptr);
ptr_ = ptr;
}
private:
pointer ptr_ = nullptr;
};