xo-unit: + Quantity:: operator*= operator/=

This commit is contained in:
Roland Conybeare 2024-04-27 07:58:23 -04:00
commit 0eec013321

View file

@ -191,6 +191,20 @@ namespace xo {
return x.scale() <=> y2.scale();
}
/* also works with Quantity2 = double, int, .. */
template <typename Quantity2>
Quantity & operator*= (const Quantity2 & x) {
*this = *this * x;
return *this;
}
/* also works with Quantity2 = double, int, .. */
template <typename Quantity2>
Quantity & operator/= (const Quantity2 & x) {
*this = *this / x;
return *this;
}
private:
/** @brief quantity represents this multiple of a unit amount **/
Repr scale_ = Repr{};