[#mp_units-quantity_cast-0f]
= xref:mp_units.adoc[mp&lowbar;units]::quantity&lowbar;cast
:relfileprefix: ../
:mrdocs:

`quantity&lowbar;cast` overloads

== Synopses

Declared in `&lt;mp&hyphen;units&sol;framework&sol;quantity&lowbar;cast&period;h&gt;`

Explicit cast of a quantity type


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    xref:mp_units/QuantitySpec.adoc[QuantitySpec] auto ToQS,
    typename FwdQ,
    xref:mp_units/Quantity.adoc[Quantity] Q = std::remove&lowbar;cvref&lowbar;t&lt;FwdQ&gt;&gt;
requires (castable(Q&colon;&colon;quantity&lowbar;spec, ToQS)) &amp;&amp; (MP&lowbar;UNITS&lowbar;WEAK&lowbar;UNIT&lowbar;OF(MP&lowbar;UNITS&lowbar;NONCONST&lowbar;TYPE(Q&colon;&colon;unit), ToQS))
&lsqb;&lsqb;nodiscard&rsqb;&rsqb;
constexpr
xref:mp_units/Quantity.adoc[Quantity] auto
xref:mp_units/quantity_cast-0b.adoc[quantity&lowbar;cast](FwdQ&& q);
----

[.small]#xref:mp_units/quantity_cast-0b.adoc[_» more&period;&period;&period;_]#

Explicit cast of a quantity point type


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    xref:mp_units/QuantitySpec.adoc[QuantitySpec] auto ToQS,
    typename FwdQP,
    xref:mp_units/QuantityPoint.adoc[QuantityPoint] QP = std::remove&lowbar;cvref&lowbar;t&lt;FwdQP&gt;&gt;
requires (castable(QP&colon;&colon;quantity&lowbar;spec, ToQS)) &amp;&amp; (MP&lowbar;UNITS&lowbar;WEAK&lowbar;UNIT&lowbar;OF(MP&lowbar;UNITS&lowbar;NONCONST&lowbar;TYPE(QP&colon;&colon;unit), ToQS))
&lsqb;&lsqb;nodiscard&rsqb;&rsqb;
constexpr
xref:mp_units/QuantityPoint.adoc[QuantityPoint] auto
xref:mp_units/quantity_cast-05.adoc[quantity&lowbar;cast](FwdQP&& qp);
----

[.small]#xref:mp_units/quantity_cast-05.adoc[_» more&period;&period;&period;_]#

== Template Parameters

[cols=2]
|===
| Name
| Description
| *ToQS*
| a quantity specification to use for a target quantity
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
