From 692e64613c45d6cfb9444931084b4a04965e826e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sat, 6 Jun 2020 22:25:22 +0200 Subject: UUID: specialization of std::hash --- include/erebos/uuid.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'include/erebos/uuid.h') diff --git a/include/erebos/uuid.h b/include/erebos/uuid.h index e67677a..d3a3510 100644 --- a/include/erebos/uuid.h +++ b/include/erebos/uuid.h @@ -1,6 +1,7 @@ #pragma once #include +#include #include #include @@ -24,3 +25,16 @@ struct UUID }; } + +namespace std +{ + template<> struct hash + { + std::size_t operator()(const erebos::UUID & uuid) const noexcept + { + std::size_t res; + std::memcpy(&res, uuid.uuid.data(), sizeof res); + return res; + } + }; +} -- cgit v1.2.3