[#mp_units-derived_unit] = xref:mp_units.adoc[mp_units]::derived_unit :relfileprefix: ../ :mrdocs: Measurement unit for a derived quantity == Synopsis Declared in `<mp‐units/framework/unit.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template</* implementation-defined */... Expr> struct derived_unit final : /* implementation-defined */ ---- == Base Classes [cols=2] |=== | Name | Description | `/* implementation-defined */` | |=== == Description Derived units are defined as products of powers of the base units. Instead of using a raw list of exponents this library decided to use expression template syntax to make types more digestable for the user. The positive exponents are ordered first and all negative exponents are put as a list into the `per<...>` class template. If a power of exponent is different than `1` the unit type is enclosed in `power<Dim, Num, Den>` class template. Otherwise, it is just put directly in the list without any wrapper. There is also one special case. In case all of the exponents are negative then the `one` being a coherent unit of a dimensionless quantity is put in the front to increase the readability. For example: [,cpp] ---- {.cpp} static_assert(is_of_type>>); static_assert(is_of_type); static_assert(is_of_type); static_assert(is_of_type>>); static_assert(is_of_type>); static_assert(is_of_type>>); static_assert(is_of_type>>>); static_assert(is_of_type>>); ---- Every unit in the library has its internal canonical representation being the list of exponents of named base units (with the exception of `kilogram` which is represented as `gram` here) and a scaling ratio represented with a magnitude. Two units are deemed convertible if their canonical version has units of the same type. Two units are equivalent when they are convertible and their canonical versions have the same scaling ratios. The above means that: ‐ `1/s` and `Hz` are both convertible and equal ‐ `m` and `km` are convertible but not equal ‐ `m` and `m²` ane not convertible and not equal [NOTE] ==== This also means that units like `hertz` and `becquerel` are also considered convertible and equal. ==== [NOTE] ==== User should not instantiate this type! It is not exported from the C++ module. The library will instantiate this type automatically based on the unit arithmetic equation provided by the user. ==== == Template Parameters [cols=2] |=== | Name | Description | *Us* | a parameter pack consisting tokens allowed in the unit specification (units, `power<U, Num, Den>`, `per<...>`) |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#