[#mp_units-named_unit-0ec]
= xref:mp_units.adoc[mp&lowbar;units]::named&lowbar;unit
:relfileprefix: ../
:mrdocs:

A named unit

== Synopsis

Declared in `&lt;mp&hyphen;units&sol;framework&sol;unit&lowbar;definitions&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    xref:mp_units/symbol_text-032.adoc[symbol&lowbar;text] Symbol,
    auto&period;&period;&period;&gt;
struct named&lowbar;unit;
----

== Description

Defines a unit with a special name&period; It may be used to provide a base unit in the system of units (e&period;g&period; `metre`) or a name assigned to another scaled or derived unit (e&period;g&period; `hour`, `joule`)&period; Most of the named units may be composed with a prefix to create a `prefixed&lowbar;unit`&period;

For example&colon;

[,cpp]
----
inline constexpr struct second : named_unit<"s", kind_of<time>> {} second;
inline constexpr struct metre : named_unit<"m", kind_of<length> {} metre;
inline constexpr struct hertz : named_unit<"Hz", inverse(second), kind_of<frequency>> {} hertz;
inline constexpr struct newton : named_unit<"N", kilogram * metre / square(second)> {} newton;
inline constexpr struct degree_Celsius : named_unit<{u8"℃", "`C"}, kelvin, zeroth_degree_Celsius> {}
degree_Celsius; inline constexpr struct minute : named_unit<"min", mag<60> * second> {} minute;
----
[NOTE]
====
A common convention in this library is to assign the same name for a type and an object of this type&period; Besides defining them user never works with the unit types in the source code&period; All operations are done on the objects&period; Contrarily, the unit types are the only one visible in the compilation errors&period; Having them of the same names improves user experience and somehow blurs those separate domains&period;

====

== Specializations

[cols="1,4"]
|===
| Name| Description
| xref:mp_units/named_unit-07.adoc[`named&lowbar;unit&lt;Symbol, U&gt;`] 
| Specialization for unit of a specified base quantity
| xref:mp_units/named_unit-05.adoc[`named&lowbar;unit&lt;Symbol, U, QS&gt;`] 
| Specialization for a unit with special name valid only for a specific quantity
| xref:mp_units/named_unit-0e4.adoc[`named&lowbar;unit&lt;Symbol, U, QS, PO&gt;`] 
| Specialization for a unit with special name, valid only for a specific quantity and point origin
|===


== Derived Classes

[cols="1,4"]
|===
| Name| Description
| xref:mp_units/parts_per_million-0f.adoc[`parts&lowbar;per&lowbar;million`] 
| The &quot;ppm&quot; (parts per million) unit, equal to 1&sol;1,000,000
| xref:mp_units/per_mille-01.adoc[`per&lowbar;mille`] 
| The &quot;‰&quot; (per mille) unit, equal to 1&sol;1000
| xref:mp_units/percent-02.adoc[`percent`] 
| The &quot;%&quot; (percent) unit, equal to 1&sol;100
|===

== Template Parameters

[cols="1,4"]
|===
| Name| Description
| *Symbol*
| a short text representation of the unit
|===


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