mp_units

The Measurement Library

Namespaces

NameDescription
utility Public authoring vocabulary shared by the library's own customization points and by higher-level tools.

Types

NameDescription
absolute_point_origin A point origin located at the zero point of a quantity specification
base_dimension A dimension of a base quantity
basic_fixed_string A compile-time fixed string
check_in_range Policy that checks the value is within [min, max]and reports violations.
check_non_negative Policy that checks the value is ≥ 0 and reports violations.
clamp_non_negative Policy that clamps the value to [0, ∞).]
clamp_to_range Policy that clamps the value to [min, max].
common_unit Measurement unit for an accumulation of two quantities of different units
constraint_violation_handler Customization point for handling domain constraint violations.
derived_dimension A dimension of a derived quantity
derived_quantity_spec A specification of a derived quantity
derived_unit Measurement unit for a derived quantity
dimension_one Dimension one
dimension_symbol_formatting Formatting options for dimension_symbol and dimension_symbol_to.
dimensionless Quantity of dimension one
is_kind Tag property marking a quantity_spec as the start of a new hierarchy tree of a kind
kind_of_ The type of a quantity kind for the quantity specification Q
mag_constant A named Magnitude constant identified by its symbol and, where supported, its value
named_constant A constant defined in terms of a unit
named_unit A named unit
natural_point_origin_ Implementation type of natural_point_origin
non_negative Tag property marking a quantity_spec as never holding a negative value
one Unit one
parts_per_million The "ppm" (parts per million) unit, equal to 1/1,000,000
per Type list type storing the list of components with negative exponents
per_mille The "‰" (per mille) unit, equal to 1/1000
percent The "%" (percent) unit, equal to 1/100
pi The mathematical constant π, exposed as a dimensionless named constant
pi_c A convenient Magnitude constant for pi, which we can manipulate like a regular number.
possibly_negative Tag property canceling an inherited non_negative for a quantity_spec
power Type container for exponents with ratio different than 1
prefixed_unit A prefixed unit
quantity A quantity
quantity_character Quantity character
quantity_like_traits Provides support for external quantity-like types
quantity_point A quantity point
quantity_point_like_traits Provides support for external quantity point-like types
quantity_spec A specification of a quantity used to define its kind, dimension, and character
reference Quantity reference type
reflect_in_range Policy that reflects (folds) the value at both boundaries.
relative_point_origin A point origin defined relative to another quantity point
relative_standard_uncertainty Relative standard uncertainty of a measured constant
representation_canonical_type Maps a representation value type to the concrete type a quantity should store.
representation_underlying_type Describes the underlying arithmetic/element type of a representation type.
representation_values A type trait that defines zero, one, min, and max for a representation type
rounded_down_t Tag type for the rounded_down rounding policy
rounded_t Tag type for the rounded rounding policy
rounded_up_t Tag type for the rounded_up rounding policy
scaled_unit Unit being a scaled version of another unit
standard_uncertainty Absolute standard uncertainty of a measured constant
symbol_text A symbol text representation
truncated_t Tag type for the truncated rounding policy
unit_symbol_formatting Specifies the options used to format a unit symbol
vector_axes Ordered list of the 1D-vector component axes a vector quantity decomposes into
vector_components Opts a vector quantity into decomposition into named 1D-vector components
wrap_to_range Policy that wraps the value into the half-open range [min, max).]

Type Aliases

NameDescription
conditional Alias for T if B is true, otherwise F (equivalent to std::conditional_t<B, T, F>)
expr_type The underlying symbolic expression factor type, unwrapping power if present
fixed_string basic_fixed_string specialized for char
fixed_u16string basic_fixed_string specialized for char16_t
fixed_u32string basic_fixed_string specialized for char32_t
fixed_u8string basic_fixed_string specialized for char8_t
fixed_wstring basic_fixed_string specialized for wchar_t
quantity_values [deprecated]Deprecated alias for representation_values.
rep_for Public alias that yields the representation type of a quantity-like type.
representation_canonical_type_t Convenience alias for representation_canonical_type<T>::type.
representation_underlying_type_t Convenience alias for representation_underlying_type<T>::type.
text_encoding [deprecated]Deprecated alias for character_set
zeroth_point_origin_ [deprecated]Deprecated alias for natural_point_origin_

