fix: quantity's compound operators fixed to behave like ints do

This commit is contained in:
Mateusz Pusz
2021-01-06 16:44:32 +01:00
parent a84c9addfa
commit f4ff02f8e5
3 changed files with 13 additions and 4 deletions
+6 -4
View File
@@ -203,15 +203,17 @@ public:
return *this;
}
constexpr quantity& operator*=(const rep& rhs)
requires requires(rep a, const rep b) { { a *= b } -> std::same_as<rep&>; }
template<typename Rep2>
constexpr quantity& operator*=(const Rep2& rhs)
requires requires(rep a, const Rep2 b) { { a *= b } -> std::same_as<rep&>; }
{
value_ *= rhs;
return *this;
}
constexpr quantity& operator/=(const rep& rhs)
requires requires(rep a, const rep b) { { a /= b } -> std::same_as<rep&>; }
template<typename Rep2>
constexpr quantity& operator/=(const Rep2& rhs)
requires requires(rep a, const Rep2 b) { { a /= b } -> std::same_as<rep&>; }
{
value_ /= rhs;
return *this;