X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=include%2Fvector2d.h;h=a0eb7ea821b8615ed4c58b239ade51562afee520;hb=ceb53be9e3ada7f5e9fdc1262a2612a9ea6fbd8b;hp=2d28ce7224b20fd58128098cbe7563ed04a1a75f;hpb=2ae2a551a6290f46734307bbfdafea4b1a2cf2ba;p=irrlicht.git diff --git a/include/vector2d.h b/include/vector2d.h index 2d28ce7..a0eb7ea 100644 --- a/include/vector2d.h +++ b/include/vector2d.h @@ -8,6 +8,8 @@ #include "irrMath.h" #include "dimension2d.h" +#include + namespace irr { namespace core @@ -27,8 +29,6 @@ public: vector2d(T nx, T ny) : X(nx), Y(ny) {} //! Constructor with the same value for both members explicit vector2d(T n) : X(n), Y(n) {} - //! Copy constructor - vector2d(const vector2d& other) : X(other.X), Y(other.Y) {} vector2d(const dimension2d& other) : X(other.Width), Y(other.Height) {} @@ -36,8 +36,6 @@ public: vector2d operator-() const { return vector2d(-X, -Y); } - vector2d& operator=(const vector2d& other) { X = other.X; Y = other.Y; return *this; } - vector2d& operator=(const dimension2d& other) { X = other.Width; Y = other.Height; return *this; } vector2d operator+(const vector2d& other) const { return vector2d(X + other.X, Y + other.Y); } @@ -418,5 +416,21 @@ public: } // end namespace core } // end namespace irr +namespace std +{ + +template +struct hash > +{ + size_t operator()(const irr::core::vector2d& vec) const + { + size_t h1 = hash()(vec.X); + size_t h2 = hash()(vec.Y); + return (h1 << (4 * sizeof(h1)) | h1 >> (4 * sizeof(h1))) ^ h2; + } +}; + +} + #endif