From a62c388d050dbd09a5f4927e4cd91e3effce739f Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Fri, 23 Dec 2022 16:29:39 +0100 Subject: [PATCH] refactor: `make_quantity` helper not needed with the new syntax --- src/core/include/units/quantity.h | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/core/include/units/quantity.h b/src/core/include/units/quantity.h index 8695a7af..c83d9cd3 100644 --- a/src/core/include/units/quantity.h +++ b/src/core/include/units/quantity.h @@ -39,13 +39,6 @@ namespace units { namespace detail { -// TODO: Replace with `v * R` pending https://github.com/BobSteagall/wg21/issues/58. -template -inline constexpr auto make_quantity = [](Representation auto&& v) { - using Rep = std::remove_cvref_t; - return quantity(std::forward(v)); -}; - template concept quantity_one = quantity_of; @@ -412,7 +405,7 @@ public: requires(!Quantity) && invoke_result_of_, const Value&, rep> [[nodiscard]] friend constexpr Quantity auto operator/(const Value& v, const quantity& q) { - return detail::make_quantity(v / q.number()); + return (dimensionless[::units::one] / reference)(v / q.number()); } template @@ -490,7 +483,7 @@ template typename Q2::rep> [[nodiscard]] constexpr Quantity auto operator*(const Q1& lhs, const Q2& rhs) { - return detail::make_quantity(lhs.number() * rhs.number()); + return (Q1::reference * Q2::reference)(lhs.number() * rhs.number()); } template @@ -499,7 +492,7 @@ template [[nodiscard]] constexpr Quantity auto operator/(const Q1& lhs, const Q2& rhs) { gsl_ExpectsAudit(rhs.number() != quantity_values::zero()); - return detail::make_quantity(lhs.number() / rhs.number()); + return (Q1::reference / Q2::reference)(lhs.number() / rhs.number()); } template