summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2020-06-06 22:25:22 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2020-06-06 22:25:22 +0200
commit692e64613c45d6cfb9444931084b4a04965e826e (patch)
tree52d8dd20c4f1f686bf6a6500168e2fe4ca8a0bc7 /include
parentc00945ec1e5804003fb47798e86cd0c737a14d46 (diff)
UUID: specialization of std::hash
Diffstat (limited to 'include')
-rw-r--r--include/erebos/uuid.h14
1 files changed, 14 insertions, 0 deletions
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 <array>
+#include <cstring>
#include <optional>
#include <string>
@@ -24,3 +25,16 @@ struct UUID
};
}
+
+namespace std
+{
+ template<> struct hash<erebos::UUID>
+ {
+ std::size_t operator()(const erebos::UUID & uuid) const noexcept
+ {
+ std::size_t res;
+ std::memcpy(&res, uuid.uuid.data(), sizeof res);
+ return res;
+ }
+ };
+}