<mp-units/framework/unit.h>
template<
symbol_text Symbol,
auto...>
struct named_unit;
Name | Description |
---|---|
parts_per_million
| |
per_mille
| |
percent
|
Defines a unit with a special name. It may be used to provide a base unit in the system of units (e.g. metre
) or a name assigned to another scaled or derived unit (e.g. hour
, joule
). Most of the named units may be composed with a prefix to create a prefixed_unit
.
For example:
{.cpp}
inline constexpr struct second final : named_unit<"s", kind_of
A common convention in this library is to assign the same name for a type and an object of this type. Besides defining them user never works with the unit types in the source code. All operations are done on the objects. Contrarily, the unit types are the only one visible in the compilation errors. Having them of the same names improves user experience and somehow blurs those separate domains.
Name | Description |
---|---|
Symbol | a short text representation of the unit |