From ef80db26208299a5ba98d670e2b589a0c5a14d89 Mon Sep 17 00:00:00 2001 From: lisyarus Date: Tue, 8 Feb 2022 20:34:53 +0300 Subject: [PATCH] Add hash for std::pair --- libs/util/include/psemek/util/hash.hpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libs/util/include/psemek/util/hash.hpp b/libs/util/include/psemek/util/hash.hpp index 2c5dbd64..349a7b0b 100644 --- a/libs/util/include/psemek/util/hash.hpp +++ b/libs/util/include/psemek/util/hash.hpp @@ -32,6 +32,19 @@ namespace psemek::util namespace std { + template + struct hash> + : std::pair, std::hash> + { + std::size_t operator()(std::pair const & x) const + { + std::size_t seed = 0; + ::psemek::util::hash_combine(seed, this->first(x.first)); + ::psemek::util::hash_combine(seed, this->second(x.second)); + return seed; + } + }; + template struct hash> : std::tuple...>