std::shared_ptr<T>::owner_hash
From cppreference.com
< cpp | memory | shared ptr
C++
Memory management library
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
std::shared_ptr
| Member functions | ||||
| Modifiers | ||||
| Observers | ||||
(C++17) | ||||
(until C++20*) | ||||
shared_ptr::owner_hash (C++26) | ||||
(C++26) | ||||
| Non-member functions | ||||
(until C++20)(until C++20)(until C++20)(until C++20)(until C++20)(C++20) | ||||
functions (until C++26*) | ||||
| Helper classes | ||||
(C++20) | ||||
| Deduction guides(C++17) |
| std::size_t owner_hash() const noexcept; |
(since C++26) | |
Returns an unspecified value such that for any object other where owner_equal(other) is true, owner_hash() == other.owner_hash() is true.
This hashing is used to make shared and weak pointers usable as keys in unordered associative containers, typically through std::owner_hash.
Contents |
[edit] Return value
A value that is identical for any std::shared_ptr or std::weak_ptr object sharing the same ownership.
[edit] Notes
| Feature-test macro | Value | Std | Feature |
|---|---|---|---|
__cpp_lib_smart_ptr_owner_equality |
202306L |
(C++26) | Enabling the use of std::shared_ptr as keys in unordered associative containers
|
[edit] Example
| This section is incomplete Reason: example |
[edit] See also
| (C++26) |
provides owner-based hashing for shared and weak pointers (class) [edit] |