From 1c77a5e54900f2477e0c6e277af036b3e39703f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Leclercq?= Date: Sat, 17 Jul 2021 20:56:03 +0200 Subject: [PATCH] Core/Flags: Add std::hash specialization --- include/Nazara/Core/Flags.inl | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/Nazara/Core/Flags.inl b/include/Nazara/Core/Flags.inl index cb51a277a..38fa6da74 100644 --- a/include/Nazara/Core/Flags.inl +++ b/include/Nazara/Core/Flags.inl @@ -3,6 +3,7 @@ // For conditions of distribution and use, see copyright notice in Config.hpp #include +#include #include namespace Nz @@ -375,4 +376,19 @@ namespace Nz } } +namespace std +{ + template + struct hash> + { + std::size_t operator()(const Nz::Flags& flags) + { + using UnderlyingType = typename Nz::Flags::BitField; + using Hasher = hash; + Hasher hasher; + return hasher(static_cast(flags)); + } + }; +} + #include