fix: lack of compound assignment from dimensionless<one>

This commit is contained in:
Johel Ernesto Guerrero Peña
2021-02-15 17:07:55 +01:00
committed by Mateusz Pusz
parent 8f04bd9cfe
commit a168f49b66
2 changed files with 22 additions and 0 deletions
+14
View File
@@ -210,6 +210,13 @@ public:
value_ *= rhs;
return *this;
}
template<typename Rep2>
constexpr quantity& operator*=(const dimensionless<units::one, Rep2>& rhs)
requires requires(rep a, const Rep2 b) { { a *= b } -> std::same_as<rep&>; }
{
value_ *= rhs.count();
return *this;
}
template<typename Rep2>
constexpr quantity& operator/=(const Rep2& rhs)
@@ -218,6 +225,13 @@ public:
value_ /= rhs;
return *this;
}
template<typename Rep2>
constexpr quantity& operator/=(const dimensionless<units::one, Rep2>& rhs)
requires requires(rep a, const Rep2 b) { { a /= b } -> std::same_as<rep&>; }
{
value_ /= rhs.count();
return *this;
}
constexpr quantity& operator%=(const rep& rhs)
requires (!floating_point_<rep>) &&