Add std::hash specialization for std::pair
This commit is contained in:
parent
4750c92b89
commit
748cc79d0f
17
src/utils.hh
17
src/utils.hh
|
@ -300,4 +300,21 @@ private:
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// std::pair hashing
|
||||||
|
namespace std
|
||||||
|
{
|
||||||
|
|
||||||
|
template<typename T1, typename T2>
|
||||||
|
struct hash<std::pair<T1,T2>>
|
||||||
|
{
|
||||||
|
size_t operator()(const std::pair<T1,T2>& val) const
|
||||||
|
{
|
||||||
|
size_t seed = std::hash<T2>()(val.second);
|
||||||
|
return seed ^ (std::hash<T1>()(val.first) + 0x9e3779b9 +
|
||||||
|
(seed << 6) + (seed >> 2));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif // utils_hh_INCLUDED
|
#endif // utils_hh_INCLUDED
|
||||||
|
|
Loading…
Reference in New Issue
Block a user