Enums

NameDescription
character_set Character set used to render a symbol_text
quantity_character_legacy [deprecated]The pre-2.6.0 flat quantity character enumeration
quantity_field The numeric field axis of a quantity's character
quantity_tensor_order The tensor order axis of a quantity's character
unit_symbol_separator Specifies the separator placed between the symbols of a unit symbol's factors
unit_symbol_solidus Specifies how the solidus (/) is used when formatting a unit symbol's denominator

Functions

NameDescription
abs Computes the absolute value of a quantity
absolute Constructs a quantity_point of reference R from a raw representation value
castable Checks whether a quantity of quantity spec From can be cast to quantity spec To
cbrt cbrt overloads
ceil ceil overloads
contains contains overloads
default_point_origin Returns the default point origin for a reference
delta Constructs a quantity of reference R from a raw representation value
dimension_symbol Returns the textual symbol of a dimension as a std::basic_string_view.
dimension_symbol_to Writes the textual symbol of a dimension to an output iterator.
epsilon [deprecated]Returns the epsilon of the quantity
exp Computes Euler's raised to the given power
explicitly_convertible Checks whether a quantity of quantity spec From can be explicitly converted to quantity spec To
floor floor overloads
fma fma overloads
fmod Computes the floating-point remainder of the division operation x / y.
get get overloads
get_canonical_unit Computes the canonical form of a unit
get_common_quantity_spec get_common_quantity_spec overloads
get_common_reference Returns the common unit of two or more units usable as a reference
get_common_unit get_common_unit overloads
get_kind Returns the kind of a quantity specification
get_quantity_spec get_quantity_spec overloads
get_relative_standard_uncertainty Returns the relative standard uncertainty of a measured constant
get_standard_uncertainty Returns the standard uncertainty of a measured constant
get_unit Returns the unit of a reference
hypot hypot overloads
implicitly_convertible Checks whether a quantity of quantity spec From can be implicitly converted to quantity spec To
interconvertible Checks whether two quantity specifications are convertible to each other in both directions
inverse inverse overloads
is_eq_zero [deprecated]Checks whether v compares equal to T::zero()
is_gt_zero [deprecated]Checks whether v compares greater than T::zero()
is_gteq_zero [deprecated]Checks whether v compares greater than or equal to T::zero()
is_integral_scaling Returns true if the scaling factor from from to to is an exact positive integer.
is_lt_zero [deprecated]Checks whether v compares less than T::zero()
is_lteq_zero [deprecated]Checks whether v compares less than or equal to T::zero()
is_neq_zero [deprecated]Checks whether v compares not equal to T::zero()
is_non_negative Checks whether a quantity specification is tagged as non-negative
isfinite isfinite overloads
isinf isinf overloads
isnan isnan overloads
lerp Linear interpolation or extrapolation
midpoint Computes the midpoint of two points
operator* Multiplication operators
operator/ Division operators
point Constructs a quantity_point of reference R from a raw representation value
pow pow overloads
quantity_cast quantity_cast overloads
remainder Computes the IEEE remainder of the floating point division operation x / y.
round round overloads
scale scale overloads
sqrt sqrt overloads
unit_symbol Returns the textual symbol of a unit
unit_symbol_to Writes the textual symbol of a unit to an output iterator
value_cast value_cast overloads
operator<< Streams the textual symbol of a dimension to a std::basic_ostream.
operator== Equality operators
operator<=> Compares two quantity characters lexicographically on (order, field)

Variables

