forked from mpusz/mp-units
refactor: value_cast<Rep, U>
now reuses value_cast<U, Rep>
This commit is contained in:
@@ -93,7 +93,7 @@ template<Representation ToRep, Unit auto ToU, typename FwdQ, Quantity Q = std::r
|
|||||||
std::constructible_from<ToRep, typename Q::rep>
|
std::constructible_from<ToRep, typename Q::rep>
|
||||||
[[nodiscard]] constexpr Quantity auto value_cast(FwdQ&& q)
|
[[nodiscard]] constexpr Quantity auto value_cast(FwdQ&& q)
|
||||||
{
|
{
|
||||||
return detail::sudo_cast<quantity<detail::make_reference(Q::quantity_spec, ToU), ToRep>>(std::forward<FwdQ>(q));
|
return value_cast<ToU, ToRep>(std::forward<FwdQ>(q));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -181,9 +181,7 @@ template<Representation ToRep, Unit auto ToU, typename FwdQP, QuantityPoint QP =
|
|||||||
std::constructible_from<ToRep, typename QP::rep>
|
std::constructible_from<ToRep, typename QP::rep>
|
||||||
[[nodiscard]] constexpr QuantityPoint auto value_cast(FwdQP&& qp)
|
[[nodiscard]] constexpr QuantityPoint auto value_cast(FwdQP&& qp)
|
||||||
{
|
{
|
||||||
return quantity_point{
|
return value_cast<ToU, ToRep>(std::forward<FwdQP>(qp));
|
||||||
value_cast<ToU, ToRep>(std::forward<FwdQP>(qp).quantity_from_origin_is_an_implementation_detail_),
|
|
||||||
QP::point_origin};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user