From 5fd062849750481c8037ef3dc3778391de8ef9c6 Mon Sep 17 00:00:00 2001 From: Olivier BICHLER <olivier.bichler@cea.fr> Date: Wed, 4 Dec 2024 14:17:06 +0100 Subject: [PATCH] Added missing hash specialization for std::pair --- include/aidge/utils/DynamicAttributes.hpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/aidge/utils/DynamicAttributes.hpp b/include/aidge/utils/DynamicAttributes.hpp index 1bd45c817..0fc350f1a 100644 --- a/include/aidge/utils/DynamicAttributes.hpp +++ b/include/aidge/utils/DynamicAttributes.hpp @@ -445,6 +445,17 @@ namespace std { return seed; } }; + + // Specialization of std::hash for std::pair<T1, T2> + template <typename T1, typename T2> + struct hash<std::pair<T1, T2>> { + std::size_t operator()(const std::pair<T1, T2>& p) const { + std::size_t seed = 0; + Aidge::hash_combine(seed, std::hash<T1>()(p.first)); + Aidge::hash_combine(seed, std::hash<T2>()(p.second)); + return seed; + } + }; } namespace future_std { -- GitLab