[#mp_units-value_cast-021]
= xref:mp_units.adoc[mp&lowbar;units]::value&lowbar;cast
:relfileprefix: ../
:mrdocs:

Explicit cast of a quantity point&apos;s representation type

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename ToRep,
    typename FwdQP,
    xref:mp_units/QuantityPoint.adoc[QuantityPoint] QP = std::remove&lowbar;cvref&lowbar;t&lt;FwdQP&gt;&gt;
requires RepresentationOf&lt;ToRep, QP&colon;&colon;quantity&lowbar;spec&gt; &amp;&amp; std&colon;&colon;constructible&lowbar;from&lt;ToRep, typename QP&colon;&colon;rep&gt;
&lsqb;&lsqb;nodiscard&rsqb;&rsqb;
constexpr
xref:mp_units/quantity_point-08.adoc[quantity&lowbar;point&lt;QP&colon;&colon;reference, QP&colon;&colon;point&lowbar;origin, ToRep&gt;]
value&lowbar;cast(FwdQP&& qp);
----

== Description

Implicit conversions between quantity points of different types are allowed only for &quot;safe&quot; (e&period;g&period; non&hyphen;truncating) conversion&period; In truncating cases an explicit cast have to be used&period;

auto qp &equals; value&lowbar;cast&lt;int&gt;(quantity&lowbar;point&lcub;1&period;23 &ast; ms&rcub;)&semi;

== Return Value

A quantity point

== Template Parameters

[cols="1,4"]
|===
|Name|Description

| *ToRep*
| a representation type to use for a target quantity point
|===


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