diff --git a/src/core/include/mp-units/quantity.h b/src/core/include/mp-units/quantity.h index 097dd62ad..f4a2273f4 100644 --- a/src/core/include/mp-units/quantity.h +++ b/src/core/include/mp-units/quantity.h @@ -450,8 +450,7 @@ template requires detail::InvocableQuantities, quantity, quantity> [[nodiscard]] constexpr Quantity auto operator*(const quantity& lhs, const quantity& rhs) { - return make_quantity(lhs.numerical_value_ref_in(quantity::unit) * - rhs.numerical_value_ref_in(quantity::unit)); + return make_quantity(lhs.numerical_value_ref_in(get_unit(R1)) * rhs.numerical_value_ref_in(get_unit(R2))); } template @@ -459,7 +458,7 @@ template detail::InvokeResultOf, Rep, const Value&> [[nodiscard]] constexpr Quantity auto operator*(const quantity& q, const Value& v) { - return make_quantity(q.numerical_value_ref_in(quantity::unit) * v); + return make_quantity(q.numerical_value_ref_in(get_unit(R)) * v); } template @@ -467,7 +466,7 @@ template detail::InvokeResultOf, const Value&, Rep> [[nodiscard]] constexpr Quantity auto operator*(const Value& v, const quantity& q) { - return make_quantity(v * q.numerical_value_ref_in(quantity::unit)); + return make_quantity(v * q.numerical_value_ref_in(get_unit(R))); } template @@ -475,8 +474,7 @@ template [[nodiscard]] constexpr Quantity auto operator/(const quantity& lhs, const quantity& rhs) { gsl_ExpectsAudit(rhs != rhs.zero()); - return make_quantity(lhs.numerical_value_ref_in(quantity::unit) / - rhs.numerical_value_ref_in(quantity::unit)); + return make_quantity(lhs.numerical_value_ref_in(get_unit(R1)) / rhs.numerical_value_ref_in(get_unit(R2))); } template @@ -485,7 +483,7 @@ template [[nodiscard]] constexpr Quantity auto operator/(const quantity& q, const Value& v) { gsl_ExpectsAudit(v != quantity_values::zero()); - return make_quantity(q.numerical_value_ref_in(quantity::unit) / v); + return make_quantity(q.numerical_value_ref_in(get_unit(R)) / v); } template @@ -493,7 +491,7 @@ template detail::InvokeResultOf, const Value&, Rep> [[nodiscard]] constexpr Quantity auto operator/(const Value& v, const quantity& q) { - return make_quantity<::mp_units::one / R>(v / q.numerical_value_ref_in(quantity::unit)); + return make_quantity<::mp_units::one / R>(v / q.numerical_value_ref_in(get_unit(R))); } template