#ifndef POINT #define POINT class Vector { public: int x_; int y_; explicit Vector(int x, int y) : x_{x}, y_{y} {}; Vector() = default; }; Vector operator*(Vector lhs, const int rhs) { return Vector{lhs.x_ * rhs, lhs.y_ * rhs}; } Vector operator*(int lhs, const Vector rhs) { return Vector{rhs.x_ * lhs, rhs.y_ * lhs}; } Vector operator+(Vector lhs, const Vector &rhs) { return Vector{lhs.x_ + rhs.x_, lhs.y_ + rhs.y_}; } Vector operator-(Vector lhs, const Vector &rhs) { return lhs + -1 * rhs; } class Point { public: int x; int y; Point(int xx, int yy) : x{xx}, y{yy} {}; }; Point operator+(Vector lhs, Point rhs) { return Point{rhs.x + lhs.x_, rhs.x + lhs.x_}; } Point operator+(Point lhs, Vector rhs) { return Point{rhs.x_ + lhs.x, rhs.x_ + lhs.x}; } Point operator-(Vector lhs, Point rhs) { return Point{rhs.x - lhs.x_, rhs.x - lhs.x_}; } Point operator-(Point lhs, Vector rhs) { return Point{rhs.x_ - lhs.x, rhs.x_ - lhs.x}; } Vector operator-(Point lhs, Point rhs){ return Vector{lhs.x - rhs.x, lhs.y - rhs.y}; } #endif /* GENERATOR_H */