std::hash(std::shared_ptr)
| template<class T> struct hash<shared_ptr<T>>; |  | (since C++11) | 
|---|
模板的专门化std::hash为std::shared_ptr<T>允许用户获取类型对象的散列。std::shared_ptr<T>...
为某一给定std::shared_ptr<T> p,这种专业化确保了。
| std::hash<std::shared_ptr<T>>()(p) == std::hash<T*>()(p.get()). | (until C++17) | 
|---|---|
| std::hash<std::shared_ptr<T>>()(p) == std::hash<typename std::shared_ptr<T>::element_type*>()(p.get()). | (since C++17) | 
例
另见
| hash (C++11) | hash function object (class template) | 
|---|
 © cppreference.com在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。
本文档系腾讯云开发者社区成员共同维护,如有问题请联系 cloudcommunity@tencent.com

