From 29ba8e6f7c7a4ba2c0629196b485b46e8335c5e4 Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Wed, 4 Dec 2024 20:10:18 +0100 Subject: [PATCH] refactor: preconditions for quantity operations now use `is_neq_zero` --- src/core/include/mp-units/framework/quantity.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/include/mp-units/framework/quantity.h b/src/core/include/mp-units/framework/quantity.h index 0f9dc072..d0ead0e3 100644 --- a/src/core/include/mp-units/framework/quantity.h +++ b/src/core/include/mp-units/framework/quantity.h @@ -409,7 +409,7 @@ public: friend constexpr decltype(auto) operator%=(Q&& lhs, const quantity& rhs) { - MP_UNITS_EXPECTS_DEBUG(rhs != zero()); + MP_UNITS_EXPECTS_DEBUG(is_neq_zero(rhs)); if constexpr (equivalent(unit, get_unit(R2))) lhs.numerical_value_is_an_implementation_detail_ %= rhs.numerical_value_is_an_implementation_detail_; else @@ -518,7 +518,7 @@ public: detail::CommonlyInvocableQuantities, quantity, quantity> [[nodiscard]] friend constexpr Quantity auto operator%(const Q& lhs, const quantity& rhs) { - MP_UNITS_EXPECTS_DEBUG(rhs != rhs.zero()); + MP_UNITS_EXPECTS_DEBUG(is_neq_zero(rhs)); using ret = detail::common_quantity_for, quantity, quantity>; const ret ret_lhs(lhs); const ret ret_rhs(rhs); @@ -567,7 +567,7 @@ public: requires detail::InvocableQuantities, quantity, quantity> [[nodiscard]] friend constexpr Quantity auto operator/(const Q& lhs, const quantity& rhs) { - MP_UNITS_EXPECTS_DEBUG(rhs != rhs.zero()); + MP_UNITS_EXPECTS_DEBUG(is_neq_zero(rhs)); return ::mp_units::quantity{lhs.numerical_value_ref_in(unit) / rhs.numerical_value_ref_in(rhs.unit), R / R2}; }