diff --git a/src/core/include/units/quantity.h b/src/core/include/units/quantity.h index ec246f4f..84044f09 100644 --- a/src/core/include/units/quantity.h +++ b/src/core/include/units/quantity.h @@ -37,9 +37,9 @@ namespace units { namespace detail { template // TODO: Replace with `v * R{}` pending https://github.com/BobSteagall/wg21/issues/58. -inline constexpr auto make_quantity = [](auto v) { - using Rep = decltype(v); - return quantity(std::move(v)); +inline constexpr auto make_quantity = [](auto&& v) { + using Rep = std::remove_cvref_t; + return quantity(std::forward(v)); }; } // namespace detail diff --git a/src/core/include/units/quantity_kind.h b/src/core/include/units/quantity_kind.h index 868c4a3a..a9357e3d 100644 --- a/src/core/include/units/quantity_kind.h +++ b/src/core/include/units/quantity_kind.h @@ -34,9 +34,9 @@ namespace units { namespace detail { template -inline constexpr auto make_quantity_kind_fn = [](auto q) { - using Q = decltype(q); - return quantity_kind(std::move(q)); +inline constexpr auto make_quantity_kind_fn = [](auto&& q) { + using Q = std::remove_reference_t; + return quantity_kind(std::forward(q)); }; template