std::shared_ptr<T>::owner_hash
来自cppreference.com
< cpp | memory | shared ptr
std::size_t owner_hash() const noexcept; |
(C++26 起) | |
返回未指定的值,使得对于任何 owner_equal(other) 为 true 的对象 other
,owner_hash() == other.owner_hash() 均为 true。
此散列函数常通过 std::owner_hash 使用,使得共享指针与弱指针能用作无序关联容器的键。
返回值
对于任何共享同一所有权的 std::shared_ptr
或 std::weak_ptr
对象相等的值。
注解
功能特性测试宏 | 值 | 标准 | 功能特性 |
---|---|---|---|
__cpp_lib_smart_ptr_owner_equality |
202306L | (C++26) | 启用以 std::shared_ptr 为无序关联容器中的键
|
示例
本节未完成 原因:example |
参阅
(C++26) |
对共享指针与弱指针提供基于所有者的散列器 (类) |