Add std::hash specialization for std::pair

This commit is contained in:
Maxime Coste 2013-10-24 22:21:41 +01:00
parent 4750c92b89
commit 748cc79d0f

View File

@ -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