diff --git a/src/core/include/mp-units/quantity_spec.h b/src/core/include/mp-units/quantity_spec.h index 5b2b487a..ebb188c3 100644 --- a/src/core/include/mp-units/quantity_spec.h +++ b/src/core/include/mp-units/quantity_spec.h @@ -36,6 +36,10 @@ namespace mp_units { +template + requires RepresentationOf, get_quantity_spec(R).character> +[[nodiscard]] constexpr quantity> make_quantity(Rep&& v); + namespace detail { // TODO revise the note in the below comment @@ -107,7 +111,7 @@ struct quantity_spec_interface { [[nodiscard]] constexpr Quantity auto operator()(this Self self, Q&& q) const requires Quantity> && (explicitly_convertible(std::remove_cvref_t::quantity_spec, self)) { - return std::forward(q).number() * reference::unit>{}; + return make_quantity::unit>{}>(std::forward(q).number()); } #else template U> @@ -120,7 +124,7 @@ struct quantity_spec_interface { requires Quantity> && (explicitly_convertible(std::remove_cvref_t::quantity_spec, Self{})) [[nodiscard]] constexpr Quantity auto operator()(Q&& q) const { - return std::forward(q).number() * reference::unit>{}; + return make_quantity::unit>{}>(std::forward(q).number()); } #endif }; @@ -295,7 +299,7 @@ struct quantity_spec : std::remove_const_t { requires Quantity> && (explicitly_convertible(std::remove_cvref_t::quantity_spec, Self{})) [[nodiscard]] constexpr Quantity auto operator()(Q&& q) const { - return std::forward(q).number() * reference::unit>{}; + return make_quantity::unit>{}>(std::forward(q).number()); } #endif };