From f2a902f682b7c2fe44f5b75bd675e2bdb6c9ac8a Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Wed, 6 Nov 2013 19:10:15 +0000 Subject: [PATCH] Add modulo operators to StronglyTypedNumber --- src/units.hh | 6 ++++++ 1 file changed, 6 insertions(+) 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(*this); } + constexpr bool operator==(RealType other) const { return m_value == other.m_value; }