std:: hash <std::indirect>
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Member functions | ||||
| Observers | ||||
| Modifiers | ||||
| Non-member functions | ||||
| Deduction guides | ||||
| Helper classes | ||||
|
hash
<std::indirect>
|
|
定义于头文件
<memory>
|
||
|
template
<
class
T,
class
Allocator
>
struct hash < std :: indirect < T, Allocator >> ; |
(C++26 起) | |
对
std::hash
的
std::indirect
部分特化允许用户获取由
indirect
对象所拥有对象的哈希值。
当 std:: hash < T > 启用时,特化 std:: hash < std :: indirect < T, Allocator >> 处于 启用状态 ,否则处于禁用状态。
当启用时,对于类型为 std :: indirect < T, Allocator > 的对象 obj , std:: hash < std :: indirect < T, Allocator >> ( ) ( obj ) 的计算结果为:
- std:: hash < T > ( ) ( * obj ) ,若 obj 未处于 无值状态 。
- 实现定义的值,若 obj 处于无值状态。
此特化的成员函数不保证为
noexcept
,因为
T
的哈希计算可能抛出异常。
示例
|
本节内容不完整
原因:缺少示例 |
参见
|
(C++11)
|
哈希函数对象
(类模板) |