summaryrefslogtreecommitdiffstats
path: root/src/Block.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Block.hpp')
-rw-r--r--src/Block.hpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/Block.hpp b/src/Block.hpp
index c3dfcec..12d2907 100644
--- a/src/Block.hpp
+++ b/src/Block.hpp
@@ -1,5 +1,7 @@
#pragma once
+#include <functional>
+
struct Block {
Block();
@@ -20,4 +22,17 @@ struct BlockId {
bool operator==(const BlockId& lhs, const BlockId &rhs);
-bool operator<(const BlockId& lhs, const BlockId &rhs); \ No newline at end of file
+bool operator<(const BlockId& lhs, const BlockId &rhs);
+
+namespace std {
+ template <>
+ struct hash<BlockId> {
+ std::size_t operator()(const BlockId& k) const
+ {
+ size_t id = std::hash<unsigned short>()(k.id);
+ size_t state = std::hash<unsigned char>()(k.state);
+
+ return (id & state << 1);
+ }
+ };
+} \ No newline at end of file