|
Unit Conversion and Dimensional Analysis Library 3.6.1
A compile-time, header-only C++23 dimensional-analysis library
|
Defines a series of classes which contain dimensioned values. More...
Macros | |
| #define | MSVC_EBO |
| Describes objects that represent quantities of a given unit. | |
Functions | |
| template<UnitType UnitType, ArithmeticType T> requires detail::is_losslessly_convertible<T, typename UnitType::underlying_type> | |
| constexpr UnitType | units::make_unit (const T value) noexcept |
| Constructs a unit container from an arithmetic type. | |
Defines a series of classes which contain dimensioned values.
Unit types store a value, and support various arithmetic operations.
| #define MSVC_EBO |
Describes objects that represent quantities of a given unit.
Stores a value which represents a quantity in the given units. Units (except dimensionless units) are not convertible to arithmetic types, in order to provide type safety in dimensional analysis. Units are implicitly convertible to other units types of the same dimension, if such conversion is lossless. Units support various types of arithmetic operations, depending on their scale type.
The value of an unit can only be set on construction, or changed by assignment from another unit type. If necessary, the underlying value can be accessed using raw():
.
| ConversionFactor | conversion_factor of the represented unit (e.g. meters) |
| T | underlying type of the storage. Defaults to UNIT_LIB_DEFAULT_TYPE. |
| NumericalScale | optional scale class for the units. Defaults to linear (i.e. does not scale the unit value). Examples of non-linear scales could be logarithmic, decibel, or richter scales. Numerical scales must adhere to the numerical-scale concept, i.e. is_numerical_scale_v<...> must be true. |
|
constexprnoexcept |
Constructs a unit container from an arithmetic type.
make_unit can be used to construct a unit container from an arithmetic type, as an alternative to using the explicit constructor. Unlike the explicit constructor it forces the user to explicitly specify the units.
| UnitType | Type to construct. |
| T | Arithmetic type. |
| [in] | value | Arithmetic value that represents a quantity in units of UnitType. |