| 15 | |
| 16 | template<typename T> |
| 17 | struct TPoint |
| 18 | { |
| 19 | T left{}; |
| 20 | T top{}; |
| 21 | |
| 22 | TPoint() = default; |
| 23 | |
| 24 | TPoint(T const& _left, T const& _top) : |
| 25 | left(_left), |
| 26 | top(_top) |
| 27 | { |
| 28 | } |
| 29 | |
| 30 | TPoint& operator-=(TPoint const& _obj) |
| 31 | { |
| 32 | left -= _obj.left; |
| 33 | top -= _obj.top; |
| 34 | return *this; |
| 35 | } |
| 36 | |
| 37 | TPoint& operator+=(TPoint const& _obj) |
| 38 | { |
| 39 | left += _obj.left; |
| 40 | top += _obj.top; |
| 41 | return *this; |
| 42 | } |
| 43 | |
| 44 | TPoint operator-(TPoint const& _obj) const |
| 45 | { |
| 46 | return TPoint(left - _obj.left, top - _obj.top); |
| 47 | } |
| 48 | |
| 49 | TPoint operator+(TPoint const& _obj) const |
| 50 | { |
| 51 | return TPoint(left + _obj.left, top + _obj.top); |
| 52 | } |
| 53 | |
| 54 | template<typename U> |
| 55 | TPoint& operator=(TPoint<U> const& _obj) |
| 56 | { |
| 57 | left = _obj.left; |
| 58 | top = _obj.top; |
| 59 | return *this; |
| 60 | } |
| 61 | |
| 62 | bool operator==(TPoint const& _obj) const |
| 63 | { |
| 64 | return ((left == _obj.left) && (top == _obj.top)); |
| 65 | } |
| 66 | |
| 67 | bool operator!=(TPoint const& _obj) const |
| 68 | { |
| 69 | return !((left == _obj.left) && (top == _obj.top)); |
| 70 | } |
| 71 | |
| 72 | void clear() |
| 73 | { |
| 74 | left = top = 0; |