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

This commit is contained in:
Mateusz Pusz committed 2019-10-01 16:29:42 +02:00
1 parent 56679498b7
commit 12200f6f40
3 files changed
+22 -7

No files matched your search

+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;