Namespaces
Variants

std:: hash <std::indirect>

From cppreference.net
Memory management library
( exposition only* )
Allocators
Uninitialized memory algorithms
Constrained uninitialized memory algorithms
Memory resources
Uninitialized storage (until C++20)
( until C++20* )
( until C++20* )
( until C++20* )

Garbage collector support (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
定义于头文件 <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 ) 的计算结果为:

此特化的成员函数不保证为 noexcept ,因为 T 的哈希计算可能抛出异常。

示例

参见

(C++11)
哈希函数对象
(类模板)