Skip to content

mp_units::named_unit<Symbol, U, Prop, Props...>

Specialization for unit of a specified base quantity

Synopsis

Declared in <mp-units/framework/unit_definitions.h>

template<symbol_text Symbol, Unit auto QS,
         /* implementation-defined */ auto Prop,
         /* implementation-defined */ auto Props...>
  requires(!Symbol.empty()) && detail::is_positive_canonical_unit_mag<U>
struct named_unit<Symbol, U, Prop, Props...>;

Description

Associates a unit with a specified base quantity. For example si::metre is a unit to measure isq::length in the SI system.

Note

This is the preferred way to define a measurement unit for a specific base quantity.

Note

It does not have to (or sometimes even can't) be a proper system's base unit. For example a base unit of mass in the SI is si::kilogram but here you are about to provide an si::gram and it will work just fine as those two are convertible to each other. A similar case would be the cgs::centimetre that is a base unit for isq::length in the CGS system.

Template Parameters

NameDescription
Symbola short text representation of the unit
QuantitySpeca specification of a base quantity to be measured with this unit
Propsoptionally, in any order, a point origin and no_space_before_unit_symbol
Unita unit for which we provide a special name