From eb50a747faaec8709eac75989bcac9c2da6f827c Mon Sep 17 00:00:00 2001 From: viktorljung Date: Wed, 2 Dec 2015 17:59:21 +0100 Subject: [PATCH] Added Hash for Vec2 Unordered_Map --- .../Engine/Rendering/Util/UnorderedMapVec2.h | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 include/Engine/Rendering/Util/UnorderedMapVec2.h diff --git a/include/Engine/Rendering/Util/UnorderedMapVec2.h b/include/Engine/Rendering/Util/UnorderedMapVec2.h new file mode 100644 index 00000000..0247ac9d --- /dev/null +++ b/include/Engine/Rendering/Util/UnorderedMapVec2.h @@ -0,0 +1,23 @@ +#ifndef UnorderedMapVec2_h__ +#define UnorderedMapVec2_h__ + +#include +#include +#include + +template<> +struct std::hash +{ + inline std::size_t operator()(const glm::vec2 &v) const + { + return boost::hash()(v.x) ^ boost::hash()(v.y); + } + + inline bool operator()(const glm::vec2& a, const glm::vec2& b)const + { + return a.x == b.x && a.y == b.y; + } + +}; + +#endif \ No newline at end of file