aboutsummaryrefslogtreecommitdiff
path: root/include/vector3d.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/vector3d.h')
-rw-r--r--include/vector3d.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/vector3d.h b/include/vector3d.h
index 4dbc53b..ed910e9 100644
--- a/include/vector3d.h
+++ b/include/vector3d.h
@@ -7,6 +7,8 @@
#include "irrMath.h"
+#include <functional>
+
namespace irr
{
namespace core
@@ -466,5 +468,22 @@ namespace core
} // end namespace core
} // end namespace irr
+namespace std
+{
+
+template<class T>
+struct hash<irr::core::vector3d<T> >
+{
+ size_t operator()(const irr::core::vector3d<T>& vec) const
+ {
+ size_t h1 = hash<T>()(vec.X);
+ size_t h2 = hash<T>()(vec.Y);
+ size_t h3 = hash<T>()(vec.Z);
+ return (h1 << (5 * sizeof(h1)) | h1 >> (3 * sizeof(h1))) ^ (h2 << (2 * sizeof(h2)) | h2 >> (6 * sizeof(h2))) ^ h3;
+ }
+};
+
+}
+
#endif