diff --git a/src/core/include/mp-units/bits/value_cast.h b/src/core/include/mp-units/bits/value_cast.h index eb9dbd14..20806f5b 100644 --- a/src/core/include/mp-units/bits/value_cast.h +++ b/src/core/include/mp-units/bits/value_cast.h @@ -42,18 +42,11 @@ namespace mp_units { * @tparam ToU a unit to use for a target quantity */ template -[[nodiscard]] constexpr Quantity auto value_cast(Q&& q) requires Quantity> && (convertible(std::remove_reference_t::reference, ToU)) +[[nodiscard]] constexpr Quantity auto value_cast(Q&& q) { using q_type = std::remove_reference_t; - constexpr auto r = [] { - if constexpr (detail::is_specialization_of_reference>::value || - !AssociatedUnit>) - return reference{}; - else - return ToU; - }(); - return detail::sudo_cast>(std::forward(q)); + return detail::sudo_cast>(std::forward(q)); } /** @@ -106,10 +99,11 @@ template * @tparam ToU a unit to use for a target quantity point */ template -[[nodiscard]] constexpr QuantityPoint auto value_cast(QP&& qp) requires QuantityPoint> && (convertible(std::remove_reference_t::reference, ToU)) +[[nodiscard]] constexpr QuantityPoint auto value_cast(QP&& qp) { - return QP{value_cast(std::forward(qp).quantity_from_origin_is_an_implementation_detail_), qp.point_origin}; + return quantity_point{value_cast(std::forward(qp).quantity_from_origin_is_an_implementation_detail_), + qp.point_origin}; } /**