[#mp_units-quantity-01-2constructor-06a] = xref:mp_units.adoc[mp_units]::xref:mp_units/quantity-01.adoc[quantity]::quantity :relfileprefix: ../../ :mrdocs: Constructors == Synopses Declared in `<mp‐units/framework/quantity.h>` Default constructor [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:mp_units/quantity-01/2constructor-062.adoc[quantity]() = default; ---- [.small]#xref:mp_units/quantity-01/2constructor-062.adoc[_» more..._]# Construct from `quantity` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< auto R2, typename Rep2> requires detail::QuantityConstructibleFrom<quantity, quantity<R2, Rep2>> && (equivalent(unit, get_unit(R2))) constexpr explicit(!std::convertible_to<Rep2, rep> || !mp_units::implicitly_convertible(get_quantity_spec(R2), quantity_spec) || !mp_units::implicitly_scalable<get_unit(R2), Rep2, unit, rep>) xref:mp_units/quantity-01/2constructor-01.adoc[quantity](xref:mp_units/quantity-01.adoc[quantity<R2, Rep2>] const& q); ---- [.small]#xref:mp_units/quantity-01/2constructor-01.adoc[_» more..._]# Construct from `quantity` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< auto R2, typename Rep2> requires detail::QuantityConstructibleFrom<quantity, quantity<R2, Rep2>> && (!equivalent(unit, get_unit(R2))) constexpr explicit(!std::convertible_to<Rep2, rep> || !mp_units::implicitly_convertible(get_quantity_spec(R2), quantity_spec) || !mp_units::implicitly_scalable<get_unit(R2), Rep2, unit, rep>) xref:mp_units/quantity-01/2constructor-0a.adoc[quantity](xref:mp_units/quantity-01.adoc[quantity<R2, Rep2>] const& q); ---- [.small]#xref:mp_units/quantity-01/2constructor-0a.adoc[_» more..._]# Construct from `rep` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr explicit(!mp_units::implicitly_convertible(quantity_spec, dimensionless)) xref:mp_units/quantity-01/2constructor-0f.adoc[quantity](xref:mp_units/quantity-01/rep.adoc[rep] val) requires detail::ExplicitFromNumber<reference>; ---- [.small]#xref:mp_units/quantity-01/2constructor-0f.adoc[_» more..._]# Construct from `Value` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<typename Value> requires detail::ExplicitFromNumber<reference> && detail::RepConstructibleFrom<rep, Value> && (!std::convertible_to<Value, rep>) constexpr explicit xref:mp_units/quantity-01/2constructor-02.adoc[quantity](Value val); ---- [.small]#xref:mp_units/quantity-01/2constructor-02.adoc[_» more..._]# Construct from `Value` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<typename Value> requires detail::ExplicitFromNumber<reference> && (!detail::RepConstructibleFrom<rep, Value>) constexpr explicit(!std::convertible_to<Value, rep> || !mp_units::implicitly_convertible(quantity_spec, dimensionless)) xref:mp_units/quantity-01/2constructor-0c.adoc[quantity](Value val) = delete; ---- [.small]#xref:mp_units/quantity-01/2constructor-0c.adoc[_» more..._]# Construct from `Q` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<xref:mp_units/QuantityLike.adoc[QuantityLike] Q> requires detail::QuantityConstructibleFrom<quantity, detail::quantity_like_type<Q>> constexpr explicit(quantity_like_traits<Q>::explicit_import || !std::convertible_to<detail::quantity_like_type<Q>, quantity<R, Rep>>) xref:mp_units/quantity-01/2constructor-066.adoc[quantity](Q const& q); ---- [.small]#xref:mp_units/quantity-01/2constructor-066.adoc[_» more..._]# Constructor [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<xref:mp_units/Reference.adoc[Reference] R2> requires (equivalent(unit, get_unit(R2{}))) constexpr xref:mp_units/quantity-01/2constructor-03.adoc[quantity]( xref:mp_units/quantity-01/rep.adoc[rep] val, R2); ---- [.small]#xref:mp_units/quantity-01/2constructor-03.adoc[_» more..._]# Constructor [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename Value, xref:mp_units/Reference.adoc[Reference] R2> requires (equivalent(unit, get_unit(R2{}))) && (!detail::RepConstructibleFrom<rep, Value>) constexpr xref:mp_units/quantity-01/2constructor-05.adoc[quantity]( Value val, R2) = delete; ---- [.small]#xref:mp_units/quantity-01/2constructor-05.adoc[_» more..._]# Constructor [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename FwdValue, xref:mp_units/Reference.adoc[Reference] R2> requires (!equivalent(unit, get_unit(R2{}))) && detail::QuantityConstructibleFrom<quantity, quantity<R2{}, std::remove_cvref_t<FwdValue>>> constexpr xref:mp_units/quantity-01/2constructor-04.adoc[quantity]( FwdValue&& val, R2); ---- [.small]#xref:mp_units/quantity-01/2constructor-04.adoc[_» more..._]# [.small]#Created with https://www.mrdocs.com[MrDocs]#