diff options
| author | Markus Wick <degasus@users.noreply.github.com> | 2015-11-18 10:40:54 +0100 |
|---|---|---|
| committer | Markus Wick <degasus@users.noreply.github.com> | 2015-11-18 10:40:54 +0100 |
| commit | f172cda50f3918ebbb033ec23890358706033f0f (patch) | |
| tree | 187914e1a583363098fa5cfdf5cdab689f004e58 /Source/Core/Common | |
| parent | 0b123605de5b1c7bd8b661af6a4ef5ed804ddeaa (diff) | |
| parent | 10c1fd7f388de2ea361211b8995d4b00020bc48c (diff) | |
Merge pull request #3191 from lioncash/rekt
MathUtil: Minor changes to Rectangle
Diffstat (limited to 'Source/Core/Common')
| -rw-r--r-- | Source/Core/Common/MathUtil.h | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/Source/Core/Common/MathUtil.h b/Source/Core/Common/MathUtil.h index b8642bf80d..968c865a3c 100644 --- a/Source/Core/Common/MathUtil.h +++ b/Source/Core/Common/MathUtil.h @@ -117,19 +117,21 @@ double ApproximateReciprocal(double val); template<class T> struct Rectangle { - T left; - T top; - T right; - T bottom; + T left{}; + T top{}; + T right{}; + T bottom{}; - Rectangle() - { } + constexpr Rectangle() = default; - Rectangle(T theLeft, T theTop, T theRight, T theBottom) + constexpr Rectangle(T theLeft, T theTop, T theRight, T theBottom) : left(theLeft), top(theTop), right(theRight), bottom(theBottom) - { } + {} - bool operator==(const Rectangle& r) { return left==r.left && top==r.top && right==r.right && bottom==r.bottom; } + constexpr bool operator==(const Rectangle& r) const + { + return left == r.left && top == r.top && right == r.right && bottom == r.bottom; + } T GetWidth() const { return abs(right - left); } T GetHeight() const { return abs(bottom - top); } |
