Files
cppdraft_translate/cppdraft/util/smartptr/owner/equal.md
2025-10-25 03:02:53 +03:00

2.0 KiB

[util.smartptr.owner.equal]

20 Memory management library [mem]

20.3 Smart pointers [smartptr]

20.3.2 Shared-ownership pointers [util.sharedptr]

20.3.2.6 Struct owner_equal [util.smartptr.owner.equal]

1

#

The class owner_equal provides ownership-based mixed equality comparisons of shared and weak pointers.

🔗

namespace std {struct owner_equal {template<class T, class U>constexpr bool operator()(const shared_ptr&, const shared_ptr&) const noexcept; template<class T, class U>constexpr bool operator()(const shared_ptr&, const weak_ptr&) const noexcept; template<class T, class U>constexpr bool operator()(const weak_ptr&, const shared_ptr&) const noexcept; template<class T, class U>constexpr bool operator()(const weak_ptr&, const weak_ptr&) const noexcept; using is_transparent = unspecified; };}

🔗

template<class T, class U> constexpr bool operator()(const shared_ptr<T>& x, const shared_ptr<U>& y) const noexcept; template<class T, class U> constexpr bool operator()(const shared_ptr<T>& x, const weak_ptr<U>& y) const noexcept; template<class T, class U> constexpr bool operator()(const weak_ptr<T>& x, const shared_ptr<U>& y) const noexcept; template<class T, class U> constexpr bool operator()(const weak_ptr<T>& x, const weak_ptr<U>& y) const noexcept;

2

#

Returns: x.owner_equal(y).

3

#

[Note 1:

x.owner_equal(y) is true if and only if x and y share ownership or are both empty.

— end note]