]> git.lizzy.rs Git - irrlicht.git/blobdiff - include/vector2d.h
Merge branch 'master' into opengl3
[irrlicht.git] / include / vector2d.h
index 2d28ce7224b20fd58128098cbe7563ed04a1a75f..a0eb7ea821b8615ed4c58b239ade51562afee520 100644 (file)
@@ -8,6 +8,8 @@
 #include "irrMath.h"\r
 #include "dimension2d.h"\r
 \r
+#include <functional>\r
+\r
 namespace irr\r
 {\r
 namespace core\r
@@ -27,8 +29,6 @@ public:
        vector2d(T nx, T ny) : X(nx), Y(ny) {}\r
        //! Constructor with the same value for both members\r
        explicit vector2d(T n) : X(n), Y(n) {}\r
-       //! Copy constructor\r
-       vector2d(const vector2d<T>& other) : X(other.X), Y(other.Y) {}\r
 \r
        vector2d(const dimension2d<T>& other) : X(other.Width), Y(other.Height) {}\r
 \r
@@ -36,8 +36,6 @@ public:
 \r
        vector2d<T> operator-() const { return vector2d<T>(-X, -Y); }\r
 \r
-       vector2d<T>& operator=(const vector2d<T>& other) { X = other.X; Y = other.Y; return *this; }\r
-\r
        vector2d<T>& operator=(const dimension2d<T>& other) { X = other.Width; Y = other.Height; return *this; }\r
 \r
        vector2d<T> operator+(const vector2d<T>& other) const { return vector2d<T>(X + other.X, Y + other.Y); }\r
@@ -418,5 +416,21 @@ public:
 } // end namespace core\r
 } // end namespace irr\r
 \r
+namespace std\r
+{\r
+\r
+template<class T>\r
+struct hash<irr::core::vector2d<T> >\r
+{\r
+       size_t operator()(const irr::core::vector2d<T>& vec) const\r
+       {\r
+               size_t h1 = hash<T>()(vec.X);\r
+               size_t h2 = hash<T>()(vec.Y);\r
+               return (h1 << (4 * sizeof(h1)) | h1 >> (4 * sizeof(h1))) ^ h2;\r
+       }\r
+};\r
+\r
+}\r
+\r
 #endif\r
 \r