mirror of
https://github.com/greg7mdp/parallel-hashmap.git
synced 2026-08-29 08:34:39 +08:00
Update phmap::Hash so that std::hash<Foo*> can be overridden - issue #168
This commit is contained in:
+3
-1
@@ -4426,7 +4426,9 @@ struct HashEq<T*>
|
||||
using is_transparent = void;
|
||||
template <class U>
|
||||
size_t operator()(const U& ptr) const {
|
||||
return phmap::Hash<const T*>{}(HashEq::ToPtr(ptr));
|
||||
// we want phmap::Hash<T*> and not phmap::Hash<const T*>
|
||||
// so "struct std::hash<T*> " override works
|
||||
return phmap::Hash<T*>{}((T*)(uintptr_t)HashEq::ToPtr(ptr));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Vendored
+1
-10
@@ -164,16 +164,7 @@ struct Hash
|
||||
return _hash<T>(val);
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct Hash<T *>
|
||||
{
|
||||
inline size_t operator()(const T *val) const noexcept
|
||||
{
|
||||
return static_cast<size_t>(reinterpret_cast<const uintptr_t>(val));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template<class ArgumentType, class ResultType>
|
||||
struct phmap_unary_function
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user