Consistently use operator bool

This commit is contained in:
Steven Dee (Jōshin) 2024-06-15 17:53:31 -07:00
parent 89b9a76b01
commit 5b242f6900
No known key found for this signature in database

View file

@ -69,7 +69,7 @@ struct unique_ptr
inline void reset(nullptr_t = nullptr) noexcept inline void reset(nullptr_t = nullptr) noexcept
{ {
if (d.first()) if (*this)
d.second()(d.first()); d.second()(d.first());
d.first() = nullptr; d.first() = nullptr;
} }
@ -79,7 +79,7 @@ struct unique_ptr
/* requires is_convertible_v<U, T> */ /* requires is_convertible_v<U, T> */
inline void reset(U* p2) inline void reset(U* p2)
{ {
if (d.first()) { if (*this) {
d.second()(d.first()); d.second()(d.first());
} }
d.first() = static_cast<pointer>(p2); d.first() = static_cast<pointer>(p2);