2.0 KiB
[util.smartptr.shared.cmp]
20 Memory management library [mem]
20.3 Smart pointers [smartptr]
20.3.2 Shared-ownership pointers [util.sharedptr]
20.3.2.2 Class template shared_ptr [util.smartptr.shared]
20.3.2.2.8 Comparison [util.smartptr.shared.cmp]
template<class T, class U> constexpr bool operator==(const shared_ptr<T>& a, const shared_ptr<U>& b) noexcept;
Returns: a.get() == b.get().
template<class T> constexpr bool operator==(const shared_ptr<T>& a, nullptr_t) noexcept;
Returns: !a.
template<class T, class U> constexpr strong_ordering operator<=>(const shared_ptr<T>& a, const shared_ptr<U>& b) noexcept;
Returns: compare_three_way()(a.get(), b.get()).
[Note 1:
Defining a comparison operator function allows shared_ptr objects to be used as keys in associative containers.
â end note]
template<class T> constexpr strong_ordering operator<=>(const shared_ptr<T>& a, nullptr_t) noexcept;
Returns: compare_three_way()(a.get(), static_cast<typename shared_ptr::element_type*>(nullptr))