From 748cc79d0f1b0f9ff19f35c2fc056b12414b33b7 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Thu, 24 Oct 2013 22:21:41 +0100 Subject: [PATCH] Add std::hash specialization for std::pair --- src/utils.hh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/utils.hh b/src/utils.hh index 4ff1839b..0500b203 100644 --- a/src/utils.hh +++ b/src/utils.hh @@ -300,4 +300,21 @@ private: } +// std::pair hashing +namespace std +{ + +template +struct hash> +{ + size_t operator()(const std::pair& val) const + { + size_t seed = std::hash()(val.second); + return seed ^ (std::hash()(val.first) + 0x9e3779b9 + + (seed << 6) + (seed >> 2)); + } +}; + +} + #endif // utils_hh_INCLUDED