summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2013-11-06 19:10:15 +0000
committerMaxime Coste <frrrwww@gmail.com>2013-11-06 19:10:35 +0000
commitf2a902f682b7c2fe44f5b75bd675e2bdb6c9ac8a (patch)
treea6f6a5826943d8eb0020f0ecb011df275da16469 /src
parent7495d04a4714230d89b5d3fd6390dca36f50d85d (diff)
Add modulo operators to StronglyTypedNumber
Diffstat (limited to 'src')
-rw-r--r--src/units.hh6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/units.hh b/src/units.hh
index 8f9172ca..a99957f9 100644
--- a/src/units.hh
+++ b/src/units.hh
@@ -55,6 +55,12 @@ public:
constexpr RealType operator-() { return RealType(-m_value); }
+ constexpr RealType operator%(RealType other) const
+ { return RealType(m_value % other.m_value); }
+
+ constexpr RealType operator%=(RealType other)
+ { m_value %= other.m_value; return static_cast<RealType&>(*this); }
+
constexpr bool operator==(RealType other) const
{ return m_value == other.m_value; }