[#mp_units-quantity-01-2constructor-07]
= xref:mp_units.adoc[mp&lowbar;units]::xref:mp_units/quantity-01.adoc[quantity]::quantity
:relfileprefix: ../../
:mrdocs:

Construct from `quantity`

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    auto R2,
    typename Rep2&gt;
requires detail&colon;&colon;QuantityConstructibleFrom&lt;quantity, quantity&lt;R2, Rep2&gt;&gt; &amp;&amp; (equivalent(unit, get&lowbar;unit(R2)))
&lsqb;&lsqb;nodiscard&rsqb;&rsqb;
constexpr
explicit(!std&colon;&colon;convertible&lowbar;to&lt;Rep2, rep&gt; &verbar;&verbar; !mp&lowbar;units&colon;&colon;implicitly&lowbar;convertible(get&lowbar;quantity&lowbar;spec(R2), quantity&lowbar;spec) &verbar;&verbar; !mp&lowbar;units&colon;&colon;implicitly&lowbar;scalable&lt;get&lowbar;unit(R2), Rep2, unit, rep&gt;)
quantity(xref:mp_units/quantity-01.adoc[quantity&lt;R2, Rep2&gt;] const& q);
----

== Return Value

[NOTE]
====
The return value https://en.cppreference.com/cpp/language/attributes/nodiscard[should not be discarded^].
====
== Parameters

[cols="1,4"]
|===
| Name| Description
| *q*
| The object to copy construct from
|===


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