diff options
author | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2017-09-23 17:55:08 +0200 |
---|---|---|
committer | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2018-01-13 03:39:32 +0100 |
commit | 437cf879808fb68a79e7f8325615737f86f434be (patch) | |
tree | db9dcb8c02606dc8bfc7478e058291b6cec076cf /src/Block.hpp | |
parent | 2017-09-20 (diff) | |
download | AltCraft-437cf879808fb68a79e7f8325615737f86f434be.tar AltCraft-437cf879808fb68a79e7f8325615737f86f434be.tar.gz AltCraft-437cf879808fb68a79e7f8325615737f86f434be.tar.bz2 AltCraft-437cf879808fb68a79e7f8325615737f86f434be.tar.lz AltCraft-437cf879808fb68a79e7f8325615737f86f434be.tar.xz AltCraft-437cf879808fb68a79e7f8325615737f86f434be.tar.zst AltCraft-437cf879808fb68a79e7f8325615737f86f434be.zip |
Diffstat (limited to 'src/Block.hpp')
-rw-r--r-- | src/Block.hpp | 17 |
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 |