|
@@ -19,44 +19,48 @@ public:
|
|
|
int x, y;
|
|
|
|
|
|
//constructors
|
|
|
- Point()
|
|
|
+ constexpr Point() : x(0), y(0)
|
|
|
{
|
|
|
- x = y = 0;
|
|
|
}
|
|
|
|
|
|
- Point(int X, int Y)
|
|
|
+ constexpr Point(int X, int Y)
|
|
|
: x(X)
|
|
|
, y(Y)
|
|
|
{
|
|
|
}
|
|
|
|
|
|
+ constexpr static Point makeInvalid()
|
|
|
+ {
|
|
|
+ return Point(std::numeric_limits<int>::min(), std::numeric_limits<int>::min());
|
|
|
+ }
|
|
|
+
|
|
|
explicit DLL_LINKAGE Point(const int3 &a);
|
|
|
|
|
|
template<typename T>
|
|
|
- Point operator+(const T &b) const
|
|
|
+ constexpr Point operator+(const T &b) const
|
|
|
{
|
|
|
return Point(x+b.x,y+b.y);
|
|
|
}
|
|
|
|
|
|
template<typename T>
|
|
|
- Point operator/(const T &div) const
|
|
|
+ constexpr Point operator/(const T &div) const
|
|
|
{
|
|
|
return Point(x/div, y/div);
|
|
|
}
|
|
|
|
|
|
template<typename T>
|
|
|
- Point operator*(const T &mul) const
|
|
|
+ constexpr Point operator*(const T &mul) const
|
|
|
{
|
|
|
return Point(x*mul, y*mul);
|
|
|
}
|
|
|
|
|
|
- Point operator*(const Point &b) const
|
|
|
+ constexpr Point operator*(const Point &b) const
|
|
|
{
|
|
|
return Point(x*b.x,y*b.y);
|
|
|
}
|
|
|
|
|
|
template<typename T>
|
|
|
- Point& operator+=(const T &b)
|
|
|
+ constexpr Point& operator+=(const T &b)
|
|
|
{
|
|
|
x += b.x;
|
|
|
y += b.y;
|
|
@@ -64,34 +68,39 @@ public:
|
|
|
}
|
|
|
|
|
|
template<typename T>
|
|
|
- Point operator-(const T &b) const
|
|
|
+ constexpr Point operator-(const T &b) const
|
|
|
{
|
|
|
return Point(x - b.x, y - b.y);
|
|
|
}
|
|
|
|
|
|
template<typename T>
|
|
|
- Point& operator-=(const T &b)
|
|
|
+ constexpr Point& operator-=(const T &b)
|
|
|
{
|
|
|
x -= b.x;
|
|
|
y -= b.y;
|
|
|
return *this;
|
|
|
}
|
|
|
|
|
|
- template<typename T> Point& operator=(const T &t)
|
|
|
+ template<typename T> constexpr Point& operator=(const T &t)
|
|
|
{
|
|
|
x = t.x;
|
|
|
y = t.y;
|
|
|
return *this;
|
|
|
}
|
|
|
- template<typename T> bool operator==(const T &t) const
|
|
|
+ template<typename T> constexpr bool operator==(const T &t) const
|
|
|
{
|
|
|
return x == t.x && y == t.y;
|
|
|
}
|
|
|
- template<typename T> bool operator!=(const T &t) const
|
|
|
+ template<typename T> constexpr bool operator!=(const T &t) const
|
|
|
{
|
|
|
return !(*this == t);
|
|
|
}
|
|
|
|
|
|
+ constexpr bool isValid() const
|
|
|
+ {
|
|
|
+ return x > std::numeric_limits<int>::min() && y > std::numeric_limits<int>::min();
|
|
|
+ }
|
|
|
+
|
|
|
template <typename Handler>
|
|
|
void serialize(Handler &h, const int version)
|
|
|
{
|