NameDescription
dimension_one The unique instance of the dimension one.
dimensionless Quantity of dimension one
disable_representation A specializable opt-out: when true, T is not accepted as a quantity representation.
disable_representation Opts bool out of being a valid quantity representation.
disable_representation Opts stateless symbolic-constant tag types out of being a valid quantity representation.
frame_projection User-specializable variable template for runtime coordinate frame transformations.
imag Customization point object returning the imaginary part of a complex-like value.
implicitly_scalable Controls whether conversion from quantity<FromUnit, FromRep> to quantity<ToUnit, ToRep> is implicit or explicit.
is_complex [deprecated]Deprecated, no longer necessary; kept only for backward compatibility.
is_derived_from_specialization_of Whether T is derived from some specialization of the class template Type, which takes type parameters
is_derived_from_specialization_of_v Whether T is derived from some specialization of the class template Type, which takes non-type (auto) parameters
is_kind The unique instance of the is_kind tag property.
is_scalar [deprecated]Deprecated, no longer necessary; kept only for backward compatibility.
is_scoped_enum_v Whether T is a scoped enumeration type
is_specialization_of Whether T is a specialization of the class template Type, which takes a pack of type parameters
is_specialization_of Specialization confirming that Type<Params...> is a specialization of Type
is_specialization_of_v Whether T is a specialization of the class template Type, which takes a pack of non-type (auto) parameters
is_specialization_of_v Specialization confirming that Type<Params...> is a specialization of Type
is_tensor [deprecated]Deprecated, no longer necessary; kept only for backward compatibility.
is_value_preserving [deprecated]Specifies if a specific conversion between two types is representable without data loss
is_vector [deprecated]Deprecated, no longer necessary; kept only for backward compatibility.
kind_of The quantity kind of the hierarchy tree rooted at the quantity specification Q
known_first_factor [deprecated]Deprecated placeholder retained for source compatibility
mag A Magnitude constant equal to the value V
mag A Magnitude constant equal to the value V
mag_pi [deprecated]Deprecated alias for the pi Magnitude constant
mag_power Create a Magnitude which is some rational number raised to a rational power.
mag_ratio A Magnitude constant equal to the rational number N / D
magnitude Customization point object computing the magnitude of a representation value
modulus Customization point object returning the modulus (absolute value) of a complex-like value.
natural_point_origin The point origin located at the zero point of a quantity specification
non_negative The unique instance of the non_negative tag property.
numeric_field The numeric field of a representation type: real or complex.
numeric_field Detects numeric_field for a type whose tensor order is known and whose field is consistent.
one The unique instance of the unit one.
parts_per_million The unique instance of the parts-per-million unit.
per_mille The unique instance of the per mille unit.
percent The unique instance of the percent unit.
pi The unique instance of the π constant.
pi_c The unique instance of the pi magnitude constant.
possibly_negative The unique instance of the possibly_negative tag property.
ppm Alias for parts_per_million
real Customization point object returning the real part of a complex-like value.
reference_for Public helper that yields the reference (unit + quantity spec) associated with a quantity-like type.
rounded Rounding policy that rounds to the nearest representable value, to even in halfway cases
rounded_down Rounding policy that rounds towards negative infinity
rounded_up Rounding policy that rounds towards positive infinity
space_before_unit_symbol Puts a space ' ' sign before a unit symbol
tensor_order The intrinsic tensor order of a representation type: 0 for scalar, 1 for vector, 2 for tensor.
tensor_order Structural detection of tensor_order for a type exposing exactly one indexing shape.
treat_as_floating_point Specifies if a value of a type should be treated as a floating-point value
truncated Rounding policy that rounds towards zero for an integral destination
unit_for Public helper that yields the unit associated with a quantity-like type.
zeroth_point_origin [deprecated]Deprecated alias for natural_point_origin
π Alias for pi

Concepts

NameDescription
Dimension A concept matching all dimensions in the library.
DimensionOf A concept checking if the argument is of the same dimension.
MeasuredConstant A concept matching constants that are measured rather than exact by definition
PointOrigin A concept matching all quantity point origins in the library
PointOriginFor A concept matching all quantity point origins for a specified quantity type in the library
PrefixableUnit A concept to be used to define prefixes for a unit
Quantity A concept matching all quantities in the library
QuantityLike A concept matching all external quantities like types
QuantityOf A concept matching all quantities of the provided quantity spec
QuantityPoint A concept matching all quantity points in the library
QuantityPointLike A concept matching all external quantity point like types
QuantityPointOf A concept matching all quantity points of the provided property
QuantitySpec A concept matching all quantity specifications in the library
QuantitySpecOf A concept matching all quantity specifications of a provided quantity spec value
Reference A concept matching all references in the library.
ReferenceOf A concept matching all references of the provided quantity spec
RepresentationOf Concept matching a representation type suitable for a quantity specification or character
RoundingPolicy A concept matching all rounding policies
Unit A concept matching all unit types in the library
UnitMagnitude Concept to detect whether T is a valid UnitMagnitude.
UnitOf A concept matching all units associated with the provided quantity spec