[#mp_units-quantity-01-2constructor-0f8] = xref:mp_units.adoc[mp_units]::xref:mp_units/quantity-01.adoc[quantity]::quantity :relfileprefix: ../../ :mrdocs: Constructs a quantity from a numerical value and a reference with an equivalent unit. == Synopsis Declared in `<mp‐units/framework/quantity.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<xref:mp_units/Reference-0ba.adoc[Reference] R2> requires (equivalent(unit, get_unit(R2{}))) [[nodiscard]] constexpr quantity( xref:mp_units/quantity-01/rep.adoc[rep] val, R2 ref); ---- == Return Value [NOTE] ==== The return value https://en.cppreference.com/cpp/language/attributes/nodiscard[should not be discarded^]. ==== == Parameters [cols="1,4"] |=== | Name| Description | *val* | the numerical value to store | *ref* | a reference whose unit is equivalent to `unit` |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#