operator% constrained to integral types only (resolves #16)

This commit is contained in:
Mateusz Pusz
2019-10-01 16:29:42 +02:00
parent 56679498b7
commit 12200f6f40
3 changed files with 22 additions and 7 deletions
+4 -1
View File
@@ -242,13 +242,16 @@ namespace units {
return *this;
}
constexpr quantity& operator%=(const rep& rhs)
template<Scalar Rep2>
constexpr quantity& operator%=(const Rep2& rhs)
requires (!treat_as_floating_point<rep> && !treat_as_floating_point<Rep2>)
{
value_ %= rhs;
return *this;
}
constexpr quantity& operator%=(const quantity& q)
requires (!treat_as_floating_point<rep>)
{
value_ %= q.count();
return *this;