sources/geometry.h

changeset 144
e8d58327cd7f
parent 109
e4966d7e615d
child 190
90bf9049e5eb
--- a/sources/geometry.h	Wed Jul 20 15:07:03 2016 +0300
+++ b/sources/geometry.h	Wed Jul 20 15:07:57 2016 +0300
@@ -30,90 +30,91 @@
 
 #pragma once
 #include "basics.h"
+
 BEGIN_ZFC_NAMESPACE
 
+
 struct Position
 {
 	int x;
 	int y;
 
-	Position (int x, int y) :
-		x (x),
-		y (y) {}
+	Position(int x, int y) :
+		x(x),
+		y(y) {}
 
 	Position() :
-		x (0),
-		y (0) {}
+		x(0),
+		y(0) {}
 
-	bool operator< (const Position& other) const
+	bool operator<(const Position& other) const
 	{
 		if (y != other.y)
 			return y < other.y;
-
-		return x < other.x;
+		else
+			return x < other.x;
 	}
 
-	bool operator> (const Position& other) const
+	bool operator>(const Position& other) const
 	{
 		if (y != other.y)
 			return y > other.y;
-
-		return x > other.x;
+		else
+			return x > other.x;
 	}
 
-	bool operator== (const Position& other) const
+	bool operator==(const Position& other) const
 	{
 		return y == other.y and x == other.x;
 	}
 
-	bool operator!= (const Position& other) const
+	bool operator!=(const Position& other) const
 	{
-		return not operator== (other);
+		return not operator==(other);
 	}
 
-	bool operator<= (const Position& other) const
+	bool operator<=(const Position& other) const
 	{
-		return not operator> (other);
+		return not operator>(other);
 	}
 
-	bool operator>= (const Position& other) const
+	bool operator>=(const Position& other) const
 	{
-		return not operator< (other);
+		return not operator<(other);
 	}
 };
 
-// -------------------------------------------------------------------------------------------------
 
 struct Size
 {
 	int width;
 	int height;
 
-	Size (int width, int height) :
-		width (width),
-		height (height) {}
+	Size(int width, int height) :
+		width(width),
+		height(height) {}
 
 	Size() :
-		width (0),
-		height (0) {}
+		width(0),
+		height(0) {}
 
-	auto area() const -> int
+	int area() const
 	{
 		return width * height;
 	}
 };
 
-// -------------------------------------------------------------------------------------------------
 
 struct Rectangle : Position, Size
 {
-	Rectangle (int x, int y, int width, int height) :
-		Position (x, y),
-		Size (width, height) {}
+	Rectangle(int x, int y, int width, int height) :
+		Position(x, y),
+		Size(width, height) {}
 
 	Rectangle() :
 		Position(),
 		Size() {}
 };
 
+
 END_ZFC_NAMESPACE

mercurial