std::weak_ptr::owner_equal(3)
π std::weak_ptr::owner_equal π
okay so this is the C++ Standard Libary manual page for std::weak_ptr::owner_equal β yes bestie, the title and the NAME line are literally twins, she's consistent and we love that for her π
πΈ NAME πΈ
std::weak_ptr::owner_equal - std::weak_ptr::owner_equal
β¨ Synopsis β¨
here's the synopsis, and both overloads are since C++26 β also yes, noexcept is right there in the signature, no cap:
template< class Y >
bool owner_equal( const std::weak_ptr<Y>& other ) const noexcept;
template< class Y >
bool owner_equal( const std::shared_ptr<Y>& other ) const noexcept;
- overload
(1)β thestd::weak_ptr<Y>one,(since C++26) - overload
(2)β thestd::shared_ptr<Y>one,(since C++26)
Checks whether this weak_ptr and other share ownership or are both empty. The comparison is such that two smart pointers compare equivalent only if they are both empty or if they both own the same object, even if the values of the pointers obtained by get() are different (e.g. because they point at different subobjects within the same object).
The member function owner_equal is an equivalence relation such that !owner_before(other) && !other.owner_before(*this) is true if and only if owner_equal(other) is true.
This ordering is used to make shared and weak pointers usable as keys in unordered associative containers, typically through std::owner_equal.
π Parameters π
otherβ thestd::shared_ptrorstd::weak_ptrto be compared
π Return value π
true if *this and other share ownership or are both empty. Otherwise, returns false.
π¦ Notes π¦
the feature-test macro tea β is giving:
- feature-test macro:
__cpp_lib_smart_ptr_owner_equality- value:
202306L - std:
(C++26) - feature: enabling the use of
std::weak_ptras keys in unordered associative containers
- value:
π Example π
This section is incomplete.
Reason: example
π₯ See also π₯
owner_equalβ provides mixed-type owner-based equal comparisons of shared and weak(C++26)pointers (class)
π Category π
* Todo with reason
okay bye bestie π«Ά this page is from http://cppreference.com, dated 2024.06.10 β it's the std::weak_ptr::owner_equal(3) page, and it ate, periodt π
β¨
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms