Unit Conversion and Dimensional Analysis Library 3.6.1
A compile-time, header-only C++23 dimensional-analysis library
Loading...
Searching...
No Matches
core.h File Reference

unit, dimensional analysis, generic cmath functions, traits (not dimension-specific), and what they're implemented with (conversion_factor, unit manipulators, etc.) More...

#include "core.h"
#include <chrono>
#include <cmath>
#include <concepts>
#include <cstddef>
#include <cstdint>
#include <functional>
#include <limits>
#include <numeric>
#include <ratio>
#include <type_traits>
#include <utility>
#include <version>
#include <string>
#include <clocale>
#include <sstream>
Include dependency graph for core.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  units::unit_name< Unit >
struct  units::unit_abbreviation< Unit >
struct  units::detail::_unit
 helper type to identify units. More...
struct  units::detail::is_complete< T, class >
 Whether T is a complete type, decided by SFINAE on sizeof(T) without instantiating any other trait. More...
struct  units::detail::is_complete< T, std::void_t< decltype(sizeof(T))> >
struct  units::detail::is_unit_impl< T, bool >
 is_unit implementation: an incomplete or non-class type is never a unit, decided WITHOUT instantiating is_base_of (which is ill-formed on an incomplete non-same class type). More...
struct  units::detail::is_unit_impl< T, true >
struct  units::traits::is_unit< T >
 Traits which tests if a class is a unit. More...
struct  units::traits::strong< T >
 SFINAE-able trait that maps a conversion_factor to its strengthened type. More...
struct  units::dim< D, E >
struct  units::dimension_t<>
struct  units::dimension_t< D0, D... >
struct  units::merge_dimensions_recurse_impl< true, true >
struct  units::append< dimension_t< T... >, dimension_t< U... > >
struct  units::merge_dimensions_recurse_impl< true, false >
struct  units::merge_dimensions_recurse_impl< false, true >
struct  units::merge_dimensions_recurse_impl< false, false >
struct  units::merge_dimensions_impl< 1 >
struct  units::merge_dimensions_impl<-1 >
struct  units::merge_dimensions_combine_impl< true >
struct  units::merge_dimensions_combine_impl< false >
struct  units::merge_dimensions_impl< 0 >
struct  units::dimension_pow_impl< dimension_t< dim< T, E >... >, R >
struct  units::make_dimension_list< T0, N0, Rest >
struct  units::make_dimension_list< dimension_t< T... >, N0, Rest... >
struct  units::make_dimension_list<>
struct  units::dimension::length_tag
struct  units::dimension::mass_tag
struct  units::dimension::time_tag
struct  units::dimension::current_tag
struct  units::dimension::temperature_tag
struct  units::dimension::substance_tag
struct  units::dimension::luminous_intensity_tag
struct  units::dimension::angle_tag
struct  units::dimension::data_tag
struct  units::traits::replace_underlying< class, class >
 SFINAE-able trait which replaces the underlying type of Unit with Underlying. More...
struct  units::traits::replace_underlying< unit< Cf, T, Ns >, Underlying >
struct  units::traits::is_ratio_dimensionless_cf< ConversionFactor, class >
struct  units::traits::is_ratio_dimensionless_cf< ConversionFactor, std::void_t< typename ConversionFactor::dimension_type, typename ConversionFactor::conversion_ratio > >
struct  units::conversion_factor< Conversion, BaseUnit, PiExponent, Translation >
 Type representing an arbitrary conversion factor between units. More...
struct  units::traits::is_same_dimension_conversion_factor< Cf1, Cf2 >
 BinaryTypeTrait for querying whether Cf1 and Cf2 are conversion factors to the same dimension. More...
struct  units::linearized_value_t
 Tag for unit constructors. More...
struct  units::traits::is_same_dimension_unit< U1, U2 >
 BinaryTypeTrait for querying whether U1 and U2 are units of the same dimension. More...
class  units::unit< ConversionFactor, T, NumericalScale >
struct  units::detail::is_named_unit_impl< T, bool >
struct  units::detail::is_named_unit_impl< T, true >
struct  units::detail::rewrap_named< Base, Named, class >
struct  units::detail::rewrap_named< Base, Named, std::enable_if_t< is_named_unit_v< Named > &&std::is_same_v< typename Base::conversion_factor, typename Named::conversion_factor > > >
struct  units::detail::rewrap_named< Base, Named, std::enable_if_t< is_named_unit_v< Named > &&!std::is_same_v< typename Base::conversion_factor, typename Named::conversion_factor > &&is_raw_conversion_factor_v< typename Base::conversion_factor > &&is_equivalent_conversion_factor_v< typename Base::conversion_factor, typename Named::conversion_factor > > >
struct  units::detail::rewrap_to_named< U, class >
struct  units::detail::rewrap_to_named< U, std::enable_if_t< traits::is_unit< U >::value &&!std::is_void_v< decltype(named_class_of(static_cast< typename U::conversion_factor * >(nullptr), static_cast< typename U::numerical_scale_type * >(nullptr)))> > >
struct  units::traits::replace_underlying< Unit, Underlying >
struct  units::detail::floating_point_promotion< Unit >
struct  std::common_type< units::unit< ConversionFactorLhs, Tx, NumericalScale >, units::unit< ConversionFactorRhs, Ty, NumericalScale > >
 common type of units More...
struct  std::common_type< units::unit< UnitConversionT, T, NonLinearScale >, units::unit< UnitConversionT, T, NonLinearScale > >
struct  std::common_type< Lhs, Rhs >
struct  std::common_type< Named, Scalar >
struct  std::common_type< Scalar, Named >
struct  std::common_type< units::unit< units::detail::time_conversion_factor< Ratio >, T, NumericalScale >, chrono::duration< Rep, Period > >
struct  std::common_type< chrono::duration< Rep, Period >, units::unit< ConversionFactor, T, NumericalScale > >
struct  std::common_type< Ty, units::unit< ConversionFactor, Tx, NumericalScale > >
struct  std::common_type< units::unit< ConversionFactor, Tx, NumericalScale >, Ty >
struct  units::traits::has_linear_scale< T >
 Trait which tests whether a type is inherited from a linear scale. More...
struct  units::traits::has_decibel_scale< T >
 Trait which tests whether a type is inherited from a decibel scale. More...
struct  units::linear_scale
 numerical scale which is linear More...
struct  units::traits::is_dimensionless_unit< T >
struct  units::decibel_scale
 numerical scale which is decibel More...
struct  units::decibels< Underlying >
 dimensionless unit with decibel scale More...
struct  units::unit_name< decibels< Underlying > >
struct  units::unit_abbreviation< decibels< Underlying > >
struct  std::hash< units::unit< ConversionFactor, T, NumericalScale > >
struct  std::hash< Named >
struct  std::numeric_limits< units::unit< ConversionFactor, T, NonLinearScale > >
struct  std::numeric_limits< Named >

Namespaces

namespace  units
 Unit Conversion Library namespace.
namespace  units::traits
 namespace representing type traits which can access the properties of types provided by the units library.
namespace  units::literals
 namespace for unit literal definitions of all categories.
namespace  units::dimension
 namespace representing the implemented base and derived unit types.
namespace  std
 STL namespace.

Concepts

concept  units::ArithmeticType
 Concept for types which represent arithmetic types.
concept  units::NonArithmeticType
 Concept for types which represent non-arithmetic types.
concept  units::RatioType
 Concept for types which represent std::ratios.
concept  units::ConversionFactorType
 Concept for types which represent conversion factors.
concept  units::NumericalScaleType
 Concept for types which represent numerical scales.
concept  units::UnitType
 Concept for types which represent units.
concept  units::DimensionedUnitType
 Concept for types which represent units with a dimension (i.e.
concept  units::DimensionlessUnitType
 Concept for types which represent units without a dimension (dimensionless).
concept  units::same_dimension
 Concept for types which represent units of the same dimensionality.
concept  units::RatioDimensionlessUnitType
concept  units::OrdinaryDimensionlessUnitType
concept  units::Dimensionless
 Concept satisfied by any unit whose SI dimension is dimensionless; being dimension-keyed it.
concept  units::PureDimensionlessCF

Macros

#define UNIT_CORE_H
#define UNIT_LIB_DEFAULT_TYPE   double
#define UNIT_LIB_ENABLE_STRING
#define UNIT_ADD_STRONG_CONVERSION_FACTOR(namespaceName, namePlural, ...)
 Helper macro for generating the boilerplate code generating the tags of a new unit.
#define UNIT_ADD_UNIT_DEFINITION(namespaceName, namePlural, ...)
 Macro for generating the boilerplate code for the unit type definition.
#define UNIT_ADD_SCALED_UNIT_DEFINITION(unitName, scale, ...)
 Macro for generating the boilerplate code for the scaled unit template definition.
#define UNIT_ADD_NAME(namespaceName, namePlural, abbrev)
#define UNIT_REGISTER_NAMED_CLASS(namespaceName, namePlural)
 Register the CF-struct -> NAMED-class ADL map so an arithmetic RESULT is reported as the friendly type.
#define UNIT_ADD_LITERALS(namespaceName, namePlural, abbreviation)
 Macro for generating user-defined literals for units.
#define UNIT_ADD_DECIBEL_LITERALS(namespaceName, namePlural, abbreviation)
 Like UNIT_ADD_LITERALS but emits only the floating-point literal.
#define UNIT_ADD_CONSTANT(namespaceName, namePlural, abbreviation)
#define UNIT_ADD(namespaceName, namePlural, abbreviation, ...)
 Macro for generating the boilerplate code needed for a new unit.
#define UNIT_ADD_DECIBEL(namespaceName, namePlural, abbreviation)
 Macro to create decibel container and literals for an existing unit type.
#define UNIT_ADD_DIMENSION_TRAIT(unitdimension, ConceptName)
 Macro to create the is_dimension_unit type trait and the ConceptName concept.
#define UNIT_ADD_WITH_METRIC_PREFIXES(namespaceName, namePlural, abbreviation, ...)
 Macro for generating the boilerplate code needed for a new unit, including its metric prefixes from femto to peta.
#define UNIT_ADD_WITH_METRIC_AND_BINARY_PREFIXES(namespaceName, namePlural, abbreviation, ...)
 Macro for generating the boilerplate code needed for a new unit, including its metric prefixes from femto to peta, and binary prefixes from kibi to exbi.
#define MSVC_EBO
 Describes objects that represent quantities of a given unit.

Typedefs

template<class T>
using units::traits::is_ratio = detail::is_ratio_impl<T>
 UnaryTypeTrait for querying whether T represents a specialization of std::ratio.
template<class T>
using units::traits::is_conversion_factor = typename std::is_base_of<units::detail::_conversion_factor, T>::type
template<class T, class Ret>
using units::traits::is_numerical_scale = std::is_invocable_r<Ret, detail::invocable_scale<T>, Ret>
 Trait which tests whether T meets the requirements for a numerical scale.
template<class T>
using units::traits::strong_t = typename strong<T>::type
template<class T, class U>
using units::combine_dims = dim<typename T::dimension, std::ratio_add<typename T::exponent, typename U::exponent>>
template<class T, class U, class... R>
using units::merge_dimensions_recurse = typename merge_dimensions_recurse_impl<!T::empty, !U::empty>::template apply<T, U, R...>
template<class T, class U>
using units::merge_dimensions = merge_dimensions_recurse<T, U>
template<class T, class E>
using units::dimension_pow = typename dimension_pow_impl<T, E>::type
template<class T, class E>
using units::dimension_root = dimension_pow<T, std::ratio_divide<std::ratio<1>, E>>
template<class T, class U>
using units::dimension_multiply = merge_dimensions<T, U>
template<class T, class U>
using units::dimension_divide = merge_dimensions<T, dimension_pow<U, std::ratio<-1>>>
template<class... T>
using units::make_dimension = typename make_dimension_list<T...>::type
using units::dimension::length = make_dimension<length_tag>
using units::dimension::mass = make_dimension<mass_tag>
using units::dimension::time = make_dimension<time_tag>
using units::dimension::current = make_dimension<current_tag>
using units::dimension::temperature = make_dimension<temperature_tag>
using units::dimension::substance = make_dimension<substance_tag>
using units::dimension::luminous_intensity = make_dimension<luminous_intensity_tag>
using units::dimension::dimensionless = dimension_t<>
using units::dimension::angle = make_dimension<angle_tag>
 < Represents a quantity with no dimension.
using units::dimension::solid_angle = dimension_pow<angle, std::ratio<2>>
 < Represents a quantity of angle
using units::dimension::frequency = make_dimension<time, std::ratio<-1>>
 < Represents an SI derived unit of solid angle
using units::dimension::velocity = dimension_divide<length, time>
 < Represents an SI derived unit of frequency
using units::dimension::angular_velocity = dimension_divide<angle, time>
 < Represents an SI derived unit of velocity
using units::dimension::acceleration = dimension_divide<velocity, time>
 < Represents an SI derived unit of angular velocity
using units::dimension::force = dimension_multiply<mass, acceleration>
 < Represents an SI derived unit of acceleration
using units::dimension::area = dimension_pow<length, std::ratio<2>>
 < Represents an SI derived unit of force
using units::dimension::volume = dimension_pow<length, std::ratio<3>>
 < Represents an SI derived unit of area
using units::dimension::volume_flow_rate = dimension_divide<volume, time>
 < Represents an SI derived unit of volume
using units::dimension::pressure = dimension_divide<force, area>
 < Represents an SI derived unit of volumetric flow rate
using units::dimension::charge = dimension_multiply<time, current>
 < Represents an SI derived unit of pressure
using units::dimension::energy = dimension_multiply<force, length>
 < Represents an SI derived unit of charge
using units::dimension::power = dimension_divide<energy, time>
 < Represents an SI derived unit of energy
using units::dimension::voltage = dimension_divide<power, current>
 < Represents an SI derived unit of power
using units::dimension::capacitance = dimension_divide<charge, voltage>
 < Represents an SI derived unit of voltage
using units::dimension::impedance = dimension_divide<voltage, current>
 < Represents an SI derived unit of capacitance
using units::dimension::conductance = dimension_divide<current, voltage>
 < Represents an SI derived unit of impedance
using units::dimension::magnetic_flux = dimension_divide<energy, current>
 < Represents an SI derived unit of conductance
using units::dimension::inductance = dimension_multiply<impedance, time>
 < Represents an SI derived unit of magnetic flux
using units::dimension::luminous_flux = dimension_multiply<solid_angle, luminous_intensity>
 < Represents an SI derived unit of inductance
using units::dimension::illuminance = make_dimension<luminous_flux, std::ratio<1>, length, std::ratio<-2>>
 < Represents an SI derived unit of luminous flux
using units::dimension::luminance = make_dimension<luminous_intensity, std::ratio<1>, length, std::ratio<-2>>
 < Represents an SI derived unit of illuminance
using units::dimension::radioactivity = make_dimension<length, std::ratio<2>, time, std::ratio<-2>>
 < Represents an SI derived unit of luminance
using units::dimension::substance_mass = dimension_divide<mass, substance>
 < Represents an SI derived unit of radioactivity
using units::dimension::substance_concentration = dimension_divide<substance, mass>
 < Represents an SI derived unit of substance mass
using units::dimension::magnetic_field_strength = make_dimension<mass, std::ratio<1>, time, std::ratio<-2>, current, std::ratio<-1>>
 < Represents an SI derived unit of substance concentration
using units::dimension::radiant_intensity = make_dimension<power, std::ratio<1>, solid_angle, std::ratio<-1>>
 < Represents an SI derived unit of magnetic field strength
using units::dimension::radiance = make_dimension<radiant_intensity, std::ratio<1>, area, std::ratio<-1>>
 < Represents an SI derived unit of radiant intensity
using units::dimension::irradiance = make_dimension<power, std::ratio<1>, area, std::ratio<-1>>
 < Represents an SI derived unit of radiance
using units::dimension::spectral_intensity = make_dimension<radiant_intensity, std::ratio<1>, length, std::ratio<-1>>
 < Represents an SI derived unit of irradiance
using units::dimension::spectral_flux = make_dimension<power, std::ratio<1>, length, std::ratio<-1>>
 < Represents an SI derived unit of spectral intensity
using units::dimension::spectral_radiance = make_dimension<radiant_intensity, std::ratio<1>, volume, std::ratio<-1>>
 < Represents an SI derived unit of spectral flux
using units::dimension::spectral_irradiance = make_dimension<power, std::ratio<1>, volume, std::ratio<-1>>
 < Represents an SI derived unit of spectral intensity
using units::dimension::jerk = make_dimension<length, std::ratio<1>, time, std::ratio<-3>>
 < Represents an SI derived unit of spectral irradiance
using units::dimension::torque = dimension_multiply<force, length>
 < Represents an SI derived unit of jerk
using units::dimension::density = dimension_divide<mass, volume>
 < Represents an SI derived unit of torque
using units::dimension::dynamic_viscosity = dimension_multiply<pressure, time>
 < Represents an SI derived unit of density
using units::dimension::kinematic_viscosity = dimension_divide<area, time>
 < Represents an SI derived unit of dynamic (absolute) viscosity
using units::dimension::energy_density = make_dimension<energy, std::ratio<1>, volume, std::ratio<-1>>
 < Represents an SI derived unit of kinematic viscosity
using units::dimension::concentration = make_dimension<volume, std::ratio<-1>>
 < Represents an SI derived unit of energy density
using units::dimension::data = make_dimension<data_tag>
 < Represents a unit of concentration
using units::dimension::data_transfer_rate = dimension_divide<data, time>
 < Represents a unit of data size
template<class U>
using units::traits::dimension_of_t = typename units::detail::dimension_of_impl<U>::type
 Names the dimension_t of a conversion_factor.
template<class Unit, class Underlying>
using units::traits::replace_underlying_t = typename replace_underlying<Unit, Underlying>::type
template<ConversionFactorType Cf>
using units::inverse = typename detail::inverse_impl<Cf>::type
 represents the inverse unit type of class U.
template<ConversionFactorType Cf>
using units::squared = typename detail::squared_impl<Cf>::type
 represents the unit type of class U squared
template<ConversionFactorType Cf>
using units::cubed = typename detail::cubed_impl<Cf>::type
 represents the type of class U cubed.
template<RatioType Ratio, std::intmax_t Eps = 10000000000>
using units::ratio_sqrt = typename units::detail::Sqrt<Ratio, std::ratio<1, Eps>>::type
 Calculate square root of a ratio at compile-time.
template<ConversionFactorType Cf, std::intmax_t Eps = 10000000000>
using units::square_root = typename detail::sqrt_impl<Cf, Eps>::type
 represents the square root of type class U.
template<ConversionFactorType Cf, ConversionFactorType... Cfs>
using units::compound_conversion_factor = typename detail::compound_impl<Cf, Cfs...>::type
 Represents a conversion factor made up from other conversion factors.
template<class T>
using units::detail::unit_base_t = unit<typename T::conversion_factor, typename T::underlying_type, typename T::numerical_scale_type>
 Maps any unit type to the canonical unit<Cf, Underlying, Scale> it represents.
template<class Base, class Named>
using units::detail::rewrap_named_t = typename rewrap_named<Base, Named>::type
using units::dimensionless_ = conversion_factor<std::ratio<1>, dimension::dimensionless>
template<class Underlying = double>
using units::dimensionless = unit<traits::strong_t<conversion_factor<std::ratio<1>, dimension::dimensionless>>, Underlying, linear_scale>
template<class Underlying>
using units::dBi = decibels<Underlying>
template<ConversionFactorType Cf>
using units::atto = typename detail::prefix<std::atto,Cf>::type
template<ConversionFactorType Cf>
using units::femto = typename detail::prefix<std::femto,Cf>::type
 < Represents the type of class Cf with the metric 'atto' prefix appended.
template<ConversionFactorType Cf>
using units::pico = typename detail::prefix<std::pico,Cf>::type
 < Represents the type of class Cf with the metric 'femto' prefix appended.
template<ConversionFactorType Cf>
using units::nano = typename detail::prefix<std::nano,Cf>::type
 < Represents the type of class Cf with the metric 'pico' prefix appended.
template<ConversionFactorType Cf>
using units::micro = typename detail::prefix<std::micro,Cf>::type
 < Represents the type of class Cf with the metric 'nano' prefix appended.
template<ConversionFactorType Cf>
using units::milli = typename detail::prefix<std::milli,Cf>::type
 < Represents the type of class Cf with the metric 'micro' prefix appended.
template<ConversionFactorType Cf>
using units::centi = typename detail::prefix<std::centi,Cf>::type
 < Represents the type of class Cf with the metric 'milli' prefix appended.
template<ConversionFactorType Cf>
using units::deci = typename detail::prefix<std::deci,Cf>::type
 < Represents the type of class Cf with the metric 'centi' prefix appended.
template<ConversionFactorType Cf>
using units::deca = typename detail::prefix<std::deca,Cf>::type
 < Represents the type of class Cf with the metric 'deci' prefix appended.
template<ConversionFactorType Cf>
using units::hecto = typename detail::prefix<std::hecto,Cf>::type
 < Represents the type of class Cf with the metric 'deca' prefix appended.
template<ConversionFactorType Cf>
using units::kilo = typename detail::prefix<std::kilo,Cf>::type
 < Represents the type of class Cf with the metric 'hecto' prefix appended.
template<ConversionFactorType Cf>
using units::mega = typename detail::prefix<std::mega,Cf>::type
 < Represents the type of class Cf with the metric 'kilo' prefix appended.
template<ConversionFactorType Cf>
using units::giga = typename detail::prefix<std::giga,Cf>::type
 < Represents the type of class Cf with the metric 'mega' prefix appended.
template<ConversionFactorType Cf>
using units::tera = typename detail::prefix<std::tera,Cf>::type
 < Represents the type of class Cf with the metric 'giga' prefix appended.
template<ConversionFactorType Cf>
using units::peta = typename detail::prefix<std::peta,Cf>::type
 < Represents the type of class Cf with the metric 'tera' prefix appended.
template<ConversionFactorType Cf>
using units::exa = typename detail::prefix<std::exa, Cf>::type
 < Represents the type of class Cf with the metric 'peta' prefix appended.
template<ConversionFactorType Cf>
using units::kibi = typename detail::prefix<std::ratio<1024>, Cf>::type
 < Represents the type of class Cf with the metric 'exa' prefix appended.
template<ConversionFactorType Cf>
using units::mebi = typename detail::prefix<std::ratio<1048576>, Cf>::type
 < Represents the type of class Cf with the binary 'kibi' prefix appended.
template<ConversionFactorType Cf>
using units::gibi = typename detail::prefix<std::ratio<1073741824>, Cf>::type
 < Represents the type of class Cf with the binary 'mibi' prefix appended.
template<ConversionFactorType Cf>
using units::tebi = typename detail::prefix<std::ratio<1099511627776>, Cf>::type
 < Represents the type of class Cf with the binary 'gibi' prefix appended.
template<ConversionFactorType Cf>
using units::pebi = typename detail::prefix<std::ratio<1125899906842624>, Cf>::type
 < Represents the type of class Cf with the binary 'tebi' prefix appended.
template<ConversionFactorType Cf>
using units::exbi = typename detail::prefix<std::ratio<1152921504606846976>, Cf>::type
 < Represents the type of class Cf with the binary 'pebi' prefix appended.

Enumerations

enum class  units::detail::label_form { abbreviation , name , base }
 Builds the unit-label suffix for a unit — the text that follows its numeric value. More...

Functions

template<typename T>
requires std::is_arithmetic_v<T>
std::string units::detail::to_string (const T &t)
template<class ConversionFactor>
ConversionFactor units::detail::strong_name (ConversionFactor *,...)
 ADL customization point that maps a conversion_factor to its friendly strong type.
constexpr int units::const_strcmp (const char *lhs, const char *rhs)
template<ArithmeticType T>
constexpr detail::floating_point_promotion_t< T > units::sqrt (T x_)
template<signed long long Exp, ArithmeticType B>
constexpr detail::floating_point_promotion_t< B > units::pow (B base) noexcept
template<ArithmeticType T1, ArithmeticType T2>
requires std::is_unsigned_v<T2>
constexpr detail::floating_point_promotion_t< T1 > units::pow (T1 x, T2 y) noexcept
template<ArithmeticType T1, ArithmeticType T2>
requires std::is_signed_v<T2>
constexpr detail::floating_point_promotion_t< T1 > units::pow (T1 x, T2 y) noexcept
template<ArithmeticType T>
constexpr T units::abs (T x)
template<ConversionFactorType ConversionFactorFrom, ConversionFactorType ConversionFactorTo, ArithmeticType To = double, ArithmeticType From>
requires (traits::is_same_dimension_conversion_factor_v<ConversionFactorFrom, ConversionFactorTo>)
constexpr To units::convert (const From &value) noexcept
 converts a value from an unit to another.
template<UnitType UnitTo, UnitType UnitFrom>
requires same_dimension<UnitFrom, UnitTo>
constexpr UnitTo units::convert (const UnitFrom &from) noexcept
 converts an unit to another unit.
template<class ConversionFactor, class Scale>
void units::detail::named_class_of (ConversionFactor *, Scale *,...)
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.
template<class D, class E>
std::string units::detail::dimension_to_string (const dim< D, E > &)
 Renders a single dimension term (base dimension + exponent) as text.
template<class... Dims>
std::string units::detail::dimension_to_string (const dimension_t< Dims... > &)
 Renders a full dimension list as text by concatenating each term.
template<label_form Form = label_form::abbreviation, ConversionFactorType ConversionFactor, ArithmeticType T, NumericalScaleType< T > NumericalScale>
std::string units::detail::unit_label (const unit< ConversionFactor, T, NumericalScale > &)
template<ConversionFactorType ConversionFactor, ArithmeticType T, NumericalScaleType< T > NumericalScale>
constexpr bool units::detail::label_uses_base_unit ()
 Whether a unit's label is its dimension list rather than a named abbreviation.
template<class D, class E>
std::ostream & units::operator<< (std::ostream &os, const dim< D, E > &)
template<class... Dims>
std::ostream & units::operator<< (std::ostream &os, const dimension_t< Dims... > &)
template<ConversionFactorType ConversionFactor, ArithmeticType T, NumericalScaleType< T > NumericalScale>
std::ostream & units::operator<< (std::ostream &os, const unit< ConversionFactor, T, NumericalScale > &obj)
template<ConversionFactorType ConversionFactor, ArithmeticType T, NumericalScaleType< T > NumericalScale>
std::string units::to_string (const unit< ConversionFactor, T, NumericalScale > &obj)
template<ArithmeticType T, UnitType Unit>
constexpr T units::unit_cast (const Unit &value) noexcept
 Casts an unit to an arithmetic type.
conversion_factor< std::ratio< 1 >, dimension::dimensionless > units::detail::strong_name (units::detail::conversion_factor_base_t< dimensionless_ > *)
template<UnitType UnitTypeLhs>
requires (!traits::is_affine_unit_v<UnitTypeLhs>)
constexpr UnitTypeLhs & units::operator+= (UnitTypeLhs &lhs, const detail::type_identity_t< UnitTypeLhs > &rhs) noexcept
template<UnitType UnitTypeLhs>
requires (traits::is_affine_unit_v<UnitTypeLhs>)
constexpr UnitTypeLhs & units::operator+= (UnitTypeLhs &lhs, const detail::type_identity_t< UnitTypeLhs > &rhs) noexcept
 Compound addition for AFFINE units (e.g.
template<UnitType UnitTypeLhs, ArithmeticType T>
requires (!RatioDimensionlessUnitType<UnitTypeLhs>)
constexpr UnitTypeLhs & units::operator+= (UnitTypeLhs &lhs, T rhs) noexcept
template<RatioDimensionlessUnitType U, ArithmeticType T>
requires (traits::has_linear_scale_v<U>)
constexpr U & units::operator+= (U &lhs, T rhs) noexcept
template<RatioDimensionlessUnitType U, DimensionlessUnitType D>
requires (traits::has_linear_scale_v<U, D> && !RatioDimensionlessUnitType<D>)
constexpr U & units::operator+= (U &lhs, const D &rhs) noexcept
template<RatioDimensionlessUnitType U, ArithmeticType T>
requires (traits::has_linear_scale_v<U>)
constexpr U & units::operator-= (U &lhs, T rhs) noexcept
template<UnitType UnitTypeLhs>
requires (!traits::is_affine_unit_v<UnitTypeLhs>)
constexpr UnitTypeLhs & units::operator-= (UnitTypeLhs &lhs, const detail::type_identity_t< UnitTypeLhs > &rhs) noexcept
template<UnitType UnitTypeLhs>
requires (traits::is_affine_unit_v<UnitTypeLhs>)
constexpr UnitTypeLhs & units::operator-= (UnitTypeLhs &lhs, const detail::type_identity_t< UnitTypeLhs > &rhs) noexcept
 Compound subtraction for AFFINE units (e.g.
template<UnitType UnitTypeLhs, ArithmeticType T>
requires (!RatioDimensionlessUnitType<UnitTypeLhs>)
constexpr UnitTypeLhs & units::operator-= (UnitTypeLhs &lhs, const T &rhs) noexcept
template<RatioDimensionlessUnitType U, DimensionlessUnitType D>
requires (traits::has_linear_scale_v<U, D> && !RatioDimensionlessUnitType<D>)
constexpr U & units::operator-= (U &lhs, const D &rhs) noexcept
template<UnitType UnitTypeLhs, ArithmeticType T>
requires (!RatioDimensionlessUnitType<UnitTypeLhs>)
constexpr UnitTypeLhs & units::operator*= (UnitTypeLhs &lhs, const T &rhs)
template<RatioDimensionlessUnitType U, RatioDimensionlessUnitType URhs>
requires (traits::has_linear_scale_v<U, URhs>)
constexpr U & units::operator*= (U &lhs, const URhs &rhs) noexcept
template<RatioDimensionlessUnitType U>
requires (units::traits::has_linear_scale_v<U>)
constexpr U & units::operator*= (U &lhs, const U &rhs) noexcept
template<RatioDimensionlessUnitType U, units::ArithmeticType T>
requires (units::traits::has_linear_scale_v<U>)
constexpr U & units::operator*= (U &lhs, T rhs) noexcept
template<RatioDimensionlessUnitType U, DimensionlessUnitType D>
requires (units::traits::has_linear_scale_v<U, D> && !RatioDimensionlessUnitType<D>)
constexpr U & units::operator*= (U &lhs, const D &rhs) noexcept
template<UnitType UnitTypeLhs, DimensionlessUnitType D>
requires (!RatioDimensionlessUnitType<UnitTypeLhs>)
constexpr UnitTypeLhs & units::operator*= (UnitTypeLhs &lhs, const D &rhs)
template<UnitType UnitTypeLhs, ArithmeticType T>
requires (!RatioDimensionlessUnitType<UnitTypeLhs>)
constexpr UnitTypeLhs & units::operator/= (UnitTypeLhs &lhs, const T &rhs)
template<UnitType UnitTypeLhs, DimensionlessUnitType D>
requires (!RatioDimensionlessUnitType<UnitTypeLhs>)
constexpr UnitTypeLhs & units::operator/= (UnitTypeLhs &lhs, const D &rhs)
template<RatioDimensionlessUnitType U, RatioDimensionlessUnitType URhs>
requires (traits::has_linear_scale_v<U, URhs>)
constexpr U & units::operator/= (U &lhs, const URhs &rhs) noexcept
template<RatioDimensionlessUnitType U>
requires (units::traits::has_linear_scale_v<U>)
constexpr U & units::operator/= (U &lhs, const U &rhs) noexcept
template<RatioDimensionlessUnitType U, units::ArithmeticType T>
requires (units::traits::has_linear_scale_v<U>)
constexpr U & units::operator/= (U &lhs, T rhs) noexcept
template<RatioDimensionlessUnitType U, DimensionlessUnitType D>
requires (units::traits::has_linear_scale_v<U, D> && !RatioDimensionlessUnitType<D>)
constexpr U & units::operator/= (U &lhs, const D &rhs) noexcept
template<DimensionedUnitType UnitTypeLhs>
requires (!RatioDimensionlessUnitType<UnitTypeLhs>)
constexpr UnitTypeLhs & units::operator%= (UnitTypeLhs &lhs, const detail::type_identity_t< UnitTypeLhs > &rhs) noexcept
template<DimensionlessUnitType UnitTypeLhs, DimensionlessUnitType UnitTypeRhs>
requires (!(RatioDimensionlessUnitType<UnitTypeLhs> || RatioDimensionlessUnitType<UnitTypeRhs>))
constexpr UnitTypeLhs & units::operator%= (UnitTypeLhs &lhs, const UnitTypeRhs &rhs) noexcept
template<UnitType UnitTypeLhs>
requires (!RatioDimensionlessUnitType<UnitTypeLhs>)
constexpr UnitTypeLhs & units::operator%= (UnitTypeLhs &lhs, const typename UnitTypeLhs::underlying_type &rhs) noexcept
template<RatioDimensionlessUnitType U>
requires (traits::has_linear_scale_v<U>)
constexpr U & units::operator%= (U &lhs, const U &rhs) noexcept
template<RatioDimensionlessUnitType U>
requires (traits::has_linear_scale_v<U>)
constexpr U & units::operator%= (U &lhs, const typename U::underlying_type &rhs) noexcept
template<RatioDimensionlessUnitType U, DimensionlessUnitType D>
requires (traits::has_linear_scale_v<U, D> && !RatioDimensionlessUnitType<D>)
constexpr U & units::operator%= (U &lhs, const D &rhs) noexcept
template<UnitType UnitTypeLhs>
constexpr UnitTypeLhs units::operator+ (const UnitTypeLhs &u) noexcept
template<UnitType UnitTypeLhs>
constexpr UnitTypeLhs & units::operator++ (UnitTypeLhs &u) noexcept
template<UnitType UnitTypeLhs>
constexpr UnitTypeLhs units::operator++ (UnitTypeLhs &u, int) noexcept
template<UnitType UnitTypeLhs>
constexpr UnitTypeLhs units::operator- (const UnitTypeLhs &u) noexcept
template<UnitType UnitTypeLhs>
constexpr UnitTypeLhs & units::operator-- (UnitTypeLhs &u) noexcept
template<UnitType UnitTypeLhs>
constexpr UnitTypeLhs units::operator-- (UnitTypeLhs &u, int) noexcept
template<UnitType UnitTypeLhs, UnitType UnitTypeRhs>
requires (same_dimension<UnitTypeLhs, UnitTypeRhs> && traits::has_linear_scale_v<UnitTypeLhs, UnitTypeRhs> &&
!traits::is_affine_unit_v<UnitTypeLhs> && !traits::is_affine_unit_v<UnitTypeRhs>)
constexpr auto units::operator+ (const UnitTypeLhs &lhs, const UnitTypeRhs &rhs) noexcept
 Addition operator for unit types with a linear_scale.
template<RatioDimensionlessUnitType U, ArithmeticType T>
requires (traits::has_linear_scale_v<U>)
constexpr auto units::operator+ (const U &lhs, T rhs) noexcept -> traits::replace_underlying_t< U, detail::floating_point_promotion_t< std::common_type_t< typename U::underlying_type, T > > >
 Addition template for ratio-like dimensionless units (concentrations, etc).
template<RatioDimensionlessUnitType U, ArithmeticType T>
requires (traits::has_linear_scale_v<U>)
constexpr auto units::operator+ (T lhs, const U &rhs) noexcept -> traits::replace_underlying_t< U, detail::floating_point_promotion_t< std::common_type_t< T, typename U::underlying_type > > >
template<DimensionlessUnitType UnitTypeLhs, ArithmeticType T>
requires (traits::has_linear_scale_v<UnitTypeLhs> && !RatioDimensionlessUnitType<UnitTypeLhs> && !RatioDimensionlessUnitType
<UnitTypeLhs>)
constexpr traits::replace_underlying_t< UnitTypeLhs, std::common_type_t< typename UnitTypeLhs::underlying_type, T > > units::operator+ (const UnitTypeLhs &lhs, T rhs) noexcept
 Addition operator for dimensionless unit types with a linear_scale.
template<DimensionlessUnitType UnitTypeRhs, ArithmeticType T>
requires (traits::has_linear_scale_v<UnitTypeRhs> && !RatioDimensionlessUnitType<UnitTypeRhs>)
constexpr traits::replace_underlying_t< UnitTypeRhs, std::common_type_t< T, typename UnitTypeRhs::underlying_type > > units::operator+ (T lhs, const UnitTypeRhs &rhs) noexcept
 Addition operator for dimensionless unit types with a linear_scale.
template<UnitType UnitTypeLhs, UnitType UnitTypeRhs>
requires (same_dimension<UnitTypeLhs, UnitTypeRhs> && traits::has_linear_scale_v<UnitTypeLhs, UnitTypeRhs> &&
!traits::is_affine_unit_v<UnitTypeLhs> && !traits::is_affine_unit_v<UnitTypeRhs>)
constexpr auto units::operator- (const UnitTypeLhs &lhs, const UnitTypeRhs &rhs) noexcept
 Subtraction operator for NON-AFFINE unit types with a linear_scale.
template<UnitType UnitTypeLhs, UnitType UnitTypeRhs>
requires (same_dimension<UnitTypeLhs, UnitTypeRhs> && traits::has_linear_scale_v<UnitTypeLhs, UnitTypeRhs> &&
(traits::is_affine_unit_v<UnitTypeLhs> || traits::is_affine_unit_v<UnitTypeRhs>))
constexpr auto units::operator- (const UnitTypeLhs &lhs, const UnitTypeRhs &rhs) noexcept
 Subtraction operator for AFFINE unit types (e.g.
template<DimensionlessUnitType UnitTypeLhs, ArithmeticType T>
requires (traits::has_linear_scale_v<UnitTypeLhs> && !RatioDimensionlessUnitType<UnitTypeLhs>)
constexpr traits::replace_underlying_t< UnitTypeLhs, std::common_type_t< typename UnitTypeLhs::underlying_type, T > > units::operator- (const UnitTypeLhs &lhs, T rhs) noexcept
 Subtraction operator for dimensionless unit types with a linear_scale.
template<RatioDimensionlessUnitType U, ArithmeticType T>
requires (traits::has_linear_scale_v<U>)
constexpr auto units::operator- (const U &lhs, T rhs) noexcept -> traits::replace_underlying_t< U, detail::floating_point_promotion_t< std::common_type_t< typename U::underlying_type, T > > >
 Subtraction for ratio-like dimensionless units.
template<RatioDimensionlessUnitType U, ArithmeticType T>
requires (traits::has_linear_scale_v<U>)
constexpr auto units::operator- (T lhs, const U &rhs) noexcept -> traits::replace_underlying_t< U, detail::floating_point_promotion_t< std::common_type_t< T, typename U::underlying_type > > >
template<DimensionlessUnitType UnitTypeRhs, ArithmeticType T>
requires (traits::has_linear_scale_v<UnitTypeRhs> && !RatioDimensionlessUnitType<UnitTypeRhs>)
constexpr traits::replace_underlying_t< UnitTypeRhs, std::common_type_t< T, typename UnitTypeRhs::underlying_type > > units::operator- (T lhs, const UnitTypeRhs &rhs) noexcept
 Subtraction operator for dimensionless unit types with a linear_scale.
template<UnitType UnitTypeLhs, UnitType UnitTypeRhs>
requires (same_dimension<UnitTypeLhs, UnitTypeRhs> && traits::has_linear_scale_v<UnitTypeLhs, UnitTypeRhs>)
constexpr auto units::operator* (const UnitTypeLhs &lhs, const UnitTypeRhs &rhs) noexcept -> detail::rewrap_to_named_t< unit< traits::strong_t< squared< typename traits::unit_traits< std::common_type_t< UnitTypeLhs, UnitTypeRhs > >::conversion_factor > >, typename std::common_type_t< UnitTypeLhs, UnitTypeRhs >::underlying_type > >
 Multiplication type for convertible unit types with a linear scale.
template<DimensionedUnitType UnitTypeLhs, DimensionedUnitType UnitTypeRhs>
requires (!same_dimension<UnitTypeLhs, UnitTypeRhs> && traits::has_linear_scale_v<UnitTypeLhs, UnitTypeRhs>)
constexpr auto units::operator* (const UnitTypeLhs &lhs, const UnitTypeRhs &rhs) noexcept -> detail::rewrap_to_named_t< unit< traits::strong_t< compound_conversion_factor< typename traits::unit_traits< UnitTypeLhs >::conversion_factor, typename traits::unit_traits< UnitTypeRhs >::conversion_factor > >, std::common_type_t< typename UnitTypeLhs::underlying_type, typename UnitTypeRhs::underlying_type > > >
 Multiplication type for non-convertible unit types with a linear scale.
template<DimensionedUnitType UnitTypeLhs, OrdinaryDimensionlessUnitType UnitTypeRhs>
requires (traits::has_linear_scale_v<UnitTypeLhs, UnitTypeRhs>)
constexpr traits::replace_underlying_t< UnitTypeLhs, std::common_type_t< typename UnitTypeLhs::underlying_type, typename UnitTypeRhs::underlying_type > > units::operator* (const UnitTypeLhs &lhs, const UnitTypeRhs &rhs) noexcept
 Multiplication by an ordinary dimensionless unit for unit types with a linear scale.
template<DimensionedUnitType UnitTypeLhs, RatioDimensionlessUnitType UnitTypeRhs>
requires (traits::has_linear_scale_v<UnitTypeLhs, UnitTypeRhs>)
constexpr traits::replace_underlying_t< UnitTypeLhs, std::common_type_t< typename UnitTypeLhs::underlying_type, typename UnitTypeRhs::underlying_type > > units::operator* (const UnitTypeLhs &lhs, const UnitTypeRhs &rhs) noexcept
 Multiplication by a ratio-dimensionless unit for unit types with a linear scale.
template<OrdinaryDimensionlessUnitType UnitTypeLhs, DimensionedUnitType UnitTypeRhs>
requires (traits::has_linear_scale_v<UnitTypeLhs, UnitTypeRhs>)
constexpr traits::replace_underlying_t< UnitTypeRhs, std::common_type_t< typename UnitTypeLhs::underlying_type, typename UnitTypeRhs::underlying_type > > units::operator* (const UnitTypeLhs &lhs, const UnitTypeRhs &rhs) noexcept
 Multiplication by an ordinary dimensionless unit for unit types with a linear scale.
template<RatioDimensionlessUnitType UnitTypeLhs, DimensionedUnitType UnitTypeRhs>
requires (traits::has_linear_scale_v<UnitTypeLhs, UnitTypeRhs>)
constexpr traits::replace_underlying_t< UnitTypeRhs, std::common_type_t< typename UnitTypeLhs::underlying_type, typename UnitTypeRhs::underlying_type > > units::operator* (const UnitTypeLhs &lhs, const UnitTypeRhs &rhs) noexcept
 ratio-dimensionless * dimensioned -> dimensioned (scalar multiply)
template<DimensionedUnitType UnitTypeLhs, ArithmeticType T>
requires (traits::has_linear_scale_v<UnitTypeLhs>)
constexpr traits::replace_underlying_t< UnitTypeLhs, std::common_type_t< typename UnitTypeLhs::underlying_type, T > > units::operator* (const UnitTypeLhs &lhs, T rhs) noexcept
 Multiplication by an arithmetic type for dimensioned unit types with a linear scale.
template<DimensionedUnitType UnitTypeRhs, ArithmeticType T>
requires (traits::has_linear_scale_v<UnitTypeRhs>)
constexpr traits::replace_underlying_t< UnitTypeRhs, std::common_type_t< T, typename UnitTypeRhs::underlying_type > > units::operator* (T lhs, const UnitTypeRhs &rhs) noexcept
 Multiplication by an arithmetic type for dimensioned unit types with a linear scale.
template<RatioDimensionlessUnitType U, units::ArithmeticType T>
requires (units::traits::has_linear_scale_v<U>)
constexpr units::dimensionless< units::detail::floating_point_promotion_t< std::common_type_t< T, typename U::underlying_type > > > units::operator* (T lhs, const U &rhs) noexcept
 scalar * ratio-dimensionless -> base dimensionless (PROMOTED)
template<RatioDimensionlessUnitType U, units::ArithmeticType T>
requires (units::traits::has_linear_scale_v<U>)
constexpr units::dimensionless< units::detail::floating_point_promotion_t< std::common_type_t< typename U::underlying_type, T > > > units::operator* (const U &lhs, T rhs) noexcept
 ratio-dimensionless * scalar -> base dimensionless (PROMOTED)
template<DimensionlessUnitType UnitTypeLhs, ArithmeticType T>
requires (traits::has_linear_scale_v<UnitTypeLhs> && !RatioDimensionlessUnitType<UnitTypeLhs>)
constexpr traits::replace_underlying_t< UnitTypeLhs, std::common_type_t< typename UnitTypeLhs::underlying_type, T > > units::operator* (const UnitTypeLhs &lhs, T rhs) noexcept
 Multiplication by an arithmetic type for dimensionless unit types with a linear scale.
template<DimensionlessUnitType UnitTypeRhs, ArithmeticType T>
requires (traits::has_linear_scale_v<UnitTypeRhs> && !RatioDimensionlessUnitType<UnitTypeRhs>)
constexpr traits::replace_underlying_t< UnitTypeRhs, std::common_type_t< T, typename UnitTypeRhs::underlying_type > > units::operator* (T lhs, const UnitTypeRhs &rhs) noexcept
 Multiplication by an arithmetic type for dimensionless unit types with a linear scale.
template<UnitType UnitTypeLhs, UnitType UnitTypeRhs>
requires ( same_dimension<UnitTypeLhs, UnitTypeRhs> && traits::has_linear_scale_v<UnitTypeLhs, UnitTypeRhs> &&
!RatioDimensionlessUnitType<UnitTypeLhs> && !RatioDimensionlessUnitType<UnitTypeRhs>)
constexpr dimensionless< std::common_type_t< typename UnitTypeLhs::underlying_type, typename UnitTypeRhs::underlying_type > > units::operator/ (const UnitTypeLhs &lhs, const UnitTypeRhs &rhs) noexcept
 Division for convertible unit types with a linear scale.
template<DimensionedUnitType UnitTypeLhs, DimensionedUnitType UnitTypeRhs>
requires (!same_dimension<UnitTypeLhs, UnitTypeRhs> && traits::has_linear_scale_v<UnitTypeLhs, UnitTypeRhs>)
constexpr auto units::operator/ (const UnitTypeLhs &lhs, const UnitTypeRhs &rhs) noexcept -> detail::rewrap_to_named_t< unit< traits::strong_t< compound_conversion_factor< typename traits::unit_traits< UnitTypeLhs >::conversion_factor, inverse< typename traits::unit_traits< UnitTypeRhs >::conversion_factor > > >, std::common_type_t< typename UnitTypeLhs::underlying_type, typename UnitTypeRhs::underlying_type > > >
 Division for non-convertible unit types with a linear scale.
template<DimensionedUnitType UnitTypeLhs, OrdinaryDimensionlessUnitType UnitTypeRhs>
requires (traits::has_linear_scale_v<UnitTypeLhs, UnitTypeRhs>)
constexpr traits::replace_underlying_t< UnitTypeLhs, std::common_type_t< typename UnitTypeLhs::underlying_type, typename UnitTypeRhs::underlying_type > > units::operator/ (const UnitTypeLhs &lhs, const UnitTypeRhs &rhs) noexcept
 Division by an ordinary dimensionless unit for unit types with a linear scale.
template<DimensionedUnitType UnitTypeLhs, RatioDimensionlessUnitType UnitTypeRhs>
requires (traits::has_linear_scale_v<UnitTypeLhs, UnitTypeRhs>)
constexpr traits::replace_underlying_t< UnitTypeLhs, std::common_type_t< typename UnitTypeLhs::underlying_type, typename UnitTypeRhs::underlying_type > > units::operator/ (const UnitTypeLhs &lhs, const UnitTypeRhs &rhs) noexcept
 Division by a ratio-dimensionless unit for unit types with a linear scale.
template<OrdinaryDimensionlessUnitType UnitTypeLhs, RatioDimensionlessUnitType UnitTypeRhs>
requires (traits::has_linear_scale_v<UnitTypeLhs, UnitTypeRhs>)
constexpr auto units::operator/ (const UnitTypeLhs &lhs, const UnitTypeRhs &rhs) noexcept -> detail::rewrap_to_named_t< unit< traits::strong_t< inverse< typename traits::unit_traits< UnitTypeRhs >::conversion_factor > >, std::common_type_t< typename UnitTypeLhs::underlying_type, typename UnitTypeRhs::underlying_type > > >
 Division of an ordinary dimensionless unit by a ratio-dimensionless unit.
template<OrdinaryDimensionlessUnitType UnitTypeLhs, DimensionedUnitType UnitTypeRhs>
requires (traits::has_linear_scale_v<UnitTypeLhs, UnitTypeRhs> && traits::is_dimensionless_unit_v<UnitTypeLhs>)
constexpr auto units::operator/ (const UnitTypeLhs &lhs, const UnitTypeRhs &rhs) noexcept -> detail::rewrap_to_named_t< unit< traits::strong_t< inverse< typename traits::unit_traits< UnitTypeRhs >::conversion_factor > >, std::common_type_t< typename UnitTypeLhs::underlying_type, typename UnitTypeRhs::underlying_type > > >
 Division of a dimensionless unit by a unit type with a linear scale.
template<RatioDimensionlessUnitType UnitTypeLhs, DimensionedUnitType UnitTypeRhs>
requires (traits::has_linear_scale_v<UnitTypeLhs, UnitTypeRhs>)
constexpr auto units::operator/ (const UnitTypeLhs &lhs, const UnitTypeRhs &rhs) noexcept -> unit< traits::strong_t< compound_conversion_factor< typename traits::unit_traits< UnitTypeLhs >::conversion_factor, inverse< typename traits::unit_traits< UnitTypeRhs >::conversion_factor > > >, std::common_type_t< typename UnitTypeLhs::underlying_type, typename UnitTypeRhs::underlying_type > >
 Division of a ratio-dimensionless unit (pct/ppm/ppb/...) by a dimensioned unit.
template<UnitType UnitTypeLhs, ArithmeticType T>
requires (traits::has_linear_scale_v<UnitTypeLhs> && !RatioDimensionlessUnitType<UnitTypeLhs>)
constexpr traits::replace_underlying_t< UnitTypeLhs, std::common_type_t< typename UnitTypeLhs::underlying_type, T > > units::operator/ (const UnitTypeLhs &lhs, T rhs) noexcept
 Division by a dimensionless for unit types with a linear scale.
template<UnitType UnitTypeRhs, ArithmeticType T>
requires (traits::has_linear_scale_v<UnitTypeRhs> && !RatioDimensionlessUnitType<UnitTypeRhs>)
constexpr auto units::operator/ (T lhs, const UnitTypeRhs &rhs) noexcept -> detail::rewrap_to_named_t< unit< traits::strong_t< inverse< typename traits::unit_traits< UnitTypeRhs >::conversion_factor > >, std::common_type_t< T, typename UnitTypeRhs::underlying_type > > >
 Division of a dimensionless by a unit type with a linear scale.
template<RatioDimensionlessUnitType U, ArithmeticType T>
requires (traits::has_linear_scale_v<U>)
constexpr traits::replace_underlying_t< U, std::common_type_t< typename U::underlying_type, T > > units::operator/ (const U &lhs, T rhs) noexcept
 Division of ratio-like dimensionless units with arithmetic types.
template<RatioDimensionlessUnitType U, ArithmeticType T>
requires (traits::has_linear_scale_v<U>)
constexpr units::dimensionless< detail::floating_point_promotion_t< std::common_type_t< T, typename U::underlying_type > > > units::operator/ (T lhs, const U &rhs) noexcept
template<RatioDimensionlessUnitType U1, RatioDimensionlessUnitType U2>
requires (traits::has_linear_scale_v<U1, U2>)
constexpr dimensionless< detail::floating_point_promotion_t< std::common_type_t< typename U1::underlying_type, typename U2::underlying_type > > > units::operator/ (const U1 &lhs, const U2 &rhs) noexcept
template<DimensionedUnitType UnitTypeLhs, DimensionedUnitType UnitTypeRhs>
requires (same_dimension<UnitTypeLhs, UnitTypeRhs> && traits::has_linear_scale_v<UnitTypeLhs, UnitTypeRhs>)
constexpr std::common_type_t< UnitTypeLhs, UnitTypeRhs > units::operator% (const UnitTypeLhs &lhs, const UnitTypeRhs &rhs) noexcept
 Modulo for convertible unit types with a linear scale.
template<DimensionedUnitType UnitTypeLhs, DimensionlessUnitType UnitTypeRhs>
requires (traits::has_linear_scale_v<UnitTypeLhs, UnitTypeRhs>)
constexpr traits::replace_underlying_t< UnitTypeLhs, std::common_type_t< typename UnitTypeLhs::underlying_type, typename UnitTypeRhs::underlying_type > > units::operator% (const UnitTypeLhs &lhs, const UnitTypeRhs &rhs) noexcept
 Modulo by a dimensionless for unit types with a linear scale.
template<DimensionlessUnitType UnitTypeLhs, DimensionlessUnitType UnitTypeRhs>
requires (same_dimension<UnitTypeLhs, UnitTypeRhs> && traits::has_linear_scale_v<UnitTypeLhs, UnitTypeRhs>)
constexpr traits::replace_underlying_t< UnitTypeLhs, typename std::common_type_t< UnitTypeLhs, UnitTypeRhs >::underlying_type > units::operator% (const UnitTypeLhs &lhs, const UnitTypeRhs &rhs) noexcept
 Modulo for two dimensionless unit types with a linear scale.
template<UnitType UnitTypeLhs, ArithmeticType T>
requires (traits::has_linear_scale_v<UnitTypeLhs> && !RatioDimensionlessUnitType<UnitTypeLhs>)
constexpr traits::replace_underlying_t< UnitTypeLhs, std::common_type_t< typename UnitTypeLhs::underlying_type, T > > units::operator% (const UnitTypeLhs &lhs, const T &rhs) noexcept
 Modulo by an arithmetic type for unit types with a linear scale.
template<RatioDimensionlessUnitType U>
requires (traits::has_linear_scale_v<U>)
constexpr U units::operator% (const U &lhs, const U &rhs) noexcept
template<RatioDimensionlessUnitType U, ArithmeticType T>
requires (traits::has_linear_scale_v<U>)
constexpr U units::operator% (const U &lhs, T rhs) noexcept
template<RatioDimensionlessUnitType U, ArithmeticType T>
requires (traits::has_linear_scale_v<U>)
constexpr U units::operator% (T lhs, const U &rhs) noexcept
template<DimensionlessUnitType UnitTypeRhs, ArithmeticType T>
constexpr bool units::operator== (const T &lhs, const UnitTypeRhs &rhs) noexcept
template<DimensionlessUnitType UnitTypeLhs, ArithmeticType T>
constexpr bool units::operator== (const UnitTypeLhs &lhs, const T &rhs) noexcept
template<DimensionlessUnitType UnitTypeRhs, ArithmeticType T>
requires (traits::is_dimensionless_unit_v<UnitTypeRhs> && std::is_arithmetic_v<T>)
constexpr bool units::operator!= (const T &lhs, const UnitTypeRhs &rhs) noexcept
template<DimensionlessUnitType UnitTypeLhs, ArithmeticType T>
constexpr bool units::operator!= (const UnitTypeLhs &lhs, const T &rhs) noexcept
template<DimensionlessUnitType UnitTypeRhs, ArithmeticType T>
requires (traits::is_dimensionless_unit_v<UnitTypeRhs> && std::is_arithmetic_v<T>)
constexpr bool units::operator>= (const T &lhs, const UnitTypeRhs &rhs) noexcept
template<DimensionlessUnitType UnitTypeLhs, ArithmeticType T>
constexpr bool units::operator>= (const UnitTypeLhs &lhs, const T &rhs) noexcept
template<DimensionlessUnitType UnitTypeRhs, ArithmeticType T>
constexpr bool units::operator> (const T &lhs, const UnitTypeRhs &rhs) noexcept
template<DimensionlessUnitType UnitTypeLhs, ArithmeticType T>
constexpr bool units::operator> (const UnitTypeLhs &lhs, const T &rhs) noexcept
template<DimensionlessUnitType UnitTypeRhs, ArithmeticType T>
constexpr bool units::operator<= (const T &lhs, const UnitTypeRhs &rhs) noexcept
template<DimensionlessUnitType UnitTypeLhs, ArithmeticType T>
constexpr bool units::operator<= (const UnitTypeLhs &lhs, const T &rhs) noexcept
template<DimensionlessUnitType UnitTypeRhs, ArithmeticType T>
constexpr bool units::operator< (const T &lhs, const UnitTypeRhs &rhs) noexcept
template<DimensionlessUnitType UnitTypeLhs, ArithmeticType T>
constexpr bool units::operator< (const UnitTypeLhs &lhs, const T &rhs) noexcept
template<int power, UnitType UnitType>
requires (traits::has_linear_scale_v<UnitType>)
constexpr auto units::pow (const UnitType &value) noexcept -> detail::rewrap_to_named_t< unit< traits::strong_t< typename units::detail::power_of_unit< power, typename units::traits::unit_traits< UnitType >::conversion_factor >::type >, detail::floating_point_promotion_t< typename units::traits::unit_traits< UnitType >::underlying_type >, linear_scale > >
 computes the value of value raised to the power
template<class Arg>
requires ::std::is_arithmetic_v< Arg > units::decibels (Arg) -> decibels< Arg >
 Deduction guide so the BARE name works (no <>): decibels x(5.0) / constexpr decibels c(3e8) deduces.
 units::decibels () -> decibels< double >
 Nullary guide so bare default-construction decibels{} / decibels() deduces decibels<default> — again a.
template<class OtherUnit>
requires (::units::traits::is_unit<OtherUnit>::value && ::units::traits::is_same_dimension_unit_v<OtherUnit, ::units::unit
<traits::strong_t<dimensionless_>, typename ::units::traits::unit_traits<OtherUnit>::underlying_type,
::units::decibel_scale>>)
 units::decibels (const OtherUnit &) -> decibels<::units::detail::deduced_named_underlying_t< OtherUnit, traits::strong_t< dimensionless_ >, ::units::decibel_scale > >
 And from another same-dimension UNIT (bare): decibels x(otherUnit) deduces the underlying the converting.
template<class Rep, class Period>
 units::decibels (const ::std::chrono::duration< Rep, Period > &) -> decibels< double >
 And from a std::chrono::duration (bare, for time units): nanoseconds n(chrono::nanoseconds(10)) deduces.
template<class Underlying>
std::ostream & units::operator<< (std::ostream &os, const decibels< Underlying > &obj)
::units::decibels< double > units::detail::named_class_of (typename ::units::decibels<>::conversion_factor *, typename ::units::decibels<>::numerical_scale_type *)
constexpr decibels< double > units::literals::operator""_dB (long double d) noexcept
template<DimensionedUnitType UnitTypeLhs, DimensionedUnitType UnitTypeRhs>
requires (same_dimension<UnitTypeLhs, UnitTypeRhs> && traits::has_decibel_scale_v<UnitTypeLhs, UnitTypeRhs>)
auto units::operator+ (const UnitTypeLhs &lhs, const UnitTypeRhs &rhs) noexcept=delete
 Addition of two absolute decibel LEVELS (both dimensioned, same dimension — e.g.
template<DimensionlessUnitType UnitTypeLhs, DimensionlessUnitType UnitTypeRhs>
requires (traits::has_decibel_scale_v<UnitTypeLhs, UnitTypeRhs>)
constexpr std::common_type_t< UnitTypeLhs, UnitTypeRhs > units::operator+ (const UnitTypeLhs &lhs, const UnitTypeRhs &rhs) noexcept
 Addition of two dimensionless decibel GAINS (dB + dB).
template<DimensionedUnitType UnitTypeLhs, DimensionlessUnitType UnitTypeRhs>
requires (traits::has_decibel_scale_v<UnitTypeLhs, UnitTypeRhs>)
constexpr traits::replace_underlying_t< UnitTypeLhs, std::common_type_t< typename UnitTypeLhs::underlying_type, typename UnitTypeRhs::underlying_type > > units::operator+ (const UnitTypeLhs &lhs, const UnitTypeRhs &rhs) noexcept
 Addition between unit types with a decibel_scale and dimensionless dB units.
template<DimensionlessUnitType UnitTypeLhs, DimensionedUnitType UnitTypeRhs>
requires (traits::has_decibel_scale_v<UnitTypeLhs, UnitTypeRhs>)
constexpr traits::replace_underlying_t< UnitTypeRhs, std::common_type_t< typename UnitTypeLhs::underlying_type, typename UnitTypeRhs::underlying_type > > units::operator+ (const UnitTypeLhs &lhs, const UnitTypeRhs &rhs) noexcept
 Addition between unit types with a decibel_scale and dimensionless dB units.
template<UnitType UnitTypeLhs, UnitType UnitTypeRhs>
requires (same_dimension<UnitTypeLhs, UnitTypeRhs> && traits::has_decibel_scale_v<UnitTypeLhs, UnitTypeRhs>)
constexpr auto units::operator- (const UnitTypeLhs &lhs, const UnitTypeRhs &rhs) noexcept -> decibels< typename std::common_type_t< UnitTypeLhs, UnitTypeRhs >::underlying_type >
 Subtraction for convertible unit types with a decibel_scale.
template<DimensionedUnitType UnitTypeLhs, DimensionlessUnitType UnitTypeRhs>
requires (traits::has_decibel_scale_v<UnitTypeLhs, UnitTypeRhs>)
constexpr traits::replace_underlying_t< UnitTypeLhs, std::common_type_t< typename UnitTypeLhs::underlying_type, typename UnitTypeRhs::underlying_type > > units::operator- (const UnitTypeLhs &lhs, const UnitTypeRhs &rhs) noexcept
 Subtraction between unit types with a decibel_scale and dimensionless dB units.
template<DimensionlessUnitType UnitTypeLhs, DimensionedUnitType UnitTypeRhs>
requires (traits::has_decibel_scale_v<UnitTypeLhs, UnitTypeRhs>)
constexpr auto units::operator- (const UnitTypeLhs &lhs, const UnitTypeRhs &rhs) noexcept -> detail::rewrap_to_named_t< unit< traits::strong_t< inverse< typename traits::unit_traits< UnitTypeRhs >::conversion_factor > >, std::common_type_t< typename UnitTypeLhs::underlying_type, typename UnitTypeRhs::underlying_type >, decibel_scale > >
 Subtraction between unit types with a decibel_scale and dimensionless dB units.
template<UnitType UnitTypeLhs, UnitType UnitTypeRhs>
requires (same_dimension<UnitTypeLhs, UnitTypeRhs>)
constexpr std::common_type_t< UnitTypeLhs, UnitTypeRhs > units::min (const UnitTypeLhs &lhs, const UnitTypeRhs &rhs)
template<UnitType UnitTypeLhs, UnitType UnitTypeRhs>
requires (same_dimension<UnitTypeLhs, UnitTypeRhs>)
constexpr std::common_type_t< UnitTypeLhs, UnitTypeRhs > units::max (const UnitTypeLhs &lhs, const UnitTypeRhs &rhs)
template<DimensionlessUnitType UnitType>
constexpr dimensionless< detail::floating_point_promotion_t< typename UnitType::underlying_type > > units::exp (const UnitType x) noexcept
 Compute exponential function.
template<DimensionlessUnitType UnitType>
constexpr dimensionless< detail::floating_point_promotion_t< typename UnitType::underlying_type > > units::log (const UnitType x) noexcept
 Compute natural logarithm.
template<DimensionlessUnitType UnitType>
constexpr dimensionless< detail::floating_point_promotion_t< typename UnitType::underlying_type > > units::log10 (const UnitType x) noexcept
 Compute common logarithm.
template<DimensionlessUnitType UnitType>
constexpr dimensionless< detail::floating_point_promotion_t< typename UnitType::underlying_type > > units::modf (const UnitType x, UnitType *intpart) noexcept
 Break into fractional and integral parts.
template<DimensionlessUnitType UnitType>
constexpr dimensionless< detail::floating_point_promotion_t< typename UnitType::underlying_type > > units::exp2 (const UnitType x) noexcept
 Compute binary exponential function.
template<DimensionlessUnitType UnitType>
constexpr dimensionless< detail::floating_point_promotion_t< typename UnitType::underlying_type > > units::expm1 (const UnitType x) noexcept
 Compute exponential minus one.
template<DimensionlessUnitType UnitType>
constexpr dimensionless< detail::floating_point_promotion_t< typename UnitType::underlying_type > > units::log1p (const UnitType x) noexcept
 Compute logarithm plus one.
template<DimensionlessUnitType UnitType>
constexpr dimensionless< detail::floating_point_promotion_t< typename UnitType::underlying_type > > units::log2 (const UnitType x) noexcept
 Compute binary logarithm.
template<UnitType UnitType>
requires (traits::has_linear_scale_v<UnitType>)
constexpr auto units::sqrt (const UnitType &value) noexcept -> detail::rewrap_to_named_t< unit< traits::strong_t< square_root< typename traits::unit_traits< UnitType >::conversion_factor > >, detail::floating_point_promotion_t< typename traits::unit_traits< UnitType >::underlying_type > > >
 computes the square root of value
template<UnitType UnitTypeLhs, UnitType UnitTypeRhs>
requires (same_dimension<UnitTypeLhs, UnitTypeRhs> && traits::has_linear_scale_v<UnitTypeLhs, UnitTypeRhs>)
constexpr detail::floating_point_promotion_t< std::common_type_t< UnitTypeLhs, UnitTypeRhs > > units::hypot (const UnitTypeLhs &x, const UnitTypeRhs &y)
 Computes the square root of the sum-of-squares of x and y.
template<UnitType Unit>
constexpr detail::floating_point_promotion_t< Unit > units::ceil (const Unit x) noexcept
 Round up value.
template<UnitType Unit>
constexpr detail::floating_point_promotion_t< Unit > units::floor (const Unit x) noexcept
 Round down value.
template<UnitType UnitTypeLhs, UnitType UnitTypeRhs>
requires (same_dimension<UnitTypeLhs, UnitTypeRhs>)
constexpr detail::floating_point_promotion_t< std::common_type_t< UnitTypeLhs, UnitTypeRhs > > units::fmod (const UnitTypeLhs numer, const UnitTypeRhs denom) noexcept
 Compute remainder of division.
template<UnitType UnitType>
constexpr detail::floating_point_promotion_t< UnitType > units::trunc (const UnitType x) noexcept
 Truncate value.
template<UnitType UnitType>
constexpr detail::floating_point_promotion_t< UnitType > units::round (const UnitType x) noexcept
 Round to nearest.
template<class To, UnitType From>
requires detail::is_roundable_unit_conversion<To, From>
constexpr To units::floor (const From &x) noexcept
 Convert to a coarser integral unit, rounding down (toward negative infinity).
template<class To, UnitType From>
requires detail::is_roundable_unit_conversion<To, From>
constexpr To units::ceil (const From &x) noexcept
 Convert to a coarser integral unit, rounding up (toward positive infinity).
template<class To, UnitType From>
requires detail::is_roundable_unit_conversion<To, From>
constexpr To units::round (const From &x) noexcept
 Convert to a coarser integral unit, rounding to nearest (halfway away from zero).
template<class To, UnitType From>
requires detail::is_roundable_unit_conversion<To, From>
constexpr To units::trunc (const From &x) noexcept
 Convert to a coarser integral unit, rounding toward zero.
template<UnitType UnitTypeLhs, UnitType UnitTypeRhs>
constexpr detail::floating_point_promotion_t< UnitTypeLhs > units::copysign (const UnitTypeLhs x, const UnitTypeRhs y) noexcept
 Copy sign.
template<UnitType UnitTypeLhs, ArithmeticType T>
constexpr detail::floating_point_promotion_t< UnitTypeLhs > units::copysign (const UnitTypeLhs x, const T &y) noexcept
 Overload to copy the sign from a raw double.
template<UnitType UnitTypeLhs, UnitType UnitTypeRhs>
requires (same_dimension<UnitTypeLhs, UnitTypeRhs>)
constexpr detail::floating_point_promotion_t< std::common_type_t< UnitTypeLhs, UnitTypeRhs > > units::fdim (const UnitTypeLhs x, const UnitTypeRhs y) noexcept
 Positive difference.
template<UnitType UnitTypeLhs, UnitType UnitTypeRhs>
requires (same_dimension<UnitTypeLhs, UnitTypeRhs>)
constexpr detail::floating_point_promotion_t< std::common_type_t< UnitTypeLhs, UnitTypeRhs > > units::fmax (const UnitTypeLhs x, const UnitTypeRhs y) noexcept
 Maximum value.
template<UnitType UnitTypeLhs, UnitType UnitTypeRhs>
requires (same_dimension<UnitTypeLhs, UnitTypeRhs>)
constexpr detail::floating_point_promotion_t< std::common_type_t< UnitTypeLhs, UnitTypeRhs > > units::fmin (const UnitTypeLhs x, const UnitTypeRhs y) noexcept
 Minimum value.
template<UnitType UnitType>
constexpr detail::floating_point_promotion_t< UnitType > units::fabs (const UnitType x) noexcept
 Compute absolute value.
template<UnitType UnitType>
constexpr UnitType units::abs (const UnitType x) noexcept
 Compute absolute value.
template<UnitType UnitTypeLhs, UnitType UnitMultiply, UnitType UnitAdd>
requires (traits::is_same_dimension_conversion_factor_v< compound_conversion_factor<typename traits::unit_traits<UnitTypeLhs>
::conversion_factor, typename traits::unit_traits<UnitMultiply>::conversion_factor>, typename traits::unit_traits
<UnitAdd>::conversion_factor>)
constexpr auto units::fma (const UnitTypeLhs x, const UnitMultiply y, const UnitAdd z) noexcept -> std::common_type_t< decltype(detail::floating_point_promotion_t< UnitTypeLhs >(x) *detail::floating_point_promotion_t< UnitMultiply >(y)), UnitAdd >
 Multiply-add.
template<UnitType UnitType>
constexpr bool units::isnan (const UnitType &x) noexcept
template<UnitType UnitType>
constexpr bool units::isinf (const UnitType &x) noexcept
template<UnitType UnitType>
constexpr bool units::isfinite (const UnitType &x) noexcept
template<UnitType UnitType>
constexpr bool units::isnormal (const UnitType &x) noexcept
template<UnitType UnitTypeLhs, UnitType UnitTypeRhs>
requires (same_dimension<UnitTypeLhs, UnitTypeRhs>)
constexpr bool units::isunordered (const UnitTypeLhs &lhs, const UnitTypeRhs &rhs) noexcept
template<units::UnitType U>
constexpr bool std::isnan (U x)
template<units::UnitType U>
constexpr bool std::isinf (U x)
template<units::UnitType U>
constexpr bool std::isfinite (U x)
template<units::UnitType U>
constexpr bool std::signbit (U x)
template<ArithmeticType Rep, RatioType Period>
 units::unit (std::chrono::duration< Rep, Period >) -> unit< conversion_factor< Period, dimension::time >, Rep >
template<ArithmeticType SourceTy, ConversionFactorType SourceCf>
requires (traits::is_unit_v<unit<SourceCf, SourceTy>> && PureDimensionlessCF<SourceCf>)
 units::unit (const unit< SourceCf, SourceTy > &) -> unit< conversion_factor< std::ratio< 1 >, dimension::dimensionless >, SourceTy >
template<ArithmeticType SourceTy, ConversionFactorType SourceCf, ConversionFactorType TargetCf = SourceCf>
requires (traits::is_unit_v<unit<SourceCf, SourceTy>> && traits::is_conversion_factor_v<TargetCf> &&
traits::is_same_dimension_conversion_factor_v<SourceCf, TargetCf> && !std::is_same_v<SourceCf, TargetCf> &&
detail::is_losslessly_convertible_unit<unit<SourceCf, SourceTy>, unit<TargetCf, SourceTy>>)
 units::unit (const unit< SourceCf, SourceTy > &) -> unit< TargetCf, SourceTy >
template<ArithmeticType SourceTy, ConversionFactorType SourceCf, ConversionFactorType TargetCf = SourceCf>
requires (traits::is_unit_v<unit<SourceCf, SourceTy>> && traits::is_conversion_factor_v<TargetCf> &&
traits::is_same_dimension_conversion_factor_v<SourceCf, TargetCf> && !std::is_same_v<SourceCf, TargetCf> &&
!detail::is_losslessly_convertible_unit<unit<SourceCf, SourceTy>, unit<TargetCf, SourceTy>>)
 units::unit (const unit< SourceCf, SourceTy > &) -> unit< TargetCf, detail::floating_point_promotion_t< SourceTy > >
template<ConversionFactorType TargetCf, ArithmeticType SourceTy>
requires traits::is_unit_v<unit<TargetCf, SourceTy>>
 units::unit (const unit< TargetCf, SourceTy > &) -> unit< TargetCf, SourceTy >
template<typename T, typename Cf = dimension::dimensionless, typename = std::enable_if_t<std::is_arithmetic_v<T>>>
 units::unit (T) -> unit< Cf, T >

Variables

template<class Unit>
constexpr const char * units::unit_name_v = unit_name<Unit>::value
template<class Unit>
constexpr const char * units::unit_abbreviation_v = unit_abbreviation<Unit>::value
constexpr double units::detail::PI_VAL = 3.14159265358979323846264338327950288419716939937510
template<class T>
constexpr bool units::traits::is_ratio_v = is_ratio<T>::value
template<class T>
constexpr bool units::traits::is_conversion_factor_v = is_conversion_factor<T>::value
template<class T>
constexpr bool units::traits::is_unit_v = is_unit<T>::value && !std::is_arithmetic_v<T>
template<class T, class Ret>
constexpr bool units::traits::is_numerical_scale_v = is_numerical_scale<T, Ret>::value
template<class ConversionFactor>
constexpr bool units::traits::is_ratio_dimensionless_cf_v = is_ratio_dimensionless_cf<ConversionFactor>::value
template<ConversionFactorType Cf1, ConversionFactorType Cf2>
constexpr bool units::traits::is_same_dimension_conversion_factor_v = is_same_dimension_conversion_factor<Cf1, Cf2>::value
template<ConversionFactorType Cf>
constexpr bool units::traits::is_affine_conversion_factor_v = !std::ratio_equal_v<typename conversion_factor_traits<Cf>::translation_ratio, std::ratio<0>>
 true when a conversion factor carries a non-zero datum offset — i.e.
constexpr linearized_value_t units::linearized_value {}
template<UnitType U>
constexpr bool units::traits::is_affine_unit_v = is_affine_conversion_factor_v<typename unit_traits<U>::conversion_factor>
 true when a unit type is affine — its conversion factor carries a non-zero datum offset (e.g.
template<UnitType U1, UnitType U2>
constexpr bool units::traits::is_same_dimension_unit_v = is_same_dimension_unit<U1, U2>::value
template<class T>
constexpr bool units::detail::is_named_unit_v = is_named_unit_impl<T>::value
template<class Cf1, class Cf2>
constexpr bool units::detail::is_equivalent_conversion_factor_v
template<class Cf>
constexpr bool units::detail::is_raw_conversion_factor_v
template<typename... T>
constexpr bool units::traits::has_linear_scale_v = has_linear_scale<T...>::value
template<typename... T>
constexpr bool units::traits::has_decibel_scale_v = has_decibel_scale<T...>::value
template<typename T>
constexpr bool units::traits::is_dimensionless_unit_v = is_dimensionless_unit<T>::value

Detailed Description

unit, dimensional analysis, generic cmath functions, traits (not dimension-specific), and what they're implemented with (conversion_factor, unit manipulators, etc.)

Macro Definition Documentation

◆ UNIT_ADD

#define UNIT_ADD ( namespaceName,
namePlural,
abbreviation,
... )
Value:
UNIT_ADD_STRONG_CONVERSION_FACTOR(namespaceName, namePlural, __VA_ARGS__) \
UNIT_ADD_UNIT_DEFINITION(namespaceName, namePlural, __VA_ARGS__) \
UNIT_ADD_NAME(namespaceName, namePlural, abbreviation) \
UNIT_REGISTER_NAMED_CLASS(namespaceName, namePlural) \
UNIT_ADD_LITERALS(namespaceName, namePlural, abbreviation) \
UNIT_ADD_CONSTANT(namespaceName, namePlural, abbreviation)
#define UNIT_ADD_STRONG_CONVERSION_FACTOR(namespaceName, namePlural,...)
Helper macro for generating the boilerplate code generating the tags of a new unit.
Definition core.h:221

Macro for generating the boilerplate code needed for a new unit.

The macro generates singular, plural, and abbreviated forms of the unit definition (e.g. meter, meters, and m), as well as the appropriately named unit container (e.g. meter_t). A literal suffix is created using the abbreviation (e.g. 10.0_m). It also defines a class-specific cout function which prints both the value and abbreviation of the unit when invoked.

Parameters
namespaceNamenamespace in which the new units will be encapsulated. All literal values are placed in the units::literals namespace.
namePlural- plural version of the unit name, e.g. 'meters'
abbreviation- abbreviated unit name, e.g. 'm'
...- the conversion factor definition for the unit type. Taken as variadic arguments because they contain commas in the macro definition. The complete VA_ARGS represents the full conversion factor type. e.g. meters<>.
Note
a variadic template is used for the definition to allow templates with commas to be easily expanded. All the variadic 'arguments' should together comprise the unit definition.

◆ UNIT_ADD_CONSTANT

#define UNIT_ADD_CONSTANT ( namespaceName,
namePlural,
abbreviation )
Value:
static constexpr namespaceName::namePlural abbreviation{1.0};

◆ UNIT_ADD_DECIBEL

#define UNIT_ADD_DECIBEL ( namespaceName,
namePlural,
abbreviation )
Value:
inline namespace namespaceName \
{ \ UNIT_ADD_SCALED_UNIT_DEFINITION(abbreviation, ::units::decibel_scale, typename ::units::namespaceName::namePlural<>::conversion_factor) \
} \
UNIT_ADD_NAME(namespaceName, abbreviation, abbreviation) \
UNIT_REGISTER_NAMED_CLASS(namespaceName, abbreviation) \
UNIT_ADD_DECIBEL_LITERALS(namespaceName, abbreviation, abbreviation)
#define UNIT_ADD_SCALED_UNIT_DEFINITION(unitName, scale,...)
Macro for generating the boilerplate code for the scaled unit template definition.
Definition core.h:267
numerical scale which is decibel
Definition core.h:5030

Macro to create decibel container and literals for an existing unit type.

This macro generates the decibel unit container, cout overload, and literal definitions.

Parameters
namespaceNamenamespace in which the new units will be encapsulated. All literal values are placed in the units::literals namespace.
namePluralplural version of the dimension name, e.g. 'watts'
abbreviation- abbreviated decibel unit name, e.g. 'dBW'

◆ UNIT_ADD_DECIBEL_LITERALS

#define UNIT_ADD_DECIBEL_LITERALS ( namespaceName,
namePlural,
abbreviation )
Value:
namespace literals \
{ \
constexpr namespaceName::namePlural<double> operator""_##abbreviation(long double d) noexcept \
{ \
return namespaceName::namePlural<double>(static_cast<double>(d)); \
} \
}

Like UNIT_ADD_LITERALS but emits only the floating-point literal.

A decibel-scale unit requires a floating-point underlying type, so no integer literal (which would form a <int> unit) is generated.

◆ UNIT_ADD_DIMENSION_TRAIT

#define UNIT_ADD_DIMENSION_TRAIT ( unitdimension,
ConceptName )
Value:
\ \ \ \ \
namespace traits \
{ \
template<typename T> \
struct is_##unitdimension##_unit : ::units::detail::has_dimension_of<std::decay_t<T>, units::dimension::unitdimension> \
{ \
}; \
template<typename T> \
inline constexpr bool is_##unitdimension##_unit_v = is_##unitdimension##_unit<T>::value; \
} \ \ \ \ \ \
template<typename T> \
concept ConceptName = ::units::traits::is_##unitdimension##_unit_v<std::decay_t<T>>;

Macro to create the is_dimension_unit type trait and the ConceptName concept.

The is_ ## unitdimension ## _unit trait (in namespace units::traits) allows users to test whether a given type matches an intended dimension, and the ConceptName concept (in namespace units) lets a function constrain a parameter on a physical quantity by dimension (void f(Velocity auto)) rather than a concrete named type. Being dimension-keyed, the concept classifies a computed result consistently regardless of which dimension headers a translation unit included. This macro comprises all the boilerplate code necessary to do so. The C preprocessor cannot uppercase a token, so the PascalCase concept name is supplied as a separate argument rather than derived from unitdimension.

Parameters
unitdimensionThe name of the dimension of unit, e.g. length or mass.
ConceptNameThe PascalCase name of the emitted concept, e.g. Length or Mass.

◆ UNIT_ADD_LITERALS

#define UNIT_ADD_LITERALS ( namespaceName,
namePlural,
abbreviation )
Value:
namespace literals \
{ \
/* A literal is always floating-point. It uses the library default type when that is a floating-point */ \
/* type, and its floating-point promotion otherwise, so a literal is never integer-backed even if the */ \
/* default representation is integral. */ \
constexpr namespaceName::namePlural<::units::detail::floating_point_promotion_t<UNIT_LIB_DEFAULT_TYPE>> operator""_##abbreviation(long double d) noexcept \
{ \
return namespaceName::namePlural<::units::detail::floating_point_promotion_t<UNIT_LIB_DEFAULT_TYPE>>(static_cast<::units::detail::floating_point_promotion_t<UNIT_LIB_DEFAULT_TYPE>>(d)); \
} \
/* An integer literal (5_m) yields the same floating-point type as 5.0_m. A literal is a value a user */ \
/* writes inline; deducing an integer representation from it silently opts into integer arithmetic */ \
/* (5_m / 2_m == 0), which is rarely intended, and diverges from the unit constant form (5 * m is always */ \
/* floating-point). An integer-backed quantity is still available explicitly (namePlural<int>(5)) or by */ \
/* CTAD from an integer argument (namePlural(5)). */ \
constexpr namespaceName::namePlural<::units::detail::floating_point_promotion_t<UNIT_LIB_DEFAULT_TYPE>> operator""_##abbreviation(unsigned long long d) noexcept \
{ \
return namespaceName::namePlural<::units::detail::floating_point_promotion_t<UNIT_LIB_DEFAULT_TYPE>>(static_cast<::units::detail::floating_point_promotion_t<UNIT_LIB_DEFAULT_TYPE>>(d)); \
} \
}

Macro for generating user-defined literals for units.

The macro generates user-defined literals for units. A literal suffix is created using the abbreviation (e.g. 10.0_m).

Parameters
namespaceNamenamespace in which the new units will be encapsulated. All literal values are placed in the units::literals namespace.
namePlural- plural version of the unit name, e.g. 'meters'
abbreviation- abbreviated unit name, e.g. 'm'
Note
When UNIT_NO_LITERAL_SUPPORT is defined, the macro does not generate any code

◆ UNIT_ADD_NAME

#define UNIT_ADD_NAME ( namespaceName,
namePlural,
abbrev )
Value:
template<class Underlying> \
struct unit_name<namespaceName::namePlural<Underlying>> \
{ \
static constexpr const char* value = #namePlural; \
}; \
\
template<class Underlying> \
struct unit_abbreviation<namespaceName::namePlural<Underlying>> \
{ \
static constexpr const char* value = #abbrev; \
};

◆ UNIT_ADD_SCALED_UNIT_DEFINITION

#define UNIT_ADD_SCALED_UNIT_DEFINITION ( unitName,
scale,
... )

Macro for generating the boilerplate code for the scaled unit template definition.

The macro generates the definition of the scaled unit templates as a strong type template alias, e.g. meters

Parameters
unitNameunit name, e.g. 'meters'
scalethe non-linear scale template argument of the unit's base
...- the conversion factor definition for the unit type, used for the definition of the unit (e.g. conversion_factor<std::ratio<1>, units::dimension::length>). Taken as variadic arguments because they contain commas in the macro definition. The complete VA_ARGS represents the full conversion factor type. e.g. meters<>.
Note
a variadic template is used for the definition to allow templates with commas to be easily expanded. All the variadic 'arguments' should together comprise the unit definition.

◆ UNIT_ADD_STRONG_CONVERSION_FACTOR

#define UNIT_ADD_STRONG_CONVERSION_FACTOR ( namespaceName,
namePlural,
... )
Value:
inline namespace namespaceName \
{ \ struct namePlural##_ : __VA_ARGS__ \
{ \
}; \
} \
namespace detail \
{ \ \ \ \
::units::namespaceName::namePlural##_ strong_name(__VA_ARGS__*); \
}
ConversionFactor strong_name(ConversionFactor *,...)
ADL customization point that maps a conversion_factor to its friendly strong type.

Helper macro for generating the boilerplate code generating the tags of a new unit.

The macro generates singular, plural, and abbreviated forms of the unit definition (e.g. meter, meters, and m), as aliases for the unit tag.

Parameters
namespaceNamenamespace in which the new units will be encapsulated.
namePlural- plural version of the unit name, e.g. 'meters'
...- the conversion factor definition for the unit type. Taken as variadic arguments because they contain commas in the macro definition. The complete VA_ARGS represents the full conversion factor type. e.g. meters<>.
Note
the purpose of this trait is primarily to improve the readability of conversion error messages.

◆ UNIT_ADD_UNIT_DEFINITION

#define UNIT_ADD_UNIT_DEFINITION ( namespaceName,
namePlural,
... )
Value:
inline namespace namespaceName \
}
numerical scale which is linear
Definition core.h:3816

