aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2012-09-14 22:21:56 +0200
committerAlexander Sulfrian <alexander@sulfrian.net>2013-01-13 22:41:06 +0100
commitc85f1cde101d5c6c8912c1131d4d43a828d87015 (patch)
tree413bf615b7ad7756858f181c43aaa2209ab67795 /src/utils
parent3d85a593bf0812f50f08f4852fae00fdd16fffd8 (diff)
downloadusdx-c85f1cde101d5c6c8912c1131d4d43a828d87015.tar.gz
usdx-c85f1cde101d5c6c8912c1131d4d43a828d87015.tar.xz
usdx-c85f1cde101d5c6c8912c1131d4d43a828d87015.zip
utils/dimension: add == and != operators
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/dimension.hpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/utils/dimension.hpp b/src/utils/dimension.hpp
index 95fc8204..85799c38 100644
--- a/src/utils/dimension.hpp
+++ b/src/utils/dimension.hpp
@@ -40,20 +40,23 @@ namespace usdx
{
}
- Dimension(const Dimension& dimension) :
- width(dimension.width), height(dimension.height)
+ /**
+ * Two dimensions are equal, if width and height are equal.
+ */
+ bool operator==(const Dimension<T> &other) const
{
+ return (width == other.width) && (height == other.height);
}
- Dimension<T>& operator=(const Dimension<T>& dimension)
+ /**
+ * Two dimensions are different, if either width or height are different.
+ */
+ bool operator!=(const Dimension<T> &other) const
{
- width = dimension.width;
- height = dimension.height;
- return *this;
+ // they are different, if they are not equal
+ return !(*this == other);
}
-
-
T get_width(void) const
{
return width;