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(mp_units::castable(Q::quantity_spec, ToQS)) &&
requires { typename quantity<make_reference(ToQS, Q::unit), typename Q::rep>; }
[[nodiscard]] constexpr Quantity auto quantity_cast(FwdQ&& q);
Explicit cast of a quantity point type
template<QuantitySpec auto ToQS, typename FwdQP, QuantityPoint QP = std::remove_cvref_t<FwdQP>>
requires(mp_units::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);
Return Value¶
Note
The return value should not be discarded.
Template Parameters¶
| Name | Description |
|---|---|
| ToQS | a quantity specification to use for a target quantity |