#include "XY.h" XY XY::operator - () const { return XY { .x = -x, .y = -y, }; } XY XY::operator + (const XY & rhs) const { return XY { .x = x + rhs.x, .y = y + rhs.y, }; } XY XY::operator - (const XY & rhs) const { return XY { .x = x - rhs.x, .y = y - rhs.y, }; } XY& XY::operator += (const XY & rhs) { this->x += rhs.x; this->y += rhs.y; return *this; } XY& XY::operator -= (const XY & rhs) { this->x -= rhs.x; this->y -= rhs.y; return *this; } bool XY::operator == (const XY& rhs) const { if (this->x != rhs.x) return false; if (this->y != rhs.y) return false; return true; } bool XY::operator != (const XY& rhs) const { return !(*this == rhs); } size_t std::hash::operator () (const XY & instance) const { return instance.x | (instance.y << 16); }