Macro for generating the boilerplate code for the unit type definition.

The macro generates the definition of the unit container types, e.g. meter

Parameters
namespaceNamenamespace in which the new units will be encapsulated.
namePlural- plural version of the unit name, e.g. 'meters'
...- the conversion factor definition for the unit type. Taken as variadic arguments because they contain commas in the macro definition. The complete VA_ARGS represents the full conversion factor type. e.g. meters<>.

◆ UNIT_ADD_WITH_METRIC_AND_BINARY_PREFIXES

#define UNIT_ADD_WITH_METRIC_AND_BINARY_PREFIXES ( namespaceName,
namePlural,
abbreviation,
... )
Value:
UNIT_ADD_WITH_METRIC_PREFIXES(namespaceName, namePlural, abbreviation, __VA_ARGS__) \
UNIT_ADD(namespaceName, kibi##namePlural, Ki##abbreviation, kibi<namePlural<>>) \
UNIT_ADD(namespaceName, mebi##namePlural, Mi##abbreviation, mebi<namePlural<>>) \
UNIT_ADD(namespaceName, gibi##namePlural, Gi##abbreviation, gibi<namePlural<>>) \
UNIT_ADD(namespaceName, tebi##namePlural, Ti##abbreviation, tebi<namePlural<>>) \
UNIT_ADD(namespaceName, pebi##namePlural, Pi##abbreviation, pebi<namePlural<>>) \
UNIT_ADD(namespaceName, exbi##namePlural, Ei##abbreviation, exbi<namePlural<>>)
#define UNIT_ADD_WITH_METRIC_PREFIXES(namespaceName, namePlural, abbreviation,...)
Macro for generating the boilerplate code needed for a new unit, including its metric prefixes from f...
Definition core.h:529

Macro for generating the boilerplate code needed for a new unit, including its metric prefixes from femto to peta, and binary prefixes from kibi to exbi.

See UNIT_ADD. In addition to generating the unit definition and containers '(e.g. bytes and 'byte_t', it also creates corresponding units with metric suffixes such as millimeters, and millimeter_t), as well as the literal suffixes (e.g. 10.0_B).

Parameters
namespaceNamenamespace in which the new units will be encapsulated. All literal values are placed in the units::literals namespace.
namePlural- plural version of the unit name, e.g. 'bytes'
abbreviation- abbreviated unit name, e.g. 'B'
...- the conversion factor definition for the unit type. Taken as variadic arguments because they contain commas in the macro definition. The complete VA_ARGS represents the full conversion factor type. e.g. meters<>.
Note
a variadic template is used for the definition to allow templates with commas to be easily expanded. All the variadic 'arguments' should together comprise the unit definition.

◆ UNIT_ADD_WITH_METRIC_PREFIXES

#define UNIT_ADD_WITH_METRIC_PREFIXES ( namespaceName,
namePlural,
abbreviation,
... )
Value:
UNIT_ADD(namespaceName, namePlural, abbreviation, __VA_ARGS__) \
UNIT_ADD(namespaceName, femto##namePlural, f##abbreviation, femto<namePlural<>>) \
UNIT_ADD(namespaceName, pico##namePlural, p##abbreviation, pico<namePlural<>>) \
UNIT_ADD(namespaceName, nano##namePlural, n##abbreviation, nano<namePlural<>>) \
UNIT_ADD(namespaceName, micro##namePlural, u##abbreviation, micro<namePlural<>>) \
UNIT_ADD(namespaceName, milli##namePlural, m##abbreviation, milli<namePlural<>>) \
UNIT_ADD(namespaceName, centi##namePlural, c##abbreviation, centi<namePlural<>>) \
UNIT_ADD(namespaceName, deci##namePlural, d##abbreviation, deci<namePlural<>>) \
UNIT_ADD(namespaceName, deca##namePlural, da##abbreviation, deca<namePlural<>>) \
UNIT_ADD(namespaceName, hecto##namePlural, h##abbreviation, hecto<namePlural<>>) \
UNIT_ADD(namespaceName, kilo##namePlural, k##abbreviation, kilo<namePlural<>>) \
UNIT_ADD(namespaceName, mega##namePlural, M##abbreviation, mega<namePlural<>>) \
UNIT_ADD(namespaceName, giga##namePlural, G##abbreviation, giga<namePlural<>>) \
UNIT_ADD(namespaceName, tera##namePlural, T##abbreviation, tera<namePlural<>>) \
UNIT_ADD(namespaceName, peta##namePlural, P##abbreviation, peta<namePlural<>>)
#define UNIT_ADD(namespaceName, namePlural, abbreviation,...)
Macro for generating the boilerplate code needed for a new unit.
Definition core.h:447

Macro for generating the boilerplate code needed for a new unit, including its metric prefixes from femto to peta.

See UNIT_ADD. In addition to generating the unit definition and containers '(e.g. meters and 'meter_t', it also creates corresponding units with metric suffixes such as millimeters, and millimeter_t), as well as the literal suffixes (e.g. 10.0_mm).

Parameters
namespaceNamenamespace in which the new units will be encapsulated. All literal values are placed in the units::literals namespace.
namePlural- plural version of the unit name, e.g. 'meters'
abbreviation- abbreviated unit name, e.g. 'm'
...- the conversion factor definition for the unit type. Taken as variadic arguments because they contain commas in the macro definition. The complete VA_ARGS represents the full conversion factor type. e.g. meters<>.
Note
a variadic template is used for the definition to allow templates with commas to be easily expanded. All the variadic 'arguments' should together comprise the unit definition.

◆ UNIT_REGISTER_NAMED_CLASS

#define UNIT_REGISTER_NAMED_CLASS ( namespaceName,
namePlural )
Value:
namespace detail \
{ \
/* Keyed on BOTH the conversion_factor AND the numerical scale: the linear and decibel forms of a unit share */ \
/* one conversion_factor (watts_ for both watts and dBW) and differ only by scale, so scale must disambiguate */\
/* the reverse map (else watts vs dBW collide). Declared, never defined (decltype-only). */ \
::units::namespaceName::namePlural<UNIT_LIB_DEFAULT_TYPE> named_class_of( \
typename ::units::namespaceName::namePlural<>::conversion_factor*, \
typename ::units::namespaceName::namePlural<>::numerical_scale_type*); \
}

Register the CF-struct -> NAMED-class ADL map so an arithmetic RESULT is reported as the friendly type.

A result unit<strong, U, scale> is rewrapped into namePlural<U> via detail::named_class_of (results stay as friendly as inputs). Registered at units scope AFTER the class is defined (so no forward reference) and only for LINEAR named units — decibel-scale units are excluded because several dB names share one linear conversion_factor, which would make the reverse map ambiguous. Declared, never defined.

Typedef Documentation

◆ unit_base_t

template<class T>
using units::detail::unit_base_t = unit<typename T::conversion_factor, typename T::underlying_type, typename T::numerical_scale_type>

Maps any unit type to the canonical unit<Cf, Underlying, Scale> it represents.

A NAMED unit (e.g. length::meters<double>) is a class deriving from its unit<...> so a diagnostic prints the friendly name; but the exact-pattern trait specializations (replace_underlying, floating_point_promotion, std::common_type) match unit<Cf,T,Ns> literally, not a derived class. unit_base_t reconstructs that canonical base from the type's own (inherited) member typedefs, so those traits can unwrap first and work for named and plain units alike. Identity when T already IS a unit<...>.

Enumeration Type Documentation

◆ label_form

enum class units::detail::label_form
strong

Builds the unit-label suffix for a unit — the text that follows its numeric value.

Resolves the named form of the unit first, so a named unit yields its abbreviation (meters_per_second"mps"); an unnamed compound unit yields its dimension list (" m s^-2"). The value itself is NOT included. Depends only on <string>, so it is available whether or not iostream support is compiled in.

Template Parameters
ConversionFactorthe unit's conversion factor.
Tthe unit's underlying arithmetic type.
NumericalScalethe unit's numerical scale.
Returns
the label, either " <abbrev>" (with a leading space) for a named unit, or the dimension-list text (also leading-space-prefixed per term) for an unnamed unit; empty for a dimensionless unnamed unit. The form a unit label may take.

abbreviation and name render the unit's OWN symbol/name and never convert the value; for an unnamed compound they fall back to the base-dimension list (which is honest, since an unnamed unit carries no conversion of its own). base is the SI base form — the base-dimension list — and its VALUE must be converted to base SI to stay honest, because the type system flattens a named unit's identity into a single ratio and cannot recover a non-SI factor's own symbols (e.g. feet_per_second cannot render as ft s^-1; only m s^-1 against the base-converted value is correct).

Enumerator
abbreviation 

the unit's own abbreviation ("m", "ft"), the default; base-dimension list if unnamed.

name 

the unit's own full name ("meters", "feet"); base-dimension list if unnamed.

base 

the SI base-dimension list (" m s^-1"); pairs with a base-converted value.

Function Documentation

◆ dimension_to_string() [1/2]

template<class D, class E>
std::string units::detail::dimension_to_string ( const dim< D, E > & )

Renders a single dimension term (base dimension + exponent) as text.

Template Parameters
Dthe base dimension (supplies D::abbreviation).
Ethe exponent, a std::ratio (E::num/E::den).
Returns
the term as " <abbrev>", plus "^num" when the exponent is not 1 and "/den" when the denominator is not 1 — matching the ostream inserter's format, including its leading space per term.

◆ dimension_to_string() [2/2]

template<class... Dims>
std::string units::detail::dimension_to_string ( const dimension_t< Dims... > & )

Renders a full dimension list as text by concatenating each term.

Template Parameters
Dimsthe dimension terms of the list.
Returns
the concatenation of each term's dimension_to_string, e.g. " m s^-2".

◆ label_uses_base_unit()

template<ConversionFactorType ConversionFactor, ArithmeticType T, NumericalScaleType< T > NumericalScale>
bool units::detail::label_uses_base_unit ( )
inlineconstexpr

Whether a unit's label is its dimension list rather than a named abbreviation.

An unnamed unit is rendered in its BASE unit (its value must be converted to the base before the dimension label applies); a named unit prints its value as-is. This predicate lets the value-rendering paths decide whether to convert to the base unit.

Template Parameters
ConversionFactorthe unit's conversion factor.
Tthe unit's underlying arithmetic type.
NumericalScalethe unit's numerical scale.
Returns
true when the unit is unnamed (dimension-labelled), false when it is named.

◆ strong_name()

template<class ConversionFactor>
ConversionFactor units::detail::strong_name ( ConversionFactor * ,
... )

ADL customization point that maps a conversion_factor to its friendly strong type.

This is the anchor traits::strong resolves through. A dimension header registers a named strong type by declaring a better-matching overload of strong_name (see the UNIT_ADD_STRONG_CONVERSION_FACTOR macro), discoverable by ADL because a conversion_factor's associated namespace is units. This fallback is the WORST match (variadic ...), so it is chosen only when no dimension header has registered a named type — in which case the strong type is the conversion_factor itself. Only ever used unevaluated (in decltype); never defined. Being an overload set rather than an explicit specialization, a later-included header merely contributes a stronger candidate — it can never be "declared after instantiation" (#357).

The fallback deduces the conversion_factor from its pointer argument, followed by a trailing ellipsis so that any exact-CF* registration overload (a non-template, non-variadic parameter) is a strictly better match and wins whenever its dimension header is visible.

Variable Documentation

◆ is_equivalent_conversion_factor_v

template<class Cf1, class Cf2>
bool units::detail::is_equivalent_conversion_factor_v
inlineconstexpr
Initial value:
=
traits::is_same_dimension_conversion_factor_v<Cf1, Cf2> &&
std::ratio_equal_v<typename Cf1::conversion_ratio, typename Cf2::conversion_ratio> &&
std::ratio_equal_v<typename Cf1::pi_exponent_ratio, typename Cf2::pi_exponent_ratio> &&
std::ratio_equal_v<typename Cf1::translation_ratio, typename Cf2::translation_ratio>

◆ is_raw_conversion_factor_v

template<class Cf>
bool units::detail::is_raw_conversion_factor_v
inlineconstexpr
Initial value:
=
std::is_void_v<decltype(named_class_of(static_cast<Cf*>(nullptr), static_cast<linear_scale*>(nullptr)))>