diff options
author | rtk0c <[email protected]> | 2022-06-30 21:38:53 -0700 |
---|---|---|
committer | rtk0c <[email protected]> | 2022-06-30 21:38:53 -0700 |
commit | 7fe47a9d5b1727a61dc724523b530762f6d6ba19 (patch) | |
tree | e95be6e66db504ed06d00b72c579565bab873277 /app/source/Cplt/Utils/VectorHash.hpp | |
parent | 2cf952088d375ac8b2f45b144462af0953436cff (diff) |
Restructure project
Diffstat (limited to 'app/source/Cplt/Utils/VectorHash.hpp')
-rw-r--r-- | app/source/Cplt/Utils/VectorHash.hpp | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/app/source/Cplt/Utils/VectorHash.hpp b/app/source/Cplt/Utils/VectorHash.hpp new file mode 100644 index 0000000..f649367 --- /dev/null +++ b/app/source/Cplt/Utils/VectorHash.hpp @@ -0,0 +1,46 @@ +#pragma once + +#include <Cplt/Utils/Hash.hpp> +#include <Cplt/Utils/Vector.hpp> + +#include <cstddef> +#include <functional> + +template <class T> +struct std::hash<Vec2<T>> +{ + size_t operator()(const Vec2<T>& vec) const + { + size_t result; + HashUtils::Combine(result, vec.x); + HashUtils::Combine(result, vec.y); + return result; + } +}; + +template <class T> +struct std::hash<Vec3<T>> +{ + size_t operator()(const Vec3<T>& vec) const + { + size_t result; + HashUtils::Combine(result, vec.x); + HashUtils::Combine(result, vec.y); + HashUtils::Combine(result, vec.z); + return result; + } +}; + +template <class T> +struct std::hash<Vec4<T>> +{ + size_t operator()(const Vec4<T>& vec) const + { + size_t result; + HashUtils::Combine(result, vec.x); + HashUtils::Combine(result, vec.y); + HashUtils::Combine(result, vec.z); + HashUtils::Combine(result, vec.w); + return result; + } +}; |