Namespaces
Variants

std:: hash <std::shared_ptr>

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)
template < class T >
struct hash < std:: shared_ptr < T >> ;
(C++11 起)

针对 std:: shared_ptr < T > std::hash 模板特化允许用户获取 std:: shared_ptr < T > 类型对象的哈希值。

对于给定的 std:: shared_ptr < T > p ,该特化确保 std:: hash < std:: shared_ptr < T >> ( ) ( p ) == std:: hash < decltype ( p. get ( ) ) > ( ) ( p. get ( ) )

示例

参见

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