Switch to p

This commit is contained in:
Steven Dee (Jōshin) 2024-06-15 19:04:09 -07:00
parent a9fb3193d1
commit a3f913b20b
No known key found for this signature in database

View file

@ -71,7 +71,7 @@ struct unique_ptr
inline void reset(nullptr_t = nullptr) noexcept inline void reset(nullptr_t = nullptr) noexcept
{ {
if (*this) if (p)
d(p); d(p);
p = nullptr; p = nullptr;
} }
@ -81,7 +81,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 (*this) { if (p) {
d(p); d(p);
} }
p = static_cast<pointer>(p2); p = static_cast<pointer>(p2);
@ -117,14 +117,14 @@ struct unique_ptr
inline element_type& operator*() const inline element_type& operator*() const
noexcept(noexcept(*std::declval<pointer>())) noexcept(noexcept(*std::declval<pointer>()))
{ {
if (!*this) if (!p)
__builtin_trap(); __builtin_trap();
return *p; return *p;
} }
inline pointer operator->() const noexcept inline pointer operator->() const noexcept
{ {
if (!*this) if (!p)
__builtin_trap(); __builtin_trap();
return p; return p;
} }