From 5d62dda479aa07aa020bd59f6eb13dd6765f057e Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Tue, 8 Sep 2020 22:55:41 +0200 Subject: [PATCH] refactor: non-zero contracts check in quantity improved Thanks @johelegp! --- src/include/units/quantity.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/include/units/quantity.h b/src/include/units/quantity.h index 72a5b346..ef7fec71 100644 --- a/src/include/units/quantity.h +++ b/src/include/units/quantity.h @@ -258,7 +258,7 @@ public: requires std::regular_invocable, Value, Rep> [[nodiscard]] friend constexpr Quantity auto operator/(const Value& v, const quantity& q) { - Expects(q.count() != 0); + Expects(q.count() != zero().count()); using dim = dim_invert; using ret_unit = downcast_unit; @@ -271,7 +271,7 @@ public: requires std::regular_invocable, Rep, Value> [[nodiscard]] friend constexpr Quantity auto operator/(const quantity& q, const Value& v) { - Expects(v != Value{0}); + Expects(v != zero().count()); using common_rep = decltype(q.count() / v); using ret = quantity; @@ -282,7 +282,7 @@ public: requires std::regular_invocable, Rep, Rep2> [[nodiscard]] friend constexpr Quantity auto operator/(const quantity& lhs, const quantity& rhs) { - Expects(rhs.count() != 0); + Expects(rhs.count() != zero().count()); using common_rep = decltype(lhs.count() / rhs.count()); using dim = dimension_divide;