Skip to content

mp_units::mag

The unit magnitude of a number

Synopsis

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

template<MagArg auto V>
  requires detail::is_nonzero_mag_arg<V>
constexpr UnitMagnitude auto mag = detail::make_magnitude<V>();

Description

V is an integer or a constant defined with mag_constant. A magnitude is kept as a product of powers of primes and named constants, so multiplying magnitudes is exact. Multiplied by a unit, it defines a unit by an exact factor:

inline constexpr struct nautical_mile final :
  named_unit<"nmi", mag<1852> * si::metre> {} nautical_mile;

Template Parameters

NameDescription
Va nonzero integer or a mag_constant

See Also