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

Constructors

== Synopses

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

Default constructor


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
&lsqb;&lsqb;nodiscard&rsqb;&rsqb;
xref:mp_units/quantity-01/2constructor-062.adoc[quantity]() = default;
----

[.small]#xref:mp_units/quantity-01/2constructor-062.adoc[_» more&period;&period;&period;_]#

Construct from `quantity`


[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;)
xref:mp_units/quantity-01/2constructor-07.adoc[quantity](xref:mp_units/quantity-01.adoc[quantity&lt;R2, Rep2&gt;] const& q);
----

[.small]#xref:mp_units/quantity-01/2constructor-07.adoc[_» more&period;&period;&period;_]#

Construct from `quantity`


[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;)
xref:mp_units/quantity-01/2constructor-067.adoc[quantity](xref:mp_units/quantity-01.adoc[quantity&lt;R2, Rep2&gt;] const& q);
----

[.small]#xref:mp_units/quantity-01/2constructor-067.adoc[_» more&period;&period;&period;_]#

Construct from `rep`


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
&lsqb;&lsqb;nodiscard&rsqb;&rsqb;
constexpr
explicit(!mp&lowbar;units&colon;&colon;implicitly&lowbar;convertible(quantity&lowbar;spec, dimensionless))
xref:mp_units/quantity-01/2constructor-0c.adoc[quantity](xref:mp_units/quantity-01/rep.adoc[rep] val)
requires detail&colon;&colon;ExplicitFromNumber&lt;reference&gt;;
----

[.small]#xref:mp_units/quantity-01/2constructor-0c.adoc[_» more&period;&period;&period;_]#

Construct from `Value`


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;typename Value&gt;
requires detail&colon;&colon;ExplicitFromNumber&lt;reference&gt; &amp;&amp; detail&colon;&colon;RepConstructibleFrom&lt;rep, Value&gt; &amp;&amp;
             (!std&colon;&colon;convertible&lowbar;to&lt;Value, rep&gt;)
&lsqb;&lsqb;nodiscard&rsqb;&rsqb;
constexpr
explicit
xref:mp_units/quantity-01/2constructor-09.adoc[quantity](Value val);
----

[.small]#xref:mp_units/quantity-01/2constructor-09.adoc[_» more&period;&period;&period;_]#

Construct from `Value`


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;typename Value&gt;
requires detail&colon;&colon;ExplicitFromNumber&lt;reference&gt; &amp;&amp; (!detail&colon;&colon;RepConstructibleFrom&lt;rep, Value&gt;)
constexpr
explicit(!std&colon;&colon;convertible&lowbar;to&lt;Value, rep&gt; &verbar;&verbar; !mp&lowbar;units&colon;&colon;implicitly&lowbar;convertible(quantity&lowbar;spec, dimensionless))
xref:mp_units/quantity-01/2constructor-0f0.adoc[quantity](Value val) = delete;
----

[.small]#xref:mp_units/quantity-01/2constructor-0f0.adoc[_» more&period;&period;&period;_]#

Construct from `Q`


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;xref:mp_units/QuantityLike.adoc[QuantityLike] Q&gt;
requires detail&colon;&colon;QuantityConstructibleFrom&lt;quantity, detail&colon;&colon;quantity&lowbar;like&lowbar;type&lt;Q&gt;&gt;
&lsqb;&lsqb;nodiscard&rsqb;&rsqb;
constexpr
explicit(quantity&lowbar;like&lowbar;traits&lt;Q&gt;&colon;&colon;explicit&lowbar;import &verbar;&verbar; !std&colon;&colon;convertible&lowbar;to&lt;detail&colon;&colon;quantity&lowbar;like&lowbar;type&lt;Q&gt;, quantity&lt;R, Rep&gt;&gt;)
xref:mp_units/quantity-01/2constructor-08.adoc[quantity](Q const& q);
----

[.small]#xref:mp_units/quantity-01/2constructor-08.adoc[_» more&period;&period;&period;_]#

Constructor


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;xref:mp_units/Reference.adoc[Reference] R2&gt;
requires (equivalent(unit, get&lowbar;unit(R2&lcub;&rcub;)))
&lsqb;&lsqb;nodiscard&rsqb;&rsqb;
constexpr
xref:mp_units/quantity-01/2constructor-0f8.adoc[quantity](
    xref:mp_units/quantity-01/rep.adoc[rep] val,
    R2);
----

[.small]#xref:mp_units/quantity-01/2constructor-0f8.adoc[_» more&period;&period;&period;_]#

Constructor


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename Value,
    xref:mp_units/Reference.adoc[Reference] R2&gt;
requires (equivalent(unit, get&lowbar;unit(R2&lcub;&rcub;))) &amp;&amp; (!detail&colon;&colon;RepConstructibleFrom&lt;rep, Value&gt;)
constexpr
xref:mp_units/quantity-01/2constructor-0fc.adoc[quantity](
    Value val,
    R2) = delete;
----

[.small]#xref:mp_units/quantity-01/2constructor-0fc.adoc[_» more&period;&period;&period;_]#

Constructor


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename FwdValue,
    xref:mp_units/Reference.adoc[Reference] R2&gt;
requires (!equivalent(unit, get&lowbar;unit(R2&lcub;&rcub;))) &amp;&amp;
            detail&colon;&colon;QuantityConstructibleFrom&lt;quantity, quantity&lt;R2&lcub;&rcub;, std&colon;&colon;remove&lowbar;cvref&lowbar;t&lt;FwdValue&gt;&gt;&gt;
&lsqb;&lsqb;nodiscard&rsqb;&rsqb;
constexpr
xref:mp_units/quantity-01/2constructor-0b.adoc[quantity](
    FwdValue&& val,
    R2);
----

[.small]#xref:mp_units/quantity-01/2constructor-0b.adoc[_» more&period;&period;&period;_]#


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