Skip to content

mp_units::prefixed_unit

A prefixed unit

Synopsis

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

template<symbol_text Symbol, UnitMagnitude auto M, PrefixableUnit auto U>
  requires(!Symbol.empty() && M != mag<1>)
struct prefixed_unit;

Description

Defines a new unit that is a scaled version of another unit with the scaling factor specified by a predefined prefix.

For example:

template<PrefixableUnit U>
  requires(!std::is_const_v<U>)
struct kilo_ : prefixed_unit<"k", mag_power<10, 3>, U{}> {};

template<PrefixableUnit auto U>
constexpr kilo_<decltype(U)> kilo;

inline constexpr auto kilogram = kilo<gram>;

Non-Member Functions

NameDescription
cubic
equivalentThe former name of utility::equivalent
get_quantity_spec
get_quantity_spec
get_unit
operator*Multiplication operator
operator*Multiplication operator
operator*Multiplication operator
operator*Multiplication operator
operator*Multiplication operator
operator/Division operator
operator/Division operator
operator/Division operator
operator/Division operator
operator/Division operator
square

Template Parameters

NameDescription
Symbola prefix text to prepend to a unit symbol
Mscaling factor of the prefix
Ua named unit to be prefixed