mp_units::quantity_cast

quantity_cast overloads

Synopses

Declared in <mp-units/framework/quantity_cast.h>

Explicit cast of a quantity type

template<
    QuantitySpec auto ToQS,
    typename FwdQ,
    Quantity Q = std::remove_cvref_t<FwdQ>>
requires (castable(Q::quantity_spec, ToQS)) &&
          requires { typename quantity<make_reference(ToQS, Q::unit), typename Q::rep>; }
[[nodiscard]]
constexpr
Quantity auto
quantity_cast(FwdQ&& q);
» more...

Explicit cast of a quantity point type

template<
    QuantitySpec auto ToQS,
    typename FwdQP,
    QuantityPoint QP = std::remove_cvref_t<FwdQP>>
requires (castable(QP::quantity_spec, ToQS)) &&
          requires { typename quantity_point<make_reference(ToQS, QP::unit), QP::point_origin, typename QP::rep>; }
[[nodiscard]]
constexpr
QuantityPoint auto
quantity_cast(FwdQP&& qp);
» more...

Template Parameters

Name Description
ToQS a quantity specification to use for a target quantity