[#mp_units-quantity_cast-05] = xref:mp_units.adoc[mp_units]::quantity_cast :relfileprefix: ../ :mrdocs: Explicit cast of a quantity point type == Synopsis Declared in `<mp‐units/framework/quantity_cast.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< xref:mp_units/QuantitySpec.adoc[QuantitySpec] auto ToQS, typename FwdQP, xref:mp_units/QuantityPoint.adoc[QuantityPoint] QP = std::remove_cvref_t<FwdQP>> requires (castable(QP::quantity_spec, ToQS)) && (MP_UNITS_WEAK_UNIT_OF(MP_UNITS_NONCONST_TYPE(QP::unit), ToQS)) [[nodiscard]] constexpr xref:mp_units/QuantityPoint.adoc[QuantityPoint] auto quantity_cast(FwdQP&& qp); ---- == Description This cast converts only a quantity point type. It might be used to force some quantity point type conversions that are not implicitly allowed but are allowed explicitly. For example: [,cpp] ---- {.cpp} auto length = isq::length(quantity_point{42 * m}); auto altitude = quantity_cast(length); ---- [NOTE] ==== This cast does not affect the underlying value of a number stored in a quantity point. ==== == Template Parameters [cols=2] |=== | Name | Description | *ToQS* | a quantity specification to use for a target quantity point |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#