std::weak_ptr<T>:: owner_hash
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Member functions | ||||
| Modifiers | ||||
| Observers | ||||
|
weak_ptr::owner_hash
(C++26)
|
||||
|
(C++26)
|
||||
| Non-member functions | ||||
| Helper classes | ||||
|
(C++20)
|
||||
| Deduction guides (C++17) |
|
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::weak_ptr
用作
无序关联容器
的键值
|
示例
|
本节内容不完整
原因:示例 |
参见
|
(C++26)
|
为共享指针和弱指针提供基于所有者的哈希功能
(类) |