Fix shared_ptr<T>::owner_before

!(a < b) is not the same as b < a.

I think I originally wrote it this way to avoid making weak_ptr a friend
of shared_ptr, but weak_ptr already is a friend.
This commit is contained in:
Steven Dee (Jōshin) 2025-03-24 22:20:13 -07:00
parent 5eb7cd6643
commit 7583c8f769
No known key found for this signature in database

View file

@ -349,7 +349,7 @@ class shared_ptr
template<typename U>
bool owner_before(const weak_ptr<U>& r) const noexcept
{
return !r.owner_before(*this);
return rc < r.rc;
}
private: