Reference
Namespaces
Types
Name
Description
absolute_point_origin
base_dimension
A dimension of a base quantity
basic_fixed_string
A compile-time fixed string
binomial_distribution
cartesian_vector
cauchy_distribution
chi_squared_distribution
common_unit
Measurement unit for an accumulation of two quantities of different units
delta_
derived_dimension
A dimension of a derived quantity
derived_quantity_spec
A specification of a derived quantity
derived_unit
Measurement unit for a derived quantity
dimension_one
Dimension one
dimension_symbol_formatting
dimensionless
Quantity of dimension one
discrete_distribution
exponential_distribution
extreme_value_distribution
fisher_f_distribution
gamma_distribution
geometric_distribution
is_kind
kind_of_
kind_of_<Q>
lognormal_distribution
mag_constant
named_unit
A named unit
named_unit<Symbol>
Specialization for a unit that can be reused by several base quantities
named_unit<Symbol, U>
Specialization for unit of a specified base quantity
named_unit<Symbol, U, QS>
Specialization for a unit with special name valid only for a specific quantity
named_unit<Symbol, U, QS, PO>
negative_binomial_distribution
normal_distribution
one
Unit one
parts_per_million
per
Type list type storing the list of components with negative exponents
per_mille
percent
pi
piecewise_constant_distribution
piecewise_linear_distribution
point_
poisson_distribution
power
Type container for exponents with ratio different than 1
prefixed_unit
A prefixed unit
quantity
A quantity
quantity_like_traits
Provides support for external quantity-like types
quantity_point
A quantity point
quantity_point_like_traits
Provides support for external quantity point-like types
quantity_spec
quantity_spec<QS, Args...>
quantity_spec<QS, Eq, Args...>
reference
Quantity reference type
relative_point_origin
representation_values
A type trait that defines zero, one, min, and max for a representation type
scaled_unit
Unit being a scaled version of another unit
student_t_distribution
symbol_text
A symbol text representation
system_reference
System-specific reference
uniform_int_distribution
uniform_real_distribution
unit_symbol_formatting
weibull_distribution
zeroth_point_origin_
conditional
expr_type
fixed_string
fixed_u16string
fixed_u32string
fixed_u8string
fixed_wstring
is_same
quantity_values
text_encoding
value_type_t
wrapped_type_t
Enums
Functions
Variables
Concepts
Name
Description
AssociatedUnit
A concept matching all units that can be used as quantity references
Dimension
A concept matching all dimensions in the library.
DimensionOf
A concept checking if the argument is of the same dimension.
PointOrigin
A concept matching all quantity point origins in the library
PointOriginFor
A concept matching all quantity point origins for a specified quantity type in the library
PrefixableUnit
A concept to be used to define prefixes for a unit
Quantity
A concept matching all quantities in the library
QuantityLike
A concept matching all external quantities like types
QuantityOf
A concept matching all quantities of the provided quantity spec
QuantityPoint
A concept matching all quantity points in the library
QuantityPointLike
A concept matching all external quantity point like types
QuantityPointOf
A concept matching all quantity points of the provided property
QuantitySpec
QuantitySpecOf
A concept matching all quantity specifications of a provided quantity spec value
Reference
A concept matching all references in the library.
ReferenceOf
A concept matching all references of the provided quantity spec
RepresentationOf
Unit
A concept matching all unit types in the library
UnitMagnitude
Concept to detect whether T is a valid UnitMagnitude.
UnitOf
A concept matching all units associated with the provided quantity spec
Deduction Guides
Name
basic_fixed_string<CharT, N - 1>
basic_fixed_string<CharT, 1 + sizeof...(Rest)>
basic_fixed_string<CharT, N>
cartesian_vector<std::common_type_t<Arg, Args...>>
quantity<quantity_like_traits<Q>::reference, quantity_like_traits<Q>::rep>
quantity<R{}, Value>
quantity_point<Q::reference, default_point_origin(Q::reference), Q::rep>
quantity_point<quantity_point_like_traits<QP>::reference, quantity_point_like_traits<QP>::point_origin, quantity_point_like_traits<QP>::rep>
quantity_point<Q::reference, PO{}, Q::rep>
symbol_text<1, 1>
symbol_text<N, N>
symbol_text<N - 1, N - 1>
symbol_text<N, M>
symbol_text<N - 1, M - 1>
Types
Name
Description
absolute_point_origin
base_dimension
A dimension of a base quantity
basic_fixed_string
A compile-time fixed string
binomial_distribution
cartesian_vector
cauchy_distribution
chi_squared_distribution
common_unit
Measurement unit for an accumulation of two quantities of different units
delta_
derived_dimension
A dimension of a derived quantity
derived_quantity_spec
A specification of a derived quantity
derived_unit
Measurement unit for a derived quantity
dimension_one
Dimension one
dimension_symbol_formatting
dimensionless
Quantity of dimension one
discrete_distribution
exponential_distribution
extreme_value_distribution
fisher_f_distribution
gamma_distribution
geometric_distribution
is_kind
kind_of_
kind_of_<Q>
lognormal_distribution
mag_constant
named_unit
A named unit
named_unit<Symbol>
Specialization for a unit that can be reused by several base quantities
named_unit<Symbol, U>
Specialization for unit of a specified base quantity
named_unit<Symbol, U, QS>
Specialization for a unit with special name valid only for a specific quantity
named_unit<Symbol, U, QS, PO>
negative_binomial_distribution
normal_distribution
one
Unit one
parts_per_million
per
Type list type storing the list of components with negative exponents
per_mille
percent
pi
piecewise_constant_distribution
piecewise_linear_distribution
point_
poisson_distribution
power
Type container for exponents with ratio different than 1
prefixed_unit
A prefixed unit
quantity
A quantity
quantity_like_traits
Provides support for external quantity-like types
quantity_point
A quantity point
quantity_point_like_traits
Provides support for external quantity point-like types
quantity_spec
quantity_spec<QS, Args...>
quantity_spec<QS, Eq, Args...>
reference
Quantity reference type
relative_point_origin
representation_values
A type trait that defines zero, one, min, and max for a representation type
scaled_unit
Unit being a scaled version of another unit
student_t_distribution
symbol_text
A symbol text representation
system_reference
System-specific reference
uniform_int_distribution
uniform_real_distribution
unit_symbol_formatting
weibull_distribution
zeroth_point_origin_
conditional
expr_type
fixed_string
fixed_u16string
fixed_u32string
fixed_u8string
fixed_wstring
is_same
quantity_values
text_encoding
value_type_t
wrapped_type_t
Enums
Functions
Variables
Concepts
Name
Description
AssociatedUnit
A concept matching all units that can be used as quantity references
Dimension
A concept matching all dimensions in the library.
DimensionOf
A concept checking if the argument is of the same dimension.
PointOrigin
A concept matching all quantity point origins in the library
PointOriginFor
A concept matching all quantity point origins for a specified quantity type in the library
PrefixableUnit
A concept to be used to define prefixes for a unit
Quantity
A concept matching all quantities in the library
QuantityLike
A concept matching all external quantities like types
QuantityOf
A concept matching all quantities of the provided quantity spec
QuantityPoint
A concept matching all quantity points in the library
QuantityPointLike
A concept matching all external quantity point like types
QuantityPointOf
A concept matching all quantity points of the provided property
QuantitySpec
QuantitySpecOf
A concept matching all quantity specifications of a provided quantity spec value
Reference
A concept matching all references in the library.
ReferenceOf
A concept matching all references of the provided quantity spec
RepresentationOf
Unit
A concept matching all unit types in the library
UnitMagnitude
Concept to detect whether T is a valid UnitMagnitude.
UnitOf
A concept matching all units associated with the provided quantity spec
Deduction Guides
Name
basic_fixed_string<CharT, N - 1>
basic_fixed_string<CharT, 1 + sizeof...(Rest)>
basic_fixed_string<CharT, N>
cartesian_vector<std::common_type_t<Arg, Args...>>
quantity<quantity_like_traits<Q>::reference, quantity_like_traits<Q>::rep>
quantity<R{}, Value>
quantity_point<Q::reference, default_point_origin(Q::reference), Q::rep>
quantity_point<quantity_point_like_traits<QP>::reference, quantity_point_like_traits<QP>::point_origin, quantity_point_like_traits<QP>::rep>
quantity_point<Q::reference, PO{}, Q::rep>
symbol_text<1, 1>
symbol_text<N, N>
symbol_text<N - 1, N - 1>
symbol_text<N, M>
symbol_text<N - 1, M - 1>
Synopsis
Declared in <mp-units/ext/type_traits.h>
template<
bool B,
typename T,
typename F>
using conditional = /* implementation-defined */::type<T, F>;
Synopsis
Declared in <mp-units/framework/symbolic_expression.h>
template<typename T>
using expr_type = /* implementation-defined */::type;
Synopsis
Declared in <mp-units/ext/type_traits.h>
template<
class T,
class U>
using is_same = std::bool_constant<is_same_v<T, U>>;
Synopsis
Declared in <mp-units/framework/customization_points.h>
template<typename Rep>
using quantity_values = representation_values<Rep> ;
Synopsis
Declared in <mp-units/framework/symbol_text.h>
using text_encoding = character_set ;
Synopsis
Declared in <mp-units/ext/type_traits.h>
template<typename T>
requires std::is_object_v<T>
using value_type_t = /* implementation-defined */::type;
Synopsis
Declared in <mp-units/ext/type_traits.h>
template<typename T>
requires (!std::is_pointer_v<T> && !std::is_array_v<T>) &&
requires { typename std::indirectly_readable_traits<T>::value_type; }
using wrapped_type_t = std::indirectly_readable_traits<T>::value_type;
Synopsis
Declared in <mp-units/framework/quantity_point.h>
template<QuantitySpec auto QS>
struct absolute_point_origin
: /* implementation-defined */
Base Classes
Name
Description
/* implementation-defined */
Static Data Members
Synopsis
Declared in <mp-units/framework/quantity_point.h>
inline constexpr static
QuantitySpec auto _quantity_spec_ = QS;
A dimension of a base quantity
Synopsis
Declared in <mp-units/framework/dimension.h>
template<symbol_text Symbol>
struct base_dimension
: /* implementation-defined */
Base Classes
Name
Description
/* implementation-defined */
Static Data Members
Name
Description
_symbol_
Unique base dimension identifier
Description
Base quantity is a quantity in a conventionally chosen subset of a given system of quantities, where no quantity in the subset can be expressed in terms of the other quantities within that subset. They are referred to as being mutually independent since a base quantity cannot be expressed as a product of powers of the other base quantities.
Symbol
template parameter is an unique identifier of the base dimension. The same identifiers can be multiplied and divided which will result with an adjustment of its factor in an exponent of a derived_dimension
(in case of zero the dimension will be simplified and removed from further analysis of current expresion).
User should derive a strong type from this class template rather than use it directly in the source code. For example:
{.cpp}
inline constexpr struct dim_length final : base_dimension<"L"> {} dim_length;
inline constexpr struct dim_time final : base_dimension<"T"> {} dim_time;
inline constexpr struct dim_mass final : base_dimension<"M"> {} dim_mass;
NOTE
A common convention in this library is to assign the same name for a type and an object of this type. Besides defining them user never works with the dimension types in the source code. All operations are done on the objects. Contrarily, the dimension types are the only one visible in the compilation errors. Having them of the same names improves user experience and somehow blurs those separate domains.
Template Parameters
Name
Description
Symbol
an unique identifier of the base dimension used to provide dimensional analysis support
Unique base dimension identifier
Synopsis
Declared in <mp-units/framework/dimension.h>
inline constexpr static
auto _symbol_ = Symbol;
A compile-time fixed string
Synopsis
Declared in <mp-units/ext/fixed_string.h>
template<
typename CharT,
std::size_t N>
class basic_fixed_string;
Types
Member Functions
Data Members
Static Data Members
Template Parameters
Name
Description
CharT
Character type to be used by the string
N
The size of the string
Synopsis
Declared in <mp-units/ext/fixed_string.h>
using const_iterator = value_type const*;
Synopsis
Declared in <mp-units/ext/fixed_string.h>
using const_pointer = value_type const*;
Synopsis
Declared in <mp-units/ext/fixed_string.h>
using const_reference = value_type const&;
Synopsis
Declared in <mp-units/ext/fixed_string.h>
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
Synopsis
Declared in <mp-units/ext/fixed_string.h>
using difference_type = std::ptrdiff_t;
Synopsis
Declared in <mp-units/ext/fixed_string.h>
using iterator = const_iterator ;
Synopsis
Declared in <mp-units/ext/fixed_string.h>
using pointer = value_type *;
Synopsis
Declared in <mp-units/ext/fixed_string.h>
using reference = value_type &;
Synopsis
Declared in <mp-units/ext/fixed_string.h>
using size_type = std::size_t;
Synopsis
Declared in <mp-units/ext/fixed_string.h>
using value_type = CharT;
Constructors
Synopses
Declared in <mp-units/ext/fixed_string.h>
Copy constructor
constexpr
basic_fixed_string (basic_fixed_string const& other) noexcept = default;
» more...
Construct from CharT
consteval
explicit(false)
basic_fixed_string (CharT const(& txt)[]) noexcept;
» more...
Construct from Chars
template<std::same_as<CharT>... Chars>
requires (sizeof...(Chars) == N) && (... && !std::is_pointer_v<Chars>)
constexpr
explicit
basic_fixed_string (Chars... chars) noexcept;
» more...
template<std::ranges::input_range R>
requires std::same_as<std::ranges::range_value_t<R>, CharT>
constexpr
basic_fixed_string (
std::from_range_t,
R&& r);
» more...
template<
std::input_iterator It,
std::sentinel_for<It> S>
requires std::same_as<std::iter_value_t<It>, CharT>
constexpr
basic_fixed_string (
It begin,
S end);
» more...
template<
std::input_iterator It,
std::sentinel_for<It> S>
requires std::same_as<std::iter_value_t<It>, CharT>
constexpr
basic_fixed_string (
It begin,
S end);
» more...
Copy constructor
Synopsis
Declared in <mp-units/ext/fixed_string.h>
constexpr
basic_fixed_string(basic_fixed_string const& other) noexcept = default;
Parameters
Name
Description
other
The object to copy construct from
Construct from CharT
Synopsis
Declared in <mp-units/ext/fixed_string.h>
consteval
explicit(false)
basic_fixed_string(CharT const(& txt)[]) noexcept;
Parameters
Name
Description
txt
The object to copy construct from
Construct from Chars
Synopsis
Declared in <mp-units/ext/fixed_string.h>
template<std::same_as<CharT>... Chars>
requires (sizeof...(Chars) == N) && (... && !std::is_pointer_v<Chars>)
constexpr
explicit
basic_fixed_string(Chars... chars) noexcept;
Parameters
Name
Description
chars
The object to construct from
Synopsis
Declared in <mp-units/ext/fixed_string.h>
template<std::ranges::input_range R>
requires std::same_as<std::ranges::range_value_t<R>, CharT>
constexpr
basic_fixed_string(
std::from_range_t,
R&& r);
Synopsis
Declared in <mp-units/ext/fixed_string.h>
template<
std::input_iterator It,
std::sentinel_for<It> S>
requires std::same_as<std::iter_value_t<It>, CharT>
constexpr
basic_fixed_string(
It begin,
S end);
Synopsis
Declared in <mp-units/ext/fixed_string.h>
template<
std::input_iterator It,
std::sentinel_for<It> S>
requires std::same_as<std::iter_value_t<It>, CharT>
constexpr
basic_fixed_string(
It begin,
S end);
Copy assignment operator
Return Value
Reference to the current object
Parameters
Name
Description
other
The object to copy assign from
Synopsis
Declared in <mp-units/ext/fixed_string.h>
[[nodiscard]]
constexpr
const_reference
back() const;
Synopsis
Declared in <mp-units/ext/fixed_string.h>
[[nodiscard]]
constexpr
const_iterator
begin() const noexcept;
Synopsis
Declared in <mp-units/ext/fixed_string.h>
[[nodiscard]]
constexpr
const_pointer
c_str() const noexcept;
Synopsis
Declared in <mp-units/ext/fixed_string.h>
[[nodiscard]]
constexpr
const_iterator
cbegin() const noexcept;
Synopsis
Declared in <mp-units/ext/fixed_string.h>
[[nodiscard]]
constexpr
const_iterator
cend() const noexcept;
Synopsis
Declared in <mp-units/ext/fixed_string.h>
[[nodiscard]]
constexpr
const_reverse_iterator
crbegin() const noexcept;
Synopsis
Declared in <mp-units/ext/fixed_string.h>
[[nodiscard]]
constexpr
const_reverse_iterator
crend() const noexcept;
Synopsis
Declared in <mp-units/ext/fixed_string.h>
[[nodiscard]]
constexpr
const_pointer
data() const noexcept;
Synopsis
Declared in <mp-units/ext/fixed_string.h>
[[nodiscard]]
constexpr
const_iterator
end() const noexcept;
Synopsis
Declared in <mp-units/ext/fixed_string.h>
[[nodiscard]]
constexpr
const_reference
front() const;
Synopsis
Declared in <mp-units/ext/fixed_string.h>
[[nodiscard]]
constexpr
const_reference
operator[](size_type pos) const;
Synopsis
Declared in <mp-units/ext/fixed_string.h>
[[nodiscard]]
constexpr
const_reverse_iterator
rbegin() const noexcept;
Synopsis
Declared in <mp-units/ext/fixed_string.h>
[[nodiscard]]
constexpr
const_reverse_iterator
rend() const noexcept;
Synopsis
Declared in <mp-units/ext/fixed_string.h>
constexpr
void
swap(basic_fixed_string & s) noexcept;
Synopsis
Declared in <mp-units/ext/fixed_string.h>
[[nodiscard]]
constexpr
std::basic_string_view<CharT>
view() const noexcept;
Conversion to basic_string_view
Synopsis
Declared in <mp-units/ext/fixed_string.h>
[[nodiscard]]
constexpr
explicit(false)
operator std::basic_string_view<CharT>() const noexcept;
Return Value
The object converted to basic_string_view
Synopsis
Declared in <mp-units/ext/fixed_string.h>
CharT data_[] = {};
Synopsis
Declared in <mp-units/ext/fixed_string.h>
inline constexpr static
std::bool_constant<N == 0> empty = {};
Synopsis
Declared in <mp-units/ext/fixed_string.h>
inline constexpr static
std::integral_constant<size_type, N> length = {};
Synopsis
Declared in <mp-units/ext/fixed_string.h>
inline constexpr static
std::integral_constant<size_type, N> max_size = {};
Synopsis
Declared in <mp-units/ext/fixed_string.h>
inline constexpr static
std::integral_constant<size_type, N> size = {};
Synopsis
Declared in <mp-units/random.h>
template<Quantity Q>
requires std::integral<typename Q::rep>
struct binomial_distribution
: std::binomial_distribution<Q::rep>
Base Classes
Name
Description
std::binomial_distribution<Q::rep>
Types
Member Functions
Synopsis
Declared in <mp-units/random.h>
using base = std::binomial_distribution<rep>;
Synopsis
Declared in <mp-units/random.h>
using rep = Q::rep;
Constructors
Default constructor
Synopsis
Declared in <mp-units/random.h>
binomial_distribution();
Synopsis
Declared in <mp-units/random.h>
binomial_distribution(
Q const& t,
double p);
Synopsis
Declared in <mp-units/random.h>
[[nodiscard]]
Q
max() const;
Synopsis
Declared in <mp-units/random.h>
[[nodiscard]]
Q
min() const;
Synopsis
Declared in <mp-units/random.h>
template<typename Generator>
Q
operator()(Generator& g);
Synopsis
Declared in <mp-units/random.h>
[[nodiscard]]
Q
t() const;
Synopsis
Declared in <mp-units/cartesian_vector.h>
template</* implementation-defined */ T = double>
class cartesian_vector
: public /* implementation-defined */
Base Classes
Name
Description
/* implementation-defined */
Types
Member Functions
Data Members
Synopsis
Declared in <mp-units/cartesian_vector.h>
using value_type = T;
Constructors
Copy constructor
Synopsis
Declared in <mp-units/cartesian_vector.h>
cartesian_vector(cartesian_vector const& other) = default;
Parameters
Name
Description
other
The object to copy construct from
Copy constructor
Synopsis
Declared in <mp-units/cartesian_vector.h>
template<typename U>
requires std::constructible_from<T, U>
constexpr
explicit(!std::convertible_to<U, T>)
cartesian_vector(cartesian_vector<U> const& other);
Parameters
Name
Description
other
The object to copy construct from
Move constructor
Synopsis
Declared in <mp-units/cartesian_vector.h>
cartesian_vector(cartesian_vector && other) = default;
Parameters
Name
Description
other
The object to move construct from
Move constructor
Synopsis
Declared in <mp-units/cartesian_vector.h>
template<typename U>
requires std::constructible_from<T, U>
constexpr
explicit(!std::convertible_to<U, T>)
cartesian_vector(cartesian_vector<U> && other);
Parameters
Name
Description
other
The object to move construct from
Construct from Args
Synopsis
Declared in <mp-units/cartesian_vector.h>
template<typename... Args>
requires (... && std::constructible_from<T, Args>)
constexpr
explicit(!(... && std::convertible_to<Args, T>))
cartesian_vector(Args...&&... args);
Parameters
Name
Description
args
The object to move construct from
Assignment operators
Copy assignment operator
Return Value
Reference to the current object
Parameters
Name
Description
other
The object to copy assign from
Copy assignment operator
Return Value
Reference to the current object
Parameters
Name
Description
other
The object to copy assign from
Move assignment operator
Return Value
Reference to the current object
Parameters
Name
Description
other
The object to move assign from
Move assignment operator
Return Value
Reference to the current object
Parameters
Name
Description
other
The object to move assign from
Synopsis
Declared in <mp-units/cartesian_vector.h>
[[nodiscard]]
constexpr
T
magnitude() const
requires treat_as_floating_point<T>;
Multiplication assignment operator
Synopsis
Declared in <mp-units/cartesian_vector.h>
template<typename U>
requires requires(T t, U u) {
{ t *= u } -> std::same_as<T&>;
}
constexpr
cartesian_vector &
operator*=(U const& value);
Return Value
Reference to the current object
Parameters
Name
Description
value
The right operand
Unary plus operator
Synopsis
Declared in <mp-units/cartesian_vector.h>
[[nodiscard]]
constexpr
cartesian_vector
operator+() const;
Return Value
Another instance of the object
Addition assignment operator
Synopsis
Declared in <mp-units/cartesian_vector.h>
template<typename U>
requires requires(T t, U u) {
{ t += u } -> std::same_as<T&>;
}
constexpr
cartesian_vector &
operator+=(cartesian_vector<U> const& other);
Return Value
Reference to the current object
Parameters
Name
Description
other
The right operand
Unary minus operator
Synopsis
Declared in <mp-units/cartesian_vector.h>
[[nodiscard]]
constexpr
cartesian_vector
operator-() const;
Return Value
Another instance of the object
Subtraction assignment operator
Synopsis
Declared in <mp-units/cartesian_vector.h>
template<typename U>
requires requires(T t, U u) {
{ t -= u } -> std::same_as<T&>;
}
constexpr
cartesian_vector &
operator-=(cartesian_vector<U> const& other);
Return Value
Reference to the current object
Parameters
Name
Description
other
The right operand
Division assignment operator
Synopsis
Declared in <mp-units/cartesian_vector.h>
template<typename U>
requires requires(T t, U u) {
{ t /= u } -> std::same_as<T&>;
}
constexpr
cartesian_vector &
operator/=(U const& value);
Return Value
Reference to the current object
Parameters
Name
Description
value
The right operand
Subscript operators
Synopses
Declared in <mp-units/cartesian_vector.h>
[[nodiscard]]
constexpr
T&
operator[] (std::size_t i);
» more...
[[nodiscard]]
constexpr
T const&
operator[] (std::size_t i) const;
» more...
Synopsis
Declared in <mp-units/cartesian_vector.h>
[[nodiscard]]
constexpr
T&
operator[](std::size_t i);
Synopsis
Declared in <mp-units/cartesian_vector.h>
[[nodiscard]]
constexpr
T const&
operator[](std::size_t i) const;
Synopsis
Declared in <mp-units/cartesian_vector.h>
[[nodiscard]]
constexpr
cartesian_vector
unit() const
requires treat_as_floating_point<T>;
Synopsis
Declared in <mp-units/cartesian_vector.h>
T _coordinates_[3];
Synopsis
Declared in <mp-units/random.h>
template<Quantity Q>
requires std::floating_point<typename Q::rep>
struct cauchy_distribution
: std::cauchy_distribution<Q::rep>
Base Classes
Name
Description
std::cauchy_distribution<Q::rep>
Types
Member Functions
Synopsis
Declared in <mp-units/random.h>
using base = std::cauchy_distribution<rep>;
Synopsis
Declared in <mp-units/random.h>
using rep = Q::rep;
Constructors
Default constructor
Synopsis
Declared in <mp-units/random.h>
cauchy_distribution();
Synopsis
Declared in <mp-units/random.h>
cauchy_distribution(
Q const& a,
Q const& b);
Synopsis
Declared in <mp-units/random.h>
[[nodiscard]]
Q
a() const;
Synopsis
Declared in <mp-units/random.h>
[[nodiscard]]
Q
b() const;
Synopsis
Declared in <mp-units/random.h>
[[nodiscard]]
Q
max() const;
Synopsis
Declared in <mp-units/random.h>
[[nodiscard]]
Q
min() const;
Synopsis
Declared in <mp-units/random.h>
template<typename Generator>
Q
operator()(Generator& g);
Synopsis
Declared in <mp-units/random.h>
template<Quantity Q>
requires std::floating_point<typename Q::rep>
struct chi_squared_distribution
: std::chi_squared_distribution<Q::rep>
Base Classes
Name
Description
std::chi_squared_distribution<Q::rep>
Types
Member Functions
Synopsis
Declared in <mp-units/random.h>
using base = std::chi_squared_distribution<rep>;
Synopsis
Declared in <mp-units/random.h>
using rep = Q::rep;
Constructors
Default constructor
Synopsis
Declared in <mp-units/random.h>
chi_squared_distribution();
Construct from rep
Synopsis
Declared in <mp-units/random.h>
explicit
chi_squared_distribution(rep const& n);
Parameters
Name
Description
n
The object to copy construct from
Synopsis
Declared in <mp-units/random.h>
[[nodiscard]]
Q
max() const;
Synopsis
Declared in <mp-units/random.h>
[[nodiscard]]
Q
min() const;
Synopsis
Declared in <mp-units/random.h>
template<typename Generator>
Q
operator()(Generator& g);
Measurement unit for an accumulation of two quantities of different units
Synopsis
Declared in <mp-units/framework/unit.h>
template<
Unit U1,
Unit U2,
Unit ... Rest>
struct common_unit final
: ::_base_type_
Base Classes
Name
Description
::_base_type_
Types
Static Data Members
Description
While adding two quantities of different units we can often identify which of those unit should be used to prevent data truncation. For example, adding 1 m + 1
mm` will end up in a quantity expressed in millimeters. However, for some cases this is not possible. Choosing any of the units from the arguments of the addition would result in a data truncation. For example, a common unit for 1 km + 1
mi` is [8/125] m
. Instead of returning such a complex unit type the library will return a common_unit<mi, km>
. This type is convertible to both mi
and km
without risking data truncation, but is not equal to any of them.
NOTE
User should not instantiate this type! It is not exported from the C++ module. The library will instantiate this type automatically based on the unit arithmetic equation provided by the user.
Synopsis
Declared in <mp-units/framework/unit.h>
using _base_type_ = common_unit ;
Synopsis
Declared in <mp-units/framework/unit.h>
inline constexpr static
auto _common_unit_ = detail::get_common_scaled_unit(U1{}, U2{}, Rest{}...);
Synopsis
Declared in <mp-units/framework/construction_helpers.h>
template<Reference R>
struct delta_;
Member Functions
Name
Description
operator()
Function call operator
Function call operator
Return Value
A quantity
Parameters
Name
Description
lhs
The right operand
A dimension of a derived quantity
Synopsis
Declared in <mp-units/framework/dimension.h>
template</* implementation-defined */... Expr>
struct derived_dimension final
: /* implementation-defined */
, /* implementation-defined */
Base Classes
Name
Description
/* implementation-defined */
/* implementation-defined */
Description
Derived dimension is an expression of the dependence of a quantity on the base quantities of a system of quantities as a product of powers of factors corresponding to the base quantities, omitting any numerical factors.
Instead of using a raw list of exponents this library decided to use symbolic expression syntax to make types more digestable for the user. The positive exponents are ordered first and all negative exponents are put as a list into the per<...>
class template. If a power of exponent is different than 1
the dimension type is enclosed in power<Dim, Num, Den>
class template. Otherwise, it is just put directly in the list without any wrapper. There is also one special case. In case all of the exponents are negative than the dimension_one
being a dimension of a dimensionless quantity is put in the front to increase the readability.
For example:
{.cpp}
using frequency = decltype(inverse(dim_time));
using speed = decltype(dim_length / dim_time);
using acceleration = decltype(dim_speed / dim_time);
using force = decltype(dim_mass * dim_acceleration);
using energy = decltype(dim_force * dim_length);
using moment_of_force = decltype(dim_length * dim_force);
using torque = decltype(dim_moment_of_force);
- frequency
will be derived from type derived_dimension<dimension_one, per<dim_time>>
- speed
will be derived from type derived_dimension<dim_length, per<dim_time>>
- acceleration
will be derived from type derived_dimension<dim_length, per<power<dim_time, 2>>>
- force
will be derived from type derived_dimension<dim_length, dim_mass, per<power<dim_time, 2>>>
- energy
will be derived from type derived_dimension<power<dim_length, 2>, dim_mass, per<power<dim_time, 2>>>
NOTE
A common convention in this library is to assign the same name for a type and an object of this type. Besides defining them user never works with the dimension types in the source code. All operations are done on the objects. Contrarily, the dimension types are the only one visible in the compilation errors. Having them of the same names improves user experience and somehow blurs those separate domains.
NOTE
User should not instantiate this type! It is not exported from the C++ module. The library will instantiate this type automatically based on the dimensional arithmetic equation provided by the user.
Template Parameters
Name
Description
Ds
a parameter pack consisting tokens allowed in the dimension specification (base dimensions, dimension_one
, power<Dim, Num, Den>
, per<...>
)
A specification of a derived quantity
Synopsis
Declared in <mp-units/framework/quantity_spec.h>
template</* implementation-defined */... Expr>
struct derived_quantity_spec final
: /* implementation-defined */
Base Classes
Name
Description
/* implementation-defined */
Description
Derived quantity is a quantity, in a system of quantities, defined in terms of other quantities of that system. Its dimension is an expression of the dependence of a quantity on the base quantities of a system of quantities as a product of powers of factors corresponding to the base quantities, omitting any numerical factors.
Instead of using a raw list of exponents this library decided to use symbolic expression syntax to make types more digestable for the user both for quantity specification and its dimension. The positive exponents are ordered first and all negative exponents are put as a list into the per<...>
class template. If a power of exponent is different than 1
the quantity type is enclosed in power<Q, Num, Den>
class template. Otherwise, it is just put directly in the list without any wrapper. In case all of the exponents are negative than the dimensionless
/dimension_one
is put in the front to increase the readability.
The character of those quantities is derived from ingredients or overriden with a template parameter.
For example:
{.cpp}
auto frequency = inverse(period_duration);
auto area = pow<2>(length);
auto speed = distance / duration;
auto velocity = displacement / duration;
auto acceleration = velocity / duration;
- the type of frequency
is derived_quantity_spec<dimensionless, per<period_duration>>
- the dimension type of frequency
is derived_dimension<dimension_one, per<dim_time>>
- the type of area
is derived_quantity_spec<power<length, 2>>
- the dimension type of area
is derived_dimension<power<dim_length, 2>>
- the type of speed
is derived_quantity_spec<distance, per<duration>>
- the dimension type of speed
is derived_dimension<dim_length, per<dim_time>>
- the type of velocity
is derived_quantity_spec<displacement, per<duration>>
- the dimension type of velocity
is derived_dimension<dim_length, per<dim_time>>
- the type of acceleration
is derived_quantity_spec<velocity, per<duration>>
- the dimension type of acceleration
is derived_dimension<dim_length, per<power<dim_time, 2>>>
NOTE
User should not instantiate this type! It is not exported from the C++ module. The library will instantiate this type automatically based on the dimensional arithmetic equation provided by the user.
Template Parameters
Name
Description
Expr
a parameter pack consisting tokens allowed in the quantity specification (named quantity specification, dimensionless
, power<Q, Num, Den>
, per<...>
)
Measurement unit for a derived quantity
Synopsis
Declared in <mp-units/framework/unit.h>
template</* implementation-defined */... Expr>
struct derived_unit final
: /* implementation-defined */
Base Classes
Name
Description
/* implementation-defined */
Description
Derived units are defined as products of powers of the base units.
Instead of using a raw list of exponents this library decided to use expression template syntax to make types more digestable for the user. The positive exponents are ordered first and all negative exponents are put as a list into the per<...>
class template. If a power of exponent is different than 1
the unit type is enclosed in power<Dim, Num, Den>
class template. Otherwise, it is just put directly in the list without any wrapper. There is also one special case. In case all of the exponents are negative then the one
being a coherent unit of a dimensionless quantity is put in the front to increase the readability.
For example:
{.cpp}
static_assert(is_of_type>>);
static_assert(is_of_type);
static_assert(is_of_type);
static_assert(is_of_type>>);
static_assert(is_of_type>);
static_assert(is_of_type>>);
static_assert(is_of_type>>>);
static_assert(is_of_type>>);
Every unit in the library has its internal canonical representation being the list of exponents of named base units (with the exception of kilogram
which is represented as gram
here) and a scaling ratio represented with a magnitude.
Two units are deemed convertible if their canonical version has units of the same type. Two units are equivalent when they are convertible and their canonical versions have the same scaling ratios.
The above means that: - 1/s
and Hz
are both convertible and equal - m
and km
are convertible but not equal - m
and m²
ane not convertible and not equal
NOTE
This also means that units like hertz
and becquerel
are also considered convertible and equal.
NOTE
User should not instantiate this type! It is not exported from the C++ module. The library will instantiate this type automatically based on the unit arithmetic equation provided by the user.
Template Parameters
Name
Description
Us
a parameter pack consisting tokens allowed in the unit specification (units, power<U, Num, Den>
, per<...>
)
Dimension one
Synopsis
Declared in <mp-units/framework/dimension.h>
struct dimension_one final
: /* implementation-defined */
, /* implementation-defined */
Base Classes
Name
Description
/* implementation-defined */
/* implementation-defined */
Description
Dimension for which all the exponents of the factors corresponding to the base dimensions are zero. It is a dimension of a quantity of dimension one also known as "dimensionless".
Synopsis
Declared in <mp-units/framework/dimension.h>
struct dimension_symbol_formatting;
Data Members
Synopsis
Declared in <mp-units/framework/dimension.h>
character_set char_set = character_set::default_character_set;
Quantity of dimension one
Description
Quantity of dimension one also commonly named as "dimensionless" is a quantity with a dimension for which all the exponents of the factors corresponding to the base dimensions are zero.
Synopsis
Declared in <mp-units/random.h>
template<Quantity Q>
requires std::integral<typename Q::rep>
struct discrete_distribution
: std::discrete_distribution<Q::rep>
Base Classes
Name
Description
std::discrete_distribution<Q::rep>
Types
Member Functions
Synopsis
Declared in <mp-units/random.h>
using base = std::discrete_distribution<rep>;
Synopsis
Declared in <mp-units/random.h>
using rep = Q::rep;
Constructors
Default constructor
Synopsis
Declared in <mp-units/random.h>
discrete_distribution();
Construct from initializer_list
Synopsis
Declared in <mp-units/random.h>
discrete_distribution(std::initializer_list<double> weights);
Parameters
Name
Description
weights
The object to construct from
Synopsis
Declared in <mp-units/random.h>
template<typename InputIt>
discrete_distribution(
InputIt first,
InputIt last);
Synopsis
Declared in <mp-units/random.h>
template<typename UnaryOperation>
discrete_distribution(
std::size_t count,
double xmin,
double xmax,
UnaryOperation unary_op);
Synopsis
Declared in <mp-units/random.h>
[[nodiscard]]
Q
max() const;
Synopsis
Declared in <mp-units/random.h>
[[nodiscard]]
Q
min() const;
Synopsis
Declared in <mp-units/random.h>
template<typename Generator>
Q
operator()(Generator& g);
Synopsis
Declared in <mp-units/random.h>
template<Quantity Q>
requires std::floating_point<typename Q::rep>
struct exponential_distribution
: std::exponential_distribution<Q::rep>
Base Classes
Name
Description
std::exponential_distribution<Q::rep>
Types
Member Functions
Synopsis
Declared in <mp-units/random.h>
using base = std::exponential_distribution<rep>;
Synopsis
Declared in <mp-units/random.h>
using rep = Q::rep;
Constructors
Default constructor
Synopsis
Declared in <mp-units/random.h>
exponential_distribution();
Construct from rep
Synopsis
Declared in <mp-units/random.h>
explicit
exponential_distribution(rep const& lambda);
Parameters
Name
Description
lambda
The object to copy construct from
Synopsis
Declared in <mp-units/random.h>
[[nodiscard]]
Q
max() const;
Synopsis
Declared in <mp-units/random.h>
[[nodiscard]]
Q
min() const;
Synopsis
Declared in <mp-units/random.h>
template<typename Generator>
Q
operator()(Generator& g);
Synopsis
Declared in <mp-units/random.h>
template<Quantity Q>
requires std::floating_point<typename Q::rep>
struct extreme_value_distribution
: std::extreme_value_distribution<Q::rep>
Base Classes
Name
Description
std::extreme_value_distribution<Q::rep>
Types
Member Functions
Synopsis
Declared in <mp-units/random.h>
using base = std::extreme_value_distribution<rep>;
Synopsis
Declared in <mp-units/random.h>
using rep = Q::rep;
Constructors
Default constructor
Synopsis
Declared in <mp-units/random.h>
extreme_value_distribution();
Synopsis
Declared in <mp-units/random.h>
extreme_value_distribution(
Q const& a,
rep const& b);
Synopsis
Declared in <mp-units/random.h>
[[nodiscard]]
Q
a() const;
Synopsis
Declared in <mp-units/random.h>
[[nodiscard]]
Q
max() const;
Synopsis
Declared in <mp-units/random.h>
[[nodiscard]]
Q
min() const;
Synopsis
Declared in <mp-units/random.h>
template<typename Generator>
Q
operator()(Generator& g);
Synopsis
Declared in <mp-units/random.h>
template<Quantity Q>
requires std::floating_point<typename Q::rep>
struct fisher_f_distribution
: std::fisher_f_distribution<Q::rep>
Base Classes
Name
Description
std::fisher_f_distribution<Q::rep>
Types
Member Functions
Synopsis
Declared in <mp-units/random.h>
using base = std::fisher_f_distribution<rep>;
Synopsis
Declared in <mp-units/random.h>
using rep = Q::rep;
Constructors
Default constructor
Synopsis
Declared in <mp-units/random.h>
fisher_f_distribution();
Synopsis
Declared in <mp-units/random.h>
fisher_f_distribution(
rep const& m,
rep const& n);
Synopsis
Declared in <mp-units/random.h>
[[nodiscard]]
Q
max() const;
Synopsis
Declared in <mp-units/random.h>
[[nodiscard]]
Q
min() const;
Synopsis
Declared in <mp-units/random.h>
template<typename Generator>
Q
operator()(Generator& g);
Synopsis
Declared in <mp-units/random.h>
template<Quantity Q>
requires std::floating_point<typename Q::rep>
struct gamma_distribution
: std::gamma_distribution<Q::rep>
Base Classes
Name
Description
std::gamma_distribution<Q::rep>
Types
Member Functions
Synopsis
Declared in <mp-units/random.h>
using base = std::gamma_distribution<rep>;
Synopsis
Declared in <mp-units/random.h>
using rep = Q::rep;
Constructors
Default constructor
Synopsis
Declared in <mp-units/random.h>
gamma_distribution();
Synopsis
Declared in <mp-units/random.h>
gamma_distribution(
rep const& alpha,
rep const& beta);
Synopsis
Declared in <mp-units/random.h>
[[nodiscard]]
Q
max() const;
Synopsis
Declared in <mp-units/random.h>
[[nodiscard]]
Q
min() const;
Synopsis
Declared in <mp-units/random.h>
template<typename Generator>
Q
operator()(Generator& g);
Synopsis
Declared in <mp-units/random.h>
template<Quantity Q>
requires std::integral<typename Q::rep>
struct geometric_distribution
: std::geometric_distribution<Q::rep>
Base Classes
Name
Description
std::geometric_distribution<Q::rep>
Types
Member Functions
Synopsis
Declared in <mp-units/random.h>
using base = std::geometric_distribution<rep>;
Synopsis
Declared in <mp-units/random.h>
using rep = Q::rep;
Constructors
Default constructor
Synopsis
Declared in <mp-units/random.h>
geometric_distribution();
Construct from double
Synopsis
Declared in <mp-units/random.h>
explicit
geometric_distribution(double p);
Parameters
Name
Description
p
The value to construct from
Synopsis
Declared in <mp-units/random.h>
[[nodiscard]]
Q
max() const;
Synopsis
Declared in <mp-units/random.h>
[[nodiscard]]
Q
min() const;
Synopsis
Declared in <mp-units/random.h>
template<typename Generator>
Q
operator()(Generator& g);
Synopsis
Declared in <mp-units/framework/quantity_spec.h>
struct is_kind;
Synopsis
Declared in <mp-units/framework/quantity_spec_concepts.h>
template<typename Q>
struct kind_of_;
Synopsis
Declared in <mp-units/framework/quantity_spec.h>
template<QuantitySpec Q>
requires (!detail::QuantityKindSpec<Q>) && (detail::get_kind_tree_root(Q{}) == Q{})
struct kind_of_ <Q> final
: Q::_base_type_
Base Classes
Name
Description
Q::_base_type_
Types
Static Data Members
Synopsis
Declared in <mp-units/framework/quantity_spec.h>
using _base_type_ = kind_of_ ;
Synopsis
Declared in <mp-units/framework/quantity_spec.h>
inline constexpr static
auto _quantity_spec_ = Q{};
Synopsis
Declared in <mp-units/random.h>
template<Quantity Q>
requires std::floating_point<typename Q::rep>
struct lognormal_distribution
: std::lognormal_distribution<Q::rep>
Base Classes
Name
Description
std::lognormal_distribution<Q::rep>
Types
Member Functions
Synopsis
Declared in <mp-units/random.h>
using base = std::lognormal_distribution<rep>;
Synopsis
Declared in <mp-units/random.h>
using rep = Q::rep;
Constructors
Default constructor
Synopsis
Declared in <mp-units/random.h>
lognormal_distribution();
Synopsis
Declared in <mp-units/random.h>
lognormal_distribution(
Q const& m,
Q const& s);
Synopsis
Declared in <mp-units/random.h>
[[nodiscard]]
Q
m() const;
Synopsis
Declared in <mp-units/random.h>
[[nodiscard]]
Q
max() const;
Synopsis
Declared in <mp-units/random.h>
[[nodiscard]]
Q
min() const;
Synopsis
Declared in <mp-units/random.h>
template<typename Generator>
Q
operator()(Generator& g);
Synopsis
Declared in <mp-units/random.h>
[[nodiscard]]
Q
s() const;
Synopsis
Declared in <mp-units/framework/unit_magnitude.h>
template<
symbol_text Symbol,
long double Value>
requires (Value > 0)
struct mag_constant;
Static Data Members
Synopsis
Declared in <mp-units/framework/unit_magnitude.h>
inline constexpr static
auto _symbol_ = Symbol;
Synopsis
Declared in <mp-units/framework/unit_magnitude.h>
inline constexpr static
long double _value_ = Value;
A named unit
Synopsis
Declared in <mp-units/framework/unit.h>
template<
symbol_text Symbol,
auto...>
struct named_unit;
Description
Defines a unit with a special name. It may be used to provide a base unit in the system of units (e.g. metre
) or a name assigned to another scaled or derived unit (e.g. hour
, joule
). Most of the named units may be composed with a prefix to create a prefixed_unit
.
For example:
{.cpp}
inline constexpr struct second final : named_unit<"s", kind_of> {} second;
inline constexpr struct metre final : named_unit<"m", kind_of {} metre;
inline constexpr struct hertz final : named_unit<"Hz", inverse(second), kind_of> {} hertz;
inline constexpr struct newton final : named_unit<"N", kilogram * metre / square(second)> {} newton;
inline constexpr struct degree_Celsius final : named_unit<{u8"℃", "`C"}, kelvin, zeroth_degree_Celsius> {}
degree_Celsius; inline constexpr struct minute final : named_unit<"min", mag<60> * second> {} minute;
NOTE
A common convention in this library is to assign the same name for a type and an object of this type. Besides defining them user never works with the unit types in the source code. All operations are done on the objects. Contrarily, the unit types are the only one visible in the compilation errors. Having them of the same names improves user experience and somehow blurs those separate domains.
Template Parameters
Name
Description
Symbol
a short text representation of the unit
Specialization for a unit that can be reused by several base quantities
Synopsis
Declared in <mp-units/framework/unit.h>
template<symbol_text Symbol>
requires (!Symbol.empty())
struct named_unit <Symbol>
: /* implementation-defined */
Base Classes
Name
Description
/* implementation-defined */
Types
Static Data Members
Name
Description
_symbol_
Unique base unit identifier
Description
This specialization is used in rare cases where more than one base quantity in a specific system of units uses the same unit. For example in a hypothetical system of natural units where constant for speed of light c = 1
, length and time could be measured in seconds. In such cases system_reference
has to be used to explicitly express such a binding.
Template Parameters
Name
Description
Symbol
a short text representation of the unit
Synopsis
Declared in <mp-units/framework/unit.h>
using _base_type_ = named_unit ;
Unique base unit identifier
Synopsis
Declared in <mp-units/framework/unit.h>
inline constexpr static
auto _symbol_ = Symbol;
Specialization for unit of a specified base quantity
Synopsis
Declared in <mp-units/framework/unit.h>
template<
symbol_text Symbol,
Unit auto QS>
requires (!Symbol.empty())
struct named_unit <Symbol, U>
: /* implementation-defined */
Base Classes
Name
Description
/* implementation-defined */
Types
Static Data Members
Description
Associates a unit with a specified base quantity. For example si::metre
is a unit to measure isq::length
in the SI system.
NOTE
This is the preferred way to define a measurement unit for a specific base quantity.
NOTE
It does not have to (or sometimes even can't) be a proper system's base unit. For example a base unit of mass in the SI is si::kilogram
but here you are about to provide an si::gram
and it will work just fine as those two are convertible to each other. A similar case would be the cgs::centimetre
that is a base unit for isq::length
in the CGS system.
Allows assigning a special name to another scaled or derived unit (e.g. hour
, joule
).
Template Parameters
Name
Description
Symbol
a short text representation of the unit
QuantitySpec
a specification of a base quantity to be measured with this unit
Unit
a unit for which we provide a special name
Synopsis
Declared in <mp-units/framework/unit.h>
using _base_type_ = named_unit ;
Synopsis
Declared in <mp-units/framework/unit.h>
inline constexpr static
auto _quantity_spec_ = QS;
Unique base unit identifier
Synopsis
Declared in <mp-units/framework/unit.h>
inline constexpr static
auto _symbol_ = Symbol;
Description
Unique unit identifier
Specialization for a unit with special name valid only for a specific quantity
Synopsis
Declared in <mp-units/framework/unit.h>
template<
symbol_text Symbol,
AssociatedUnit auto QS,
/* implementation-defined */ auto PO>
requires (!Symbol.empty()) && (QS.dimension == detail::get_associated_quantity(U).dimension)
struct named_unit <Symbol, U, QS>
: /* implementation-defined */
Base Classes
Name
Description
/* implementation-defined */
Types
Static Data Members
Description
The same as the above but additionally limits the usage of this unit to provided quantities.
Template Parameters
Name
Description
Symbol
a short text representation of the unit
Unit
a unit for which we provide a special name
QuantitySpec
a specification of a quantity to be measured with this unit
Synopsis
Declared in <mp-units/framework/unit.h>
using _base_type_ = named_unit ;
Synopsis
Declared in <mp-units/framework/unit.h>
inline constexpr static
auto _point_origin_ = PO;
Synopsis
Declared in <mp-units/framework/unit.h>
inline constexpr static
auto _quantity_spec_ = QS;
Unique base unit identifier
Synopsis
Declared in <mp-units/framework/unit.h>
inline constexpr static
auto _symbol_ = Symbol;
Description
Unique unit identifier
Unique unit identifier
Synopsis
Declared in <mp-units/framework/unit.h>
template<
symbol_text Symbol,
AssociatedUnit auto U,
/* implementation-defined */ auto QS,
PointOrigin auto PO>
requires (!Symbol.empty()) && (QS.dimension == detail::get_associated_quantity(U).dimension)
struct named_unit <Symbol, U, QS, PO>
: ::_base_type_
Base Classes
Name
Description
::_base_type_
Types
Static Data Members
Synopsis
Declared in <mp-units/framework/unit.h>
using _base_type_ = named_unit ;
Synopsis
Declared in <mp-units/framework/unit.h>
inline constexpr static
auto _point_origin_ = PO;
Synopsis
Declared in <mp-units/framework/unit.h>
inline constexpr static
auto _quantity_spec_ = QS;
Unique unit identifier
Synopsis
Declared in <mp-units/framework/unit.h>
inline constexpr static
auto _symbol_ = Symbol;
Synopsis
Declared in <mp-units/random.h>
template<Quantity Q>
requires std::integral<typename Q::rep>
struct negative_binomial_distribution
: std::negative_binomial_distribution<Q::rep>
Base Classes
Name
Description
std::negative_binomial_distribution<Q::rep>
Types
Member Functions
Synopsis
Declared in <mp-units/random.h>
using base = std::negative_binomial_distribution<rep>;
Synopsis
Declared in <mp-units/random.h>
using rep = Q::rep;
Constructors
Default constructor
Synopsis
Declared in <mp-units/random.h>
negative_binomial_distribution();
Synopsis
Declared in <mp-units/random.h>
negative_binomial_distribution(
Q const& k,
double p);
Synopsis
Declared in <mp-units/random.h>
[[nodiscard]]
Q
k() const;
Synopsis
Declared in <mp-units/random.h>
[[nodiscard]]
Q
max() const;
Synopsis
Declared in <mp-units/random.h>
[[nodiscard]]
Q
min() const;
Synopsis
Declared in <mp-units/random.h>
template<typename Generator>
Q
operator()(Generator& g);
Synopsis
Declared in <mp-units/random.h>
template<Quantity Q>
requires std::floating_point<typename Q::rep>
struct normal_distribution
: std::normal_distribution<Q::rep>
Base Classes
Name
Description
std::normal_distribution<Q::rep>
Types
Member Functions
Synopsis
Declared in <mp-units/random.h>
using base = std::normal_distribution<rep>;
Synopsis
Declared in <mp-units/random.h>
using rep = Q::rep;
Constructors
Default constructor
Synopsis
Declared in <mp-units/random.h>
normal_distribution();
Synopsis
Declared in <mp-units/random.h>
normal_distribution(
Q const& mean,
Q const& stddev);
Synopsis
Declared in <mp-units/random.h>
[[nodiscard]]
Q
max() const;
Synopsis
Declared in <mp-units/random.h>
[[nodiscard]]
Q
mean() const;
Synopsis
Declared in <mp-units/random.h>
[[nodiscard]]
Q
min() const;
Synopsis
Declared in <mp-units/random.h>
template<typename Generator>
Q
operator()(Generator& g);
Synopsis
Declared in <mp-units/random.h>
[[nodiscard]]
Q
stddev() const;
Unit one
Synopsis
Declared in <mp-units/framework/unit.h>
struct one final
: /* implementation-defined */
Base Classes
Name
Description
/* implementation-defined */
Types
Description
Unit of a dimensionless quantity.
Synopsis
Declared in <mp-units/framework/unit.h>
using _base_type_ = /* implementation-defined */;
Type list type storing the list of components with negative exponents
Synopsis
Declared in <mp-units/framework/symbolic_expression.h>
template<
/* implementation-defined */ T,
/* implementation-defined */... Ts>
struct per final
Synopsis
Declared in <mp-units/random.h>
template<Quantity Q>
requires std::floating_point<typename Q::rep>
class piecewise_constant_distribution
: public std::piecewise_constant_distribution<Q::rep>
Base Classes
Name
Description
std::piecewise_constant_distribution<Q::rep>
Member Functions
Constructors
Default constructor
Synopsis
Declared in <mp-units/random.h>
piecewise_constant_distribution();
Synopsis
Declared in <mp-units/random.h>
template<typename UnaryOperation>
piecewise_constant_distribution(
std::initializer_list<Q> bl,
UnaryOperation fw);
Synopsis
Declared in <mp-units/random.h>
template<
typename InputIt1,
typename InputIt2>
piecewise_constant_distribution(
InputIt1 first_i,
InputIt1 last_i,
InputIt2 first_w);
Synopsis
Declared in <mp-units/random.h>
template<typename UnaryOperation>
piecewise_constant_distribution(
std::size_t nw,
Q const& xmin,
Q const& xmax,
UnaryOperation fw);
Synopsis
Declared in <mp-units/random.h>
[[nodiscard]]
std::vector<Q>
intervals() const;
Synopsis
Declared in <mp-units/random.h>
[[nodiscard]]
Q
max() const;
Synopsis
Declared in <mp-units/random.h>
[[nodiscard]]
Q
min() const;
Synopsis
Declared in <mp-units/random.h>
template<typename Generator>
Q
operator()(Generator& g);
Synopsis
Declared in <mp-units/random.h>
template<Quantity Q>
requires std::floating_point<typename Q::rep>
class piecewise_linear_distribution
: public std::piecewise_linear_distribution<Q::rep>
Base Classes
Name
Description
std::piecewise_linear_distribution<Q::rep>
Member Functions
Constructors
Default constructor
Synopsis
Declared in <mp-units/random.h>
piecewise_linear_distribution();
Synopsis
Declared in <mp-units/random.h>
template<typename UnaryOperation>
piecewise_linear_distribution(
std::initializer_list<Q> bl,
UnaryOperation fw);
Synopsis
Declared in <mp-units/random.h>
template<
typename InputIt1,
typename InputIt2>
piecewise_linear_distribution(
InputIt1 first_i,
InputIt1 last_i,
InputIt2 first_w);
Synopsis
Declared in <mp-units/random.h>
template<typename UnaryOperation>
piecewise_linear_distribution(
std::size_t nw,
Q const& xmin,
Q const& xmax,
UnaryOperation fw);
Synopsis
Declared in <mp-units/random.h>
[[nodiscard]]
std::vector<Q>
intervals() const;
Synopsis
Declared in <mp-units/random.h>
[[nodiscard]]
Q
max() const;
Synopsis
Declared in <mp-units/random.h>
[[nodiscard]]
Q
min() const;
Synopsis
Declared in <mp-units/random.h>
template<typename Generator>
Q
operator()(Generator& g);
Synopsis
Declared in <mp-units/framework/construction_helpers.h>
template<Reference R>
struct point_;
Member Functions
Name
Description
operator()
Function call operator
Function call operator
Return Value
A quantity point
Parameters
Name
Description
lhs
The right operand
Synopsis
Declared in <mp-units/random.h>
template<Quantity Q>
requires std::integral<typename Q::rep>
struct poisson_distribution
: std::poisson_distribution<Q::rep>
Base Classes
Name
Description
std::poisson_distribution<Q::rep>
Types
Member Functions
Synopsis
Declared in <mp-units/random.h>
using base = std::poisson_distribution<rep>;
Synopsis
Declared in <mp-units/random.h>
using rep = Q::rep;
Constructors
Default constructor
Synopsis
Declared in <mp-units/random.h>
poisson_distribution();
Construct from double
Synopsis
Declared in <mp-units/random.h>
explicit
poisson_distribution(double p);
Parameters
Name
Description
p
The value to construct from
Synopsis
Declared in <mp-units/random.h>
[[nodiscard]]
Q
max() const;
Synopsis
Declared in <mp-units/random.h>
[[nodiscard]]
Q
min() const;
Synopsis
Declared in <mp-units/random.h>
template<typename Generator>
Q
operator()(Generator& g);
Type container for exponents with ratio different than 1
Synopsis
Declared in <mp-units/framework/symbolic_expression.h>
template<
/* implementation-defined */ F,
int Num,
int Den...>
requires (detail::valid_ratio<Num, Den...> && detail::positive_ratio<Num, Den...> && !detail::ratio_one<Num, Den...>)
struct power final
Types
Static Data Members
Description
Ratio must be mathematically valid and non-negative. Negative exponents are passed to per<...>
with inverted sign (as positive exponents).
NOTE
Den
is an optional parameter to shorten the types presented to the user in the case when Den
equals 1
.
Template Parameters
Name
Description
F
factor to be raised to specified power
Num
Power ratio numerator
Den
[optional] Power ration denominator
Synopsis
Declared in <mp-units/framework/symbolic_expression.h>
using _factor_ = F;
Synopsis
Declared in <mp-units/framework/symbolic_expression.h>
inline constexpr static
/* implementation-defined */ _exponent_ = {Num, Den...};
A prefixed unit
Base Classes
Name
Description
::_base_type_
Types
Static Data Members
Description
Defines a new unit that is a scaled version of another unit with the scaling factor specified by a predefined prefix.
For example:
{.cpp}
template
struct kilo_ : prefixed_unit<"k", mag_power<10, 3>, U> {};
template
constexpr kilo_ kilo;
inline constexpr auto kilogram = si::kilo;
Template Parameters
Name
Description
Symbol
a prefix text to prepend to a unit symbol
M
scaling factor of the prefix
U
a named unit to be prefixed
Synopsis
Declared in <mp-units/framework/unit.h>
using _base_type_ = prefixed_unit ;
Synopsis
Declared in <mp-units/framework/unit.h>
inline constexpr static
auto _symbol_ = Symbol + U._symbol_;
A quantity
Types
Member Functions
Static Member Functions
Data Members
Static Data Members
Non-Member Functions
Name
Description
abs
Computes the absolute value of a quantity
cbrt
Computes the cubic root of a quantity
ceil
Computes the smallest quantity with integer representation and unit type To with its number not less than q
epsilon
Returns the epsilon of the quantity
exp
Computes Euler's raised to the given power
floor
Computes the largest quantity with integer representation and unit type To with its number not greater than q
fma
Computes the fma of 3 quantities
fma
Computes the fma of 2 quantities and a quantity point
fmod
Computes the floating-point remainder of the division operation x / y.
hypot
Computes the square root of the sum of the squares of x, y, and z, without undue overflow or underflow at intermediate stages of the computation
hypot
Computes the square root of the sum of the squares of x and y, without undue overflow or underflow at intermediate stages of the computation
inverse
Computes the inverse of a quantity in a provided unit
isfinite
Determines if a quantity is finite.
isinf
Determines if a quantity is infinite.
isnan
Determines if a quantity is a nan.
pow
Computes the value of a quantity raised to the Num/Den
power
remainder
Computes the IEEE remainder of the floating point division operation x / y.
round
Computes the nearest quantity with integer representation and unit type To
to q
sqrt
Computes the square root of a quantity
value_cast
Explicit cast of a quantity's representation type
Description
Property of a phenomenon, body, or substance, where the property has a magnitude that can be expressed by means of a number and a reference.
Template Parameters
Name
Description
R
a reference of the quantity providing all information about quantity properties
Rep
a type to be used to represent values of a quantity
Synopsis
Declared in <mp-units/framework/quantity.h>
using rep = Rep;
Constructors
Synopses
Declared in <mp-units/framework/quantity.h>
Default constructor
quantity () = default;
» more...
Copy constructor
quantity (quantity const& other) = default;
» more...
Copy constructor
template<
auto R2,
typename Rep2>
requires detail::QuantityConstructibleFrom<quantity, quantity<R2, Rep2>>
constexpr
explicit(!implicitly_convertible(get_quantity_spec(R2), quantity_spec) || !std::convertible_to<Rep2, rep>)
quantity (quantity<R2, Rep2> const& q);
» more...
Move constructor
quantity (quantity && other) = default;
» more...
Construct from Q
template<QuantityLike Q>
requires detail::QuantityConstructibleFrom<quantity, detail::quantity_like_type<Q>>
constexpr
explicit(quantity_like_traits<Q>::explicit_import || !std::convertible_to<detail::quantity_like_type<Q>, quantity<R, Rep>>)
quantity (Q const& q);
» more...
Construct from FwdValue
template<typename FwdValue>
requires detail::DimensionlessOne<reference> && detail::ValuePreservingConstruction<rep, FwdValue>
constexpr
explicit(!std::convertible_to<FwdValue, rep>)
quantity (FwdValue&& val);
» more...
Constructor
template<
typename FwdValue,
Reference R2>
requires (!equivalent(unit, get_unit(R2{}))) &&
detail::QuantityConstructibleFrom<quantity, quantity<R2{}, std::remove_cvref_t<FwdValue>>>
constexpr
quantity (
FwdValue&& val,
R2);
» more...
Constructor
template<
typename FwdValue,
Reference R2>
requires (equivalent(unit, get_unit(R2{}))) && detail::ValuePreservingConstruction<rep, FwdValue>
constexpr
quantity (
FwdValue&& val,
R2);
» more...
Default constructor
Synopsis
Declared in <mp-units/framework/quantity.h>
quantity() = default;
Copy constructor
Synopsis
Declared in <mp-units/framework/quantity.h>
quantity(quantity const& other) = default;
Parameters
Name
Description
other
The object to copy construct from
Copy constructor
Synopsis
Declared in <mp-units/framework/quantity.h>
template<
auto R2,
typename Rep2>
requires detail::QuantityConstructibleFrom<quantity, quantity<R2, Rep2>>
constexpr
explicit(!implicitly_convertible(get_quantity_spec(R2), quantity_spec) || !std::convertible_to<Rep2, rep>)
quantity(quantity<R2, Rep2> const& q);
Parameters
Name
Description
q
The object to copy construct from
Move constructor
Synopsis
Declared in <mp-units/framework/quantity.h>
quantity(quantity && other) = default;
Parameters
Name
Description
other
The object to move construct from
Construct from Q
Synopsis
Declared in <mp-units/framework/quantity.h>
template<QuantityLike Q>
requires detail::QuantityConstructibleFrom<quantity, detail::quantity_like_type<Q>>
constexpr
explicit(quantity_like_traits<Q>::explicit_import || !std::convertible_to<detail::quantity_like_type<Q>, quantity<R, Rep>>)
quantity(Q const& q);
Parameters
Name
Description
q
The object to copy construct from
Construct from FwdValue
Synopsis
Declared in <mp-units/framework/quantity.h>
template<typename FwdValue>
requires detail::DimensionlessOne<reference> && detail::ValuePreservingConstruction<rep, FwdValue>
constexpr
explicit(!std::convertible_to<FwdValue, rep>)
quantity(FwdValue&& val);
Parameters
Name
Description
val
The object to move construct from
Constructor
Synopsis
Declared in <mp-units/framework/quantity.h>
template<
typename FwdValue,
Reference R2>
requires (!equivalent(unit, get_unit(R2{}))) &&
detail::QuantityConstructibleFrom<quantity, quantity<R2{}, std::remove_cvref_t<FwdValue>>>
constexpr
quantity(
FwdValue&& val,
R2);
Parameters
Name
Description
val
The object to move construct from
Constructor
Synopsis
Declared in <mp-units/framework/quantity.h>
template<
typename FwdValue,
Reference R2>
requires (equivalent(unit, get_unit(R2{}))) && detail::ValuePreservingConstruction<rep, FwdValue>
constexpr
quantity(
FwdValue&& val,
R2);
Parameters
Name
Description
val
The object to move construct from
Destructor
Synopsis
Declared in <mp-units/framework/quantity.h>
~quantity() = default;
Assignment operators
Copy assignment operator
Synopsis
Declared in <mp-units/framework/quantity.h>
quantity &
operator=(quantity const& other) = default;
Return Value
Reference to the current object
Parameters
Name
Description
other
The object to copy assign from
Move assignment operator
Synopsis
Declared in <mp-units/framework/quantity.h>
quantity &
operator=(quantity && other) = default;
Return Value
Reference to the current object
Parameters
Name
Description
other
The object to move assign from
Assignment operator
Synopsis
Declared in <mp-units/framework/quantity.h>
template<typename FwdValue>
requires detail::DimensionlessOne<reference> && detail::ValuePreservingAssignment<rep, FwdValue>
constexpr
quantity &
operator=(FwdValue&& val);
Return Value
Reference to the current object
Parameters
Name
Description
val
The object to move assign from
Synopsis
Declared in <mp-units/framework/quantity.h>
template</* implementation-defined */ ToU>
requires detail::SaneScaling<unit, ToU{}, rep>
[[nodiscard]]
constexpr
QuantityOf<quantity_spec> auto
force_in(ToU) const;
Synopsis
Declared in <mp-units/framework/quantity.h>
template<
RepresentationOf<quantity_spec> ToRep,
/* implementation-defined */ ToU>
requires std::constructible_from<ToRep, rep> && detail::SaneScaling<unit, ToU{}, rep>
[[nodiscard]]
constexpr
QuantityOf<quantity_spec> auto
force_in(ToU) const;
Synopsis
Declared in <mp-units/framework/quantity.h>
template</* implementation-defined */ U>
requires detail::SaneScaling<unit, U{}, rep>
[[nodiscard]]
constexpr
rep
force_numerical_value_in(U) const noexcept;
Synopsis
Declared in <mp-units/framework/quantity.h>
template</* implementation-defined */ ToU>
requires detail::ValuePreservingScaling<unit, ToU{}, rep>
[[nodiscard]]
constexpr
QuantityOf<quantity_spec> auto
in(ToU) const;
Synopsis
Declared in <mp-units/framework/quantity.h>
template<
RepresentationOf<quantity_spec> ToRep,
/* implementation-defined */ ToU>
requires detail::ValuePreservingConstruction<ToRep, rep> &&
detail::ValuePreservingConversion<unit, rep, ToU{}, ToRep>
[[nodiscard]]
constexpr
QuantityOf<quantity_spec> auto
in(ToU) const;
Synopsis
Declared in <mp-units/framework/quantity.h>
template</* implementation-defined */ U>
requires detail::ValuePreservingScaling<unit, U{}, rep>
[[nodiscard]]
constexpr
rep
numerical_value_in(U) const noexcept;
Synopsis
Declared in <mp-units/framework/quantity.h>
template<Unit U>
requires (equivalent(U{}, unit))
constexpr
rep const&&
numerical_value_ref_in(U) const && noexcept = delete;
Synopsis
Declared in <mp-units/framework/quantity.h>
template<Unit U>
requires (equivalent(U{}, unit))
[[nodiscard]]
constexpr
rep const&
numerical_value_ref_in(U) const & noexcept;
Synopsis
Declared in <mp-units/framework/quantity.h>
template<Unit U>
requires (equivalent(U{}, unit))
[[nodiscard]]
constexpr
rep &
numerical_value_ref_in(U) & noexcept;
Modulus assignment operator
Synopsis
Declared in <mp-units/framework/quantity.h>
template<
auto R2,
typename Rep2>
requires (!treat_as_floating_point<rep>) && (implicitly_convertible(get_quantity_spec(R2), quantity_spec)) &&
detail::ValuePreservingConversion<get_unit(R2), Rep2, unit, rep> && requires(rep& a, const Rep2 b) {
{ a %= b } -> std::same_as<rep&>;
}
constexpr
quantity &
operator%=(quantity<R2, Rep2> const& other) &;
Return Value
Reference to the current object
Parameters
Name
Description
other
The right operand
Multiplication assignment operators
Synopses
Declared in <mp-units/framework/quantity.h>
Multiplication assignment operator
template</* implementation-defined */ Q2>
requires detail::ScalarValuePreservingTo<typename Q2::rep, rep> && requires(rep& a, const Q2::rep b) {
{ a *= b } -> std::same_as<rep&>;
}
constexpr
quantity &
operator*= (Q2 const& other) &;
» more...
Multiplication assignment operator
template</* implementation-defined */ Value>
requires requires(rep& a, const Value b) {
{ a *= b } -> std::same_as<rep&>;
}
constexpr
quantity &
operator*= (Value const& val) &;
» more...
Multiplication assignment operator
Synopsis
Declared in <mp-units/framework/quantity.h>
template</* implementation-defined */ Q2>
requires detail::ScalarValuePreservingTo<typename Q2::rep, rep> && requires(rep& a, const Q2::rep b) {
{ a *= b } -> std::same_as<rep&>;
}
constexpr
quantity &
operator*=(Q2 const& other) &;
Return Value
Reference to the current object
Parameters
Name
Description
other
The right operand
Multiplication assignment operator
Synopsis
Declared in <mp-units/framework/quantity.h>
template</* implementation-defined */ Value>
requires requires(rep& a, const Value b) {
{ a *= b } -> std::same_as<rep&>;
}
constexpr
quantity &
operator*=(Value const& val) &;
Return Value
Reference to the current object
Parameters
Name
Description
val
The right operand
Synopsis
Declared in <mp-units/framework/quantity.h>
[[nodiscard]]
constexpr
QuantityOf<quantity_spec> auto
operator+() const
requires requires(const rep v) {
{ +v } -> std::common_with<rep>;
};
Increment operators
Increment operator
Synopsis
Declared in <mp-units/framework/quantity.h>
constexpr
quantity &
operator++() &
requires requires(rep& v) {
{ ++v } -> std::same_as<rep&>;
};
Return Value
Reference to the current object
Synopsis
Declared in <mp-units/framework/quantity.h>
[[nodiscard]]
constexpr
QuantityOf<quantity_spec> auto
operator++(int)
requires requires(rep& v) {
{ v++ } -> std::common_with<rep>;
};
Addition assignment operator
Synopsis
Declared in <mp-units/framework/quantity.h>
template<
auto R2,
typename Rep2>
requires (implicitly_convertible(get_quantity_spec(R2), quantity_spec)) &&
detail::ValuePreservingConversion<get_unit(R2), Rep2, unit, rep> && requires(rep& a, const Rep2 b) {
{ a += b } -> std::same_as<rep&>;
}
constexpr
quantity &
operator+=(quantity<R2, Rep2> const& other) &;
Return Value
Reference to the current object
Parameters
Name
Description
other
The right operand
Synopsis
Declared in <mp-units/framework/quantity.h>
[[nodiscard]]
constexpr
QuantityOf<quantity_spec> auto
operator-() const
requires requires(const rep v) {
{ -v } -> std::common_with<rep>;
};
Decrement operators
Decrement operator
Synopsis
Declared in <mp-units/framework/quantity.h>
constexpr
quantity &
operator--() &
requires requires(rep& v) {
{ --v } -> std::same_as<rep&>;
};
Return Value
Reference to the current object
Synopsis
Declared in <mp-units/framework/quantity.h>
[[nodiscard]]
constexpr
QuantityOf<quantity_spec> auto
operator--(int)
requires requires(rep& v) {
{ v-- } -> std::common_with<rep>;
};
Subtraction assignment operator
Synopsis
Declared in <mp-units/framework/quantity.h>
template<
auto R2,
typename Rep2>
requires (implicitly_convertible(get_quantity_spec(R2), quantity_spec)) &&
detail::ValuePreservingConversion<get_unit(R2), Rep2, unit, rep> && requires(rep& a, const Rep2 b) {
{ a -= b } -> std::same_as<rep&>;
}
constexpr
quantity &
operator-=(quantity<R2, Rep2> const& other) &;
Return Value
Reference to the current object
Parameters
Name
Description
other
The right operand
Division assignment operators
Synopses
Declared in <mp-units/framework/quantity.h>
Division assignment operator
template</* implementation-defined */ Q2>
requires detail::ScalarValuePreservingTo<typename Q2::rep, rep> && requires(rep& a, const Q2::rep b) {
{ a /= b } -> std::same_as<rep&>;
}
constexpr
quantity &
operator/= (Q2 const& rhs) &;
» more...
Division assignment operator
template</* implementation-defined */ Value>
requires requires(rep& a, const Value b) {
{ a /= b } -> std::same_as<rep&>;
}
constexpr
quantity &
operator/= (Value const& val) &;
» more...
Division assignment operator
Synopsis
Declared in <mp-units/framework/quantity.h>
template</* implementation-defined */ Q2>
requires detail::ScalarValuePreservingTo<typename Q2::rep, rep> && requires(rep& a, const Q2::rep b) {
{ a /= b } -> std::same_as<rep&>;
}
constexpr
quantity &
operator/=(Q2 const& rhs) &;
Return Value
Reference to the current object
Parameters
Name
Description
rhs
The right operand
Division assignment operator
Synopsis
Declared in <mp-units/framework/quantity.h>
template</* implementation-defined */ Value>
requires requires(rep& a, const Value b) {
{ a /= b } -> std::same_as<rep&>;
}
constexpr
quantity &
operator/=(Value const& val) &;
Return Value
Reference to the current object
Parameters
Name
Description
val
The right operand
Conversion operators
Synopses
Declared in <mp-units/framework/quantity.h>
Conversion to Q_
template<
typename Q_,
QuantityLike Q = std::remove_cvref_t<Q_>>
requires detail::QuantityConstructibleFrom<detail::quantity_like_type<Q>, quantity>
[[nodiscard]]
constexpr
explicit(quantity_like_traits<Q>::explicit_export || !std::convertible_to<quantity<R, Rep>, detail::quantity_like_type<Q>>)
operator Q_() const noexcept(noexcept(quantity_like_traits<Q>::from_numerical_value(this->numerical_value_is_an_implementation_detail_)) && std::is_nothrow_copy_constructible_v<rep>);
» more...
Conversion to V_
template<
typename V_,
std::constructible_from<rep> Value = std::remove_cvref_t<V_>>
requires detail::DimensionlessOne<reference>
[[nodiscard]]
constexpr
explicit
operator V_() const & noexcept;
» more...
Conversion to Q_
Synopsis
Declared in <mp-units/framework/quantity.h>
template<
typename Q_,
QuantityLike Q = std::remove_cvref_t<Q_>>
requires detail::QuantityConstructibleFrom<detail::quantity_like_type<Q>, quantity>
[[nodiscard]]
constexpr
explicit(quantity_like_traits<Q>::explicit_export || !std::convertible_to<quantity<R, Rep>, detail::quantity_like_type<Q>>)
operator Q_() const noexcept(noexcept(quantity_like_traits<Q>::from_numerical_value(this->numerical_value_is_an_implementation_detail_)) && std::is_nothrow_copy_constructible_v<rep>);
Return Value
The object converted to Q_
Conversion to V_
Synopsis
Declared in <mp-units/framework/quantity.h>
template<
typename V_,
std::constructible_from<rep> Value = std::remove_cvref_t<V_>>
requires detail::DimensionlessOne<reference>
[[nodiscard]]
constexpr
explicit
operator V_() const & noexcept;
Return Value
The object converted to V_
Synopsis
Declared in <mp-units/framework/quantity.h>
[[nodiscard]]
constexpr
static
quantity
max() noexcept
requires requires { representation_values<rep>::max(); };
Synopsis
Declared in <mp-units/framework/quantity.h>
[[nodiscard]]
constexpr
static
quantity
min() noexcept
requires requires { representation_values<rep>::min(); };
Synopsis
Declared in <mp-units/framework/quantity.h>
[[nodiscard]]
constexpr
static
quantity
zero() noexcept
requires requires { representation_values<rep>::zero(); };
needs to be public for a structural type
Synopsis
Declared in <mp-units/framework/quantity.h>
Rep numerical_value_is_an_implementation_detail_;
Synopsis
Declared in <mp-units/framework/quantity.h>
inline constexpr static
Dimension auto dimension = quantity_spec.dimension;
Synopsis
Declared in <mp-units/framework/quantity.h>
inline constexpr static
QuantitySpec auto quantity_spec = get_quantity_spec(reference);
Synopsis
Declared in <mp-units/framework/quantity.h>
inline constexpr static
Reference auto reference = R;
Synopsis
Declared in <mp-units/framework/quantity.h>
inline constexpr static
Unit auto unit = get_unit(reference);
Provides support for external quantity-like types
Synopsis
Declared in <mp-units/framework/customization_points.h>
template<typename T>
struct quantity_like_traits;
Description
The type trait should provide the reference
object, a type alias rep,
and static member functions to_numerical_value(T)
that returns the raw value of the quantity and from_numerical_value(rep)
that returns T
from rep.
If the following expression is true,
the specified conversion will be explicit: - explicit_import
for the conversion from T
to a quantity
type, - explicit_export
for the conversion from a quantity
type to T.
Usage example can be found in mp-units/systems/si/chrono.h
header file.
Template Parameters
Name
Description
T
the type to provide support for
A quantity point
Types
Member Functions
Static Member Functions
Data Members
Static Data Members
Non-Member Functions
Name
Description
isfinite
Determines if a quantity point is finite.
isinf
Determines if a quantity point is infinite.
isnan
Determines if a quantity point is a nan.
lerp
Linear interpolation or extrapolation
midpoint
Computes the midpoint of two points
value_cast
Explicit cast of a quantity point's representation type
Description
An absolute quantity measured from an origin.
Template Parameters
Name
Description
R
a reference of the quantity point providing all information about quantity properties
PO
a type that represents the origin point from which the quantity point is measured from
Rep
a type to be used to represent values of a quantity point
Synopsis
Declared in <mp-units/framework/quantity_point.h>
using rep = Rep;
Constructors
Synopses
Declared in <mp-units/framework/quantity_point.h>
Default constructor
quantity_point () = default;
» more...
Copy constructor
quantity_point (quantity_point const& other) = default;
» more...
Move constructor
quantity_point (quantity_point && other) = default;
» more...
Construct from QP
template<QuantityPointLike QP>
requires (quantity_point_like_traits<QP>::point_origin == point_origin) &&
std::constructible_from<quantity_type, quantity<quantity_point_like_traits<QP>::reference,
typename quantity_point_like_traits<QP>::rep>>
constexpr
explicit(quantity_point_like_traits<QP>::explicit_import || !std::convertible_to<quantity<quantity_point_like_traits<QP>::reference, typename quantity_point_like_traits<QP>::rep>, quantity_type>)
quantity_point (QP const& qp);
» more...
Construct from QP
template<QuantityPointOf<absolute_point_origin> QP>
requires std::constructible_from<quantity_type, typename QP::quantity_type>
constexpr
explicit(!std::convertible_to<typename QP::quantity_type, quantity_type>)
quantity_point (QP const& qp);
» more...
Construct from FwdQ
template<
typename FwdQ,
QuantityOf<quantity_spec> Q = std::remove_cvref_t<FwdQ>>
requires std::constructible_from<quantity_type, FwdQ> && (point_origin == default_point_origin(R))
constexpr
explicit
quantity_point (FwdQ&& q);
» more...
Constructor
template<
typename FwdQ,
QuantityOf<quantity_spec> Q = std::remove_cvref_t<FwdQ>>
requires std::constructible_from<quantity_type, FwdQ>
constexpr
quantity_point (
FwdQ&& q,
decltype(PO));
» more...
Constructor
template<
typename FwdQ,
PointOrigin PO2,
QuantityOf<PO2::_quantity_spec_> Q = std::remove_cvref_t<FwdQ>>
requires std::constructible_from<quantity_type, FwdQ> && detail::SameAbsolutePointOriginAs<PO2, PO>
constexpr
quantity_point (
FwdQ&& q,
PO2);
» more...
Default constructor
Synopsis
Declared in <mp-units/framework/quantity_point.h>
quantity_point() = default;
Copy constructor
Synopsis
Declared in <mp-units/framework/quantity_point.h>
quantity_point(quantity_point const& other) = default;
Parameters
Name
Description
other
The object to copy construct from
Move constructor
Synopsis
Declared in <mp-units/framework/quantity_point.h>
quantity_point(quantity_point && other) = default;
Parameters
Name
Description
other
The object to move construct from
Construct from QP
Synopsis
Declared in <mp-units/framework/quantity_point.h>
template<QuantityPointLike QP>
requires (quantity_point_like_traits<QP>::point_origin == point_origin) &&
std::constructible_from<quantity_type, quantity<quantity_point_like_traits<QP>::reference,
typename quantity_point_like_traits<QP>::rep>>
constexpr
explicit(quantity_point_like_traits<QP>::explicit_import || !std::convertible_to<quantity<quantity_point_like_traits<QP>::reference, typename quantity_point_like_traits<QP>::rep>, quantity_type>)
quantity_point(QP const& qp);
Parameters
Name
Description
qp
The object to copy construct from
Construct from QP
Synopsis
Declared in <mp-units/framework/quantity_point.h>
template<QuantityPointOf<absolute_point_origin> QP>
requires std::constructible_from<quantity_type, typename QP::quantity_type>
constexpr
explicit(!std::convertible_to<typename QP::quantity_type, quantity_type>)
quantity_point(QP const& qp);
Parameters
Name
Description
qp
The object to copy construct from
Construct from FwdQ
Synopsis
Declared in <mp-units/framework/quantity_point.h>
template<
typename FwdQ,
QuantityOf<quantity_spec> Q = std::remove_cvref_t<FwdQ>>
requires std::constructible_from<quantity_type, FwdQ> && (point_origin == default_point_origin(R))
constexpr
explicit
quantity_point(FwdQ&& q);
Parameters
Name
Description
q
The object to move construct from
Constructor
Synopsis
Declared in <mp-units/framework/quantity_point.h>
template<
typename FwdQ,
QuantityOf<quantity_spec> Q = std::remove_cvref_t<FwdQ>>
requires std::constructible_from<quantity_type, FwdQ>
constexpr
quantity_point(
FwdQ&& q,
decltype(PO));
Parameters
Name
Description
q
The object to move construct from
Constructor
Synopsis
Declared in <mp-units/framework/quantity_point.h>
template<
typename FwdQ,
PointOrigin PO2,
QuantityOf<PO2::_quantity_spec_> Q = std::remove_cvref_t<FwdQ>>
requires std::constructible_from<quantity_type, FwdQ> && detail::SameAbsolutePointOriginAs<PO2, PO>
constexpr
quantity_point(
FwdQ&& q,
PO2);
Parameters
Name
Description
q
The object to move construct from
Destructor
Synopsis
Declared in <mp-units/framework/quantity_point.h>
~quantity_point() = default;
Assignment operators
Copy assignment operator
Return Value
Reference to the current object
Parameters
Name
Description
other
The object to copy assign from
Move assignment operator
Return Value
Reference to the current object
Parameters
Name
Description
other
The object to move assign from
Synopsis
Declared in <mp-units/framework/quantity_point.h>
template</* implementation-defined */ ToU>
requires detail::SaneScaling<unit, ToU{}, rep>
[[nodiscard]]
constexpr
QuantityPointOf<quantity_spec> auto
force_in(ToU) const;
Synopsis
Declared in <mp-units/framework/quantity_point.h>
template<
RepresentationOf<quantity_spec> ToRep,
/* implementation-defined */ ToU>
requires std::constructible_from<ToRep, rep> && detail::SaneScaling<unit, ToU{}, rep>
[[nodiscard]]
constexpr
QuantityPointOf<quantity_spec> auto
force_in(ToU) const;
Synopsis
Declared in <mp-units/framework/quantity_point.h>
template</* implementation-defined */ ToU>
requires detail::ValuePreservingScaling<unit, ToU{}, rep>
[[nodiscard]]
constexpr
QuantityPointOf<quantity_spec> auto
in(ToU) const;
Synopsis
Declared in <mp-units/framework/quantity_point.h>
template<
RepresentationOf<quantity_spec> ToRep,
/* implementation-defined */ ToU>
requires detail::ValuePreservingConstruction<ToRep, rep> &&
detail::ValuePreservingConversion<unit, rep, ToU{}, ToRep>
[[nodiscard]]
constexpr
QuantityPointOf<quantity_spec> auto
in(ToU) const;
Increment operators
Synopses
Declared in <mp-units/framework/quantity_point.h>
Increment operator
constexpr
quantity_point &
operator++ () &
requires requires { ++quantity_from_origin_is_an_implementation_detail_; };
» more...
Increment operator
[[nodiscard]]
constexpr
quantity_point
operator++ (int)
requires requires { quantity_from_origin_is_an_implementation_detail_++; };
» more...
Increment operator
Synopsis
Declared in <mp-units/framework/quantity_point.h>
constexpr
quantity_point &
operator++() &
requires requires { ++quantity_from_origin_is_an_implementation_detail_; };
Return Value
Reference to the current object
Increment operator
Synopsis
Declared in <mp-units/framework/quantity_point.h>
[[nodiscard]]
constexpr
quantity_point
operator++(int)
requires requires { quantity_from_origin_is_an_implementation_detail_++; };
Return Value
Another instance of the object
Addition assignment operator
Synopsis
Declared in <mp-units/framework/quantity_point.h>
template<
auto R2,
typename Rep2>
requires (implicitly_convertible(get_quantity_spec(R2), quantity_spec)) &&
detail::ValuePreservingConversion<get_unit(R2), Rep2, unit, rep> &&
requires(const quantity_type q) { quantity_from_origin_is_an_implementation_detail_ += q; }
constexpr
quantity_point &
operator+=(quantity<R2, Rep2> const& q) &;
Return Value
Reference to the current object
Parameters
Name
Description
q
The right operand
Decrement operators
Synopses
Declared in <mp-units/framework/quantity_point.h>
Decrement operator
constexpr
quantity_point &
operator-- () &
requires requires { --quantity_from_origin_is_an_implementation_detail_; };
» more...
Decrement operator
[[nodiscard]]
constexpr
quantity_point
operator-- (int)
requires requires { quantity_from_origin_is_an_implementation_detail_--; };
» more...
Decrement operator
Synopsis
Declared in <mp-units/framework/quantity_point.h>
constexpr
quantity_point &
operator--() &
requires requires { --quantity_from_origin_is_an_implementation_detail_; };
Return Value
Reference to the current object
Decrement operator
Synopsis
Declared in <mp-units/framework/quantity_point.h>
[[nodiscard]]
constexpr
quantity_point
operator--(int)
requires requires { quantity_from_origin_is_an_implementation_detail_--; };
Return Value
Another instance of the object
Subtraction assignment operator
Synopsis
Declared in <mp-units/framework/quantity_point.h>
template<
auto R2,
typename Rep2>
requires (implicitly_convertible(get_quantity_spec(R2), quantity_spec)) &&
detail::ValuePreservingConversion<get_unit(R2), Rep2, unit, rep> &&
requires(const quantity_type q) { quantity_from_origin_is_an_implementation_detail_ -= q; }
constexpr
quantity_point &
operator-=(quantity<R2, Rep2> const& q) &;
Return Value
Reference to the current object
Parameters
Name
Description
q
The right operand
Synopsis
Declared in <mp-units/framework/quantity_point.h>
template</* implementation-defined */ NewPO>
[[nodiscard]]
constexpr
QuantityPointOf<(NewPO{})> auto
point_for(NewPO new_origin) const;
Synopsis
Declared in <mp-units/framework/quantity_point.h>
template<PointOrigin PO2>
requires requires(const quantity_point qp) { qp - PO2{}; }
[[nodiscard]]
constexpr
Quantity auto
quantity_from(PO2) const;
Synopsis
Declared in <mp-units/framework/quantity_point.h>
[[nodiscard]]
constexpr
Quantity auto
quantity_from_zero() const;
Synopsis
Declared in <mp-units/framework/quantity_point.h>
template<PointOrigin PO2>
requires (PO2{} == point_origin)
constexpr
quantity_type const&&
quantity_ref_from(PO2) const && noexcept = delete;
Synopsis
Declared in <mp-units/framework/quantity_point.h>
template<PointOrigin PO2>
requires (PO2{} == point_origin)
[[nodiscard]]
constexpr
quantity_type const&
quantity_ref_from(PO2) const & noexcept;
Synopsis
Declared in <mp-units/framework/quantity_point.h>
template<PointOrigin PO2>
requires (PO2{} == point_origin)
[[nodiscard]]
constexpr
quantity_type &
quantity_ref_from(PO2) & noexcept;
Conversion operators
Synopses
Declared in <mp-units/framework/quantity_point.h>
Conversion to QP_
template<
typename QP_,
QuantityPointLike QP = std::remove_cvref_t<QP_>>
requires (point_origin == quantity_point_like_traits<QP>::point_origin) &&
std::convertible_to<quantity_type, quantity<quantity_point_like_traits<QP>::reference,
typename quantity_point_like_traits<QP>::rep>>
[[nodiscard]]
constexpr
explicit(quantity_point_like_traits<QP>::explicit_export || !std::convertible_to<quantity_type, quantity<quantity_point_like_traits<QP>::reference, typename quantity_point_like_traits<QP>::rep>>)
operator QP_() && noexcept(noexcept(quantity_point_like_traits<QP>::from_numerical_value(this->quantity_from_origin_is_an_implementation_detail_.numerical_value_is_an_implementation_detail_)) && std::is_nothrow_move_constructible_v<rep>);
» more...
Conversion to QP_
template<
typename QP_,
QuantityPointLike QP = std::remove_cvref_t<QP_>>
requires (point_origin == quantity_point_like_traits<QP>::point_origin) &&
std::convertible_to<quantity_type, quantity<quantity_point_like_traits<QP>::reference,
typename quantity_point_like_traits<QP>::rep>>
[[nodiscard]]
constexpr
explicit(quantity_point_like_traits<QP>::explicit_export || !std::convertible_to<quantity_type, quantity<quantity_point_like_traits<QP>::reference, typename quantity_point_like_traits<QP>::rep>>)
operator QP_() const & noexcept(noexcept(quantity_point_like_traits<QP>::from_numerical_value(this->quantity_from_origin_is_an_implementation_detail_.numerical_value_is_an_implementation_detail_)) && std::is_nothrow_copy_constructible_v<rep>);
» more...
Conversion to QP_
Synopsis
Declared in <mp-units/framework/quantity_point.h>
template<
typename QP_,
QuantityPointLike QP = std::remove_cvref_t<QP_>>
requires (point_origin == quantity_point_like_traits<QP>::point_origin) &&
std::convertible_to<quantity_type, quantity<quantity_point_like_traits<QP>::reference,
typename quantity_point_like_traits<QP>::rep>>
[[nodiscard]]
constexpr
explicit(quantity_point_like_traits<QP>::explicit_export || !std::convertible_to<quantity_type, quantity<quantity_point_like_traits<QP>::reference, typename quantity_point_like_traits<QP>::rep>>)
operator QP_() && noexcept(noexcept(quantity_point_like_traits<QP>::from_numerical_value(this->quantity_from_origin_is_an_implementation_detail_.numerical_value_is_an_implementation_detail_)) && std::is_nothrow_move_constructible_v<rep>);
Return Value
The object converted to QP_
Conversion to QP_
Synopsis
Declared in <mp-units/framework/quantity_point.h>
template<
typename QP_,
QuantityPointLike QP = std::remove_cvref_t<QP_>>
requires (point_origin == quantity_point_like_traits<QP>::point_origin) &&
std::convertible_to<quantity_type, quantity<quantity_point_like_traits<QP>::reference,
typename quantity_point_like_traits<QP>::rep>>
[[nodiscard]]
constexpr
explicit(quantity_point_like_traits<QP>::explicit_export || !std::convertible_to<quantity_type, quantity<quantity_point_like_traits<QP>::reference, typename quantity_point_like_traits<QP>::rep>>)
operator QP_() const & noexcept(noexcept(quantity_point_like_traits<QP>::from_numerical_value(this->quantity_from_origin_is_an_implementation_detail_.numerical_value_is_an_implementation_detail_)) && std::is_nothrow_copy_constructible_v<rep>);
Return Value
The object converted to QP_
Synopsis
Declared in <mp-units/framework/quantity_point.h>
[[nodiscard]]
constexpr
static
quantity_point
max() noexcept
requires requires { quantity_type::max(); };
Synopsis
Declared in <mp-units/framework/quantity_point.h>
[[nodiscard]]
constexpr
static
quantity_point
min() noexcept
requires requires { quantity_type::min(); };
Synopsis
Declared in <mp-units/framework/quantity_point.h>
quantity_type quantity_from_origin_is_an_implementation_detail_;
Synopsis
Declared in <mp-units/framework/quantity_point.h>
inline constexpr static
PointOrigin auto absolute_point_origin = detail::get_absolute_point_origin(PO);
Synopsis
Declared in <mp-units/framework/quantity_point.h>
inline constexpr static
Dimension auto dimension = quantity_spec.dimension;
Synopsis
Declared in <mp-units/framework/quantity_point.h>
inline constexpr static
PointOrigin auto point_origin = PO;
Synopsis
Declared in <mp-units/framework/quantity_point.h>
inline constexpr static
QuantitySpec auto quantity_spec = get_quantity_spec(reference);
Synopsis
Declared in <mp-units/framework/quantity_point.h>
inline constexpr static
Reference auto reference = R;
Synopsis
Declared in <mp-units/framework/quantity_point.h>
inline constexpr static
Unit auto unit = get_unit(reference);
Provides support for external quantity point-like types
Synopsis
Declared in <mp-units/framework/customization_points.h>
template<typename T>
struct quantity_point_like_traits;
Description
The type trait should provide nested reference
and origin
objects, a type alias rep,
and static member functions to_numerical_value(T)
that returns the raw value of the the quantity being the offset of the point from the origin and from_numerical_value(rep)
that returns T
formed this raw value.
If the following expression is true,
the specified conversion will be explicit: - explicit_import
for the conversion from T
to a quantity_point
type, - explicit_export
for the conversion from a quantity_point
type to T.
Usage example can be found in mp-units/systems/si/chrono.h
header file.
Template Parameters
Name
Description
T
the type to provide support for
Synopsis
Declared in <mp-units/framework/quantity_spec.h>
template<auto...>
struct quantity_spec;
Synopsis
Declared in <mp-units/framework/quantity_spec.h>
template<
/* implementation-defined */ auto Dim,
/* implementation-defined */ auto Args...>
struct quantity_spec <QS, Args...>
: /* implementation-defined */
Base Classes
Name
Description
/* implementation-defined */
Types
Static Data Members
Synopsis
Declared in <mp-units/framework/quantity_spec.h>
using _base_type_ = quantity_spec ;
Synopsis
Declared in <mp-units/framework/quantity_spec.h>
inline constexpr static
auto _equation_ = Eq;
Synopsis
Declared in <mp-units/framework/quantity_spec.h>
inline constexpr static
auto _parent_ = QS;
Synopsis
Declared in <mp-units/framework/quantity_spec.h>
inline constexpr static
quantity_character character = detail::quantity_character_init<Args...>(QS.character);
Synopsis
Declared in <mp-units/framework/quantity_spec.h>
inline constexpr static
Dimension auto dimension = _parent_.dimension;
Synopsis
Declared in <mp-units/framework/quantity_spec.h>
template<
/* implementation-defined */ auto QS,
/* implementation-defined */ auto Eq,
/* implementation-defined */ auto Args...>
requires (explicitly_convertible(Eq, QS))
struct quantity_spec <QS, Eq, Args...>
: /* implementation-defined */
Base Classes
Name
Description
/* implementation-defined */
Types
Static Data Members
Synopsis
Declared in <mp-units/framework/quantity_spec.h>
using _base_type_ = quantity_spec ;
Synopsis
Declared in <mp-units/framework/quantity_spec.h>
inline constexpr static
auto _equation_ = Eq;
Synopsis
Declared in <mp-units/framework/quantity_spec.h>
inline constexpr static
auto _parent_ = QS;
Synopsis
Declared in <mp-units/framework/quantity_spec.h>
inline constexpr static
quantity_character character = detail::quantity_character_init<Args...>(Eq.character);
Synopsis
Declared in <mp-units/framework/quantity_spec.h>
inline constexpr static
Dimension auto dimension = _parent_.dimension;
Quantity reference type
Synopsis
Declared in <mp-units/framework/reference.h>
template<
QuantitySpec Q,
Unit U>
struct reference;
Description
Quantity reference describes all the properties of a quantity besides its representation type.
In most cases this class template is not explicitly instantiated by the user. It is implicitly instantiated by the library's framework while binding a quantity specification with a compatible unit.
{.cpp}
Reference auto kmph = isq::speed[km / h];
QuantityOf auto speed = 90 * kmph;
The following syntaxes are not allowed: 2 / kmph
, kmph 3, `kmph / 4
, 70 isq::length[km] / isq:time[h]
.
Synopsis
Declared in <mp-units/framework/quantity_point.h>
template<QuantityPoint auto QP>
struct relative_point_origin
: /* implementation-defined */
Base Classes
Name
Description
/* implementation-defined */
Static Data Members
Synopsis
Declared in <mp-units/framework/quantity_point.h>
inline constexpr static
PointOrigin auto _absolute_point_origin_ = QP.absolute_point_origin;
Synopsis
Declared in <mp-units/framework/quantity_point.h>
inline constexpr static
QuantityPoint auto _quantity_point_ = QP;
Synopsis
Declared in <mp-units/framework/quantity_point.h>
inline constexpr static
QuantitySpec auto _quantity_spec_ = []() {
// select the strongest of specs
if constexpr (detail::QuantityKindSpec<MP_UNITS_NONCONST_TYPE(QP.quantity_spec)>)
return QP.point_origin._quantity_spec_;
else
return QP.quantity_spec;
}();
A type trait that defines zero, one, min, and max for a representation type
Synopsis
Declared in <mp-units/framework/customization_points.h>
template<typename Rep>
struct representation_values
: std::chrono::duration_values<Rep>
Base Classes
Name
Description
std::chrono::duration_values<Rep>
Static Member Functions
Description
The zero, one, min, and max member functions in mp_units::quantity forward their work to these methods. This type can be specialized if the representation Rep requires a specific implementation to return these quantity objects.
Template Parameters
Name
Description
Rep
a representation type for which a type trait is defined
Synopsis
Declared in <mp-units/framework/customization_points.h>
constexpr
static
Rep
one() noexcept
requires std::constructible_from<Rep, int>;
Unit being a scaled version of another unit
Synopsis
Declared in <mp-units/framework/unit.h>
template<
UnitMagnitude auto M,
Unit U>
requires (M != detail::unit_magnitude<>{} && M != mag<1>)
struct scaled_unit final
: /* implementation-defined */
Base Classes
Name
Description
/* implementation-defined */
Description
NOTE
User should not instantiate this type! It is not exported from the C++ module. The library will instantiate this type automatically based on the unit arithmetic equation provided by the user.
Template Parameters
Name
Description
M
magnitude describing the scale factor
U
reference unit being scaled
Synopsis
Declared in <mp-units/random.h>
template<Quantity Q>
requires std::floating_point<typename Q::rep>
struct student_t_distribution
: std::student_t_distribution<Q::rep>
Base Classes
Name
Description
std::student_t_distribution<Q::rep>
Types
Member Functions
Synopsis
Declared in <mp-units/random.h>
using base = std::student_t_distribution<rep>;
Synopsis
Declared in <mp-units/random.h>
using rep = Q::rep;
Constructors
Default constructor
Synopsis
Declared in <mp-units/random.h>
student_t_distribution();
Construct from rep
Synopsis
Declared in <mp-units/random.h>
explicit
student_t_distribution(rep const& n);
Parameters
Name
Description
n
The object to copy construct from
Synopsis
Declared in <mp-units/random.h>
[[nodiscard]]
Q
max() const;
Synopsis
Declared in <mp-units/random.h>
[[nodiscard]]
Q
min() const;
Synopsis
Declared in <mp-units/random.h>
template<typename Generator>
Q
operator()(Generator& g);
A symbol text representation
Synopsis
Declared in <mp-units/framework/symbol_text.h>
template<
std::size_t N,
std::size_t M>
class symbol_text;
Member Functions
Data Members
Description
This class template is responsible for definition and handling of a symbol text representation. In the libary it is used to define symbols of units and prefixes. Each symbol can have two versions: UTF-8 and portable.
Template Parameters
Name
Description
N
The size of a UTF-8 symbol
M
The size of the portable symbol
Constructors
Construct from char
Synopsis
Declared in <mp-units/framework/symbol_text.h>
constexpr
explicit(false)
symbol_text(char ch);
Parameters
Name
Description
ch
The value to construct from
Construct from fixed_string
Synopsis
Declared in <mp-units/framework/symbol_text.h>
constexpr
explicit(false)
symbol_text(fixed_string<N> const& txt);
Parameters
Name
Description
txt
The object to copy construct from
Construct from char
Synopsis
Declared in <mp-units/framework/symbol_text.h>
consteval
explicit(false)
symbol_text(char const(& txt)[]);
Parameters
Name
Description
txt
The value to construct from
Synopsis
Declared in <mp-units/framework/symbol_text.h>
consteval
symbol_text(
char8_t const(& u)[],
char const(& a)[]);
Synopsis
Declared in <mp-units/framework/symbol_text.h>
[[deprecated]]
constexpr
auto const&
ascii() const;
Synopsis
Declared in <mp-units/framework/symbol_text.h>
[[nodiscard]]
constexpr
bool
empty() const;
Synopsis
Declared in <mp-units/framework/symbol_text.h>
[[nodiscard]]
constexpr
auto const&
portable() const;
Synopsis
Declared in <mp-units/framework/symbol_text.h>
[[deprecated]]
constexpr
auto const&
unicode() const;
Synopsis
Declared in <mp-units/framework/symbol_text.h>
[[nodiscard]]
constexpr
auto const&
utf8() const;
Synopsis
Declared in <mp-units/framework/symbol_text.h>
fixed_string<M> portable_;
System-specific reference
Synopsis
Declared in <mp-units/framework/system_reference.h>
template<
QuantitySpec auto Q,
Unit auto CoU>
requires (!MP_UNITS_ASSOCIATED_UNIT_T(decltype(CoU))) || (CoU == one)
struct system_reference;
Member Functions
Static Data Members
Description
This type is used in rare cases where more than one base quantity in a specific system of units uses the same unit. For example in a hypothetical system of natural units where constant for speed of light c = 1
, length and time could be measured in seconds. In such cases system_reference
has to be used to explicitly express such a binding.
For example:
{.cpp}
// hypothetical natural system of units for c=1
inline constexpr struct second final : named_unit<"s"> {} second;
inline constexpr struct minute final : named_unit<"min", mag<60> * second> {} minute;
inline constexpr struct gram final : named_unit<"g"> {} gram;
inline constexpr auto kilogram = si::kilo;
inline constexpr struct time : system_reference {} time;
inline constexpr struct length : system_reference {} length;
inline constexpr struct speed : system_reference {} speed;
inline constexpr struct force : system_reference {} force;
Template Parameters
Name
Description
Q
quantity for which a unit is being assigned
CoU
coherent unit for a quantity in this system
Subscript operator
Synopsis
Declared in <mp-units/framework/system_reference.h>
template</* implementation-defined */ U>
[[nodiscard]]
constexpr
reference<decltype(Q), U>
operator[](U rhs) const;
Return Value
Quantity reference type
Parameters
Name
Description
rhs
The right operand
Synopsis
Declared in <mp-units/framework/system_reference.h>
inline constexpr static
auto coherent_unit = CoU;
Synopsis
Declared in <mp-units/framework/system_reference.h>
inline constexpr static
auto quantity_spec = Q;
Synopsis
Declared in <mp-units/random.h>
template<Quantity Q>
requires std::integral<typename Q::rep>
struct uniform_int_distribution
: std::uniform_int_distribution<Q::rep>
Base Classes
Name
Description
std::uniform_int_distribution<Q::rep>
Types
Member Functions
Synopsis
Declared in <mp-units/random.h>
using base = std::uniform_int_distribution<rep>;
Synopsis
Declared in <mp-units/random.h>
using rep = Q::rep;
Constructors
Default constructor
Synopsis
Declared in <mp-units/random.h>
uniform_int_distribution();
Synopsis
Declared in <mp-units/random.h>
uniform_int_distribution(
Q const& a,
Q const& b);
Synopsis
Declared in <mp-units/random.h>
[[nodiscard]]
Q
a() const;
Synopsis
Declared in <mp-units/random.h>
[[nodiscard]]
Q
b() const;
Synopsis
Declared in <mp-units/random.h>
[[nodiscard]]
Q
max() const;
Synopsis
Declared in <mp-units/random.h>
[[nodiscard]]
Q
min() const;
Synopsis
Declared in <mp-units/random.h>
template<typename Generator>
Q
operator()(Generator& g);
Synopsis
Declared in <mp-units/random.h>
template<Quantity Q>
requires std::floating_point<typename Q::rep>
struct uniform_real_distribution
: std::uniform_real_distribution<Q::rep>
Base Classes
Name
Description
std::uniform_real_distribution<Q::rep>
Types
Member Functions
Synopsis
Declared in <mp-units/random.h>
using base = std::uniform_real_distribution<rep>;
Synopsis
Declared in <mp-units/random.h>
using rep = Q::rep;
Constructors
Default constructor
Synopsis
Declared in <mp-units/random.h>
uniform_real_distribution();
Synopsis
Declared in <mp-units/random.h>
uniform_real_distribution(
Q const& a,
Q const& b);
Synopsis
Declared in <mp-units/random.h>
[[nodiscard]]
Q
a() const;
Synopsis
Declared in <mp-units/random.h>
[[nodiscard]]
Q
b() const;
Synopsis
Declared in <mp-units/random.h>
[[nodiscard]]
Q
max() const;
Synopsis
Declared in <mp-units/random.h>
[[nodiscard]]
Q
min() const;
Synopsis
Declared in <mp-units/random.h>
template<typename Generator>
Q
operator()(Generator& g);
Synopsis
Declared in <mp-units/framework/unit_symbol_formatting.h>
struct unit_symbol_formatting;
Data Members
Synopsis
Declared in <mp-units/framework/unit_symbol_formatting.h>
character_set char_set = character_set::default_character_set;
Synopsis
Declared in <mp-units/framework/unit_symbol_formatting.h>
unit_symbol_separator separator = unit_symbol_separator::default_separator;
Synopsis
Declared in <mp-units/framework/unit_symbol_formatting.h>
unit_symbol_solidus solidus = unit_symbol_solidus::default_denominator;
Synopsis
Declared in <mp-units/random.h>
template<Quantity Q>
requires std::floating_point<typename Q::rep>
struct weibull_distribution
: std::weibull_distribution<Q::rep>
Base Classes
Name
Description
std::weibull_distribution<Q::rep>
Types
Member Functions
Synopsis
Declared in <mp-units/random.h>
using base = std::weibull_distribution<rep>;
Synopsis
Declared in <mp-units/random.h>
using rep = Q::rep;
Constructors
Default constructor
Synopsis
Declared in <mp-units/random.h>
weibull_distribution();
Synopsis
Declared in <mp-units/random.h>
weibull_distribution(
rep const& a,
rep const& b);
Synopsis
Declared in <mp-units/random.h>
[[nodiscard]]
Q
max() const;
Synopsis
Declared in <mp-units/random.h>
[[nodiscard]]
Q
min() const;
Synopsis
Declared in <mp-units/random.h>
template<typename Generator>
Q
operator()(Generator& g);
Synopsis
Declared in <mp-units/framework/symbol_text.h>
enum class character_set : int8_t;
Members
Name
Description
utf8
unicode
portable
ascii
default_character_set
default_encoding
Quantity character
Synopsis
Declared in <mp-units/framework/representation_concepts.h>
enum class quantity_character : int8_t;
Members
Name
Description
real_scalar
complex_scalar
vector
tensor
Description
Scalars, vectors and tensors are mathematical objects that can be used to denote certain physical quantities and their values. They are as such independent of the particular choice of a coordinate system, whereas each scalar component of a vector or a tensor and each component vector and component tensor depend on that choice.
A scalar is a physical quantity that has magnitude but no direction. It might be a real or complex number which affects which operations are allowed on a quantity.
Vectors are physical quantities that possess both magnitude and direction and whose operations obey the axioms of a vector space.
Tensors can be used to describe more general physical quantities. For example, the Cauchy stress tensor possess magnitude, direction, and orientation qualities.
Synopsis
Declared in <mp-units/framework/unit_symbol_formatting.h>
enum class unit_symbol_separator : int8_t;
Members
Name
Description
space
half_high_dot
default_separator
Synopsis
Declared in <mp-units/framework/unit_symbol_formatting.h>
enum class unit_symbol_solidus : int8_t;
Members
Name
Description
one_denominator
always
never
default_denominator
Computes the absolute value of a quantity
Synopsis
Declared in <mp-units/math.h>
template<
auto R,
typename Rep>
requires requires(Rep v) { abs(v); } || requires(Rep v) { std::abs(v); }
[[nodiscard]]
constexpr
quantity<R, Rep>
abs(quantity<R, Rep> const& q) noexcept;
Return Value
Quantity The absolute value of a provided quantity
Parameters
Name
Description
q
Quantity being the base of the operation
Synopsis
Declared in <mp-units/framework/quantity_spec.h>
template<
QuantitySpec From,
QuantitySpec To>
[[nodiscard]]
consteval
bool
castable(
From from,
To to);
cbrt
overloads
Synopses
Declared in <mp-units/framework/dimension.h>
Computes the cubic root of a dimension
[[nodiscard]]
consteval
Unit auto
cbrt (auto d);
» more...
[[nodiscard]]
consteval
/* implementation-defined */
cbrt (reference );
» more...
Computes the cubic root of a quantity
template<
auto R,
typename Rep>
requires requires(Rep v) { cbrt(v); } || requires(Rep v) { std::cbrt(v); }
[[nodiscard]]
constexpr
quantity<cbrt(R), Rep>
cbrt (quantity<R, Rep> const& q) noexcept;
» more...
Return Value
Dimension The result of computation
QuantitySpec The result of computation
Unit The result of computation
Quantity The result of computation
Parameters
Name
Description
d
Dimension being the base of the operation
q
Quantity specification being the base of the operation
u
Unit being the base of the operation
Computes the cubic root of a dimension
Synopsis
Declared in <mp-units/framework/dimension.h>
[[nodiscard]]
consteval
Unit auto
cbrt(auto d);
Return Value
Dimension The result of computation
QuantitySpec The result of computation
Unit The result of computation
Parameters
Name
Description
d
Dimension being the base of the operation
q
Quantity specification being the base of the operation
u
Unit being the base of the operation
Synopsis
Declared in <mp-units/framework/reference.h>
[[nodiscard]]
consteval
/* implementation-defined */
cbrt(reference );
Computes the cubic root of a quantity
Synopsis
Declared in <mp-units/math.h>
template<
auto R,
typename Rep>
requires requires(Rep v) { cbrt(v); } || requires(Rep v) { std::cbrt(v); }
[[nodiscard]]
constexpr
quantity<cbrt(R), Rep>
cbrt(quantity<R, Rep> const& q) noexcept;
Description
Both the quantity value and its quantity specification are the base of the operation.
Return Value
Quantity The result of computation
Parameters
Name
Description
q
Quantity being the base of the operation
Computes the smallest quantity with integer representation and unit type To with its number not less than q
Synopsis
Declared in <mp-units/math.h>
template<
Unit auto To,
auto R,
typename Rep>
[[nodiscard]]
constexpr
quantity<detail::clone_reference_with<To>(R), Rep>
ceil(quantity<R, Rep> const& q) noexcept
requires requires { q.force_in(To); } &&
((treat_as_floating_point<Rep> && (requires(Rep v) { ceil(v); } || requires(Rep v) { std::ceil(v); })) ||
(!treat_as_floating_point<Rep> && requires { representation_values<Rep>::one(); }));
Return Value
Quantity The rounded quantity with unit type To
Template Parameters
Name
Description
q
Quantity being the base of the operation
Parameters
Name
Description
q
A quantity
Synopses
Declared in <mp-units/ext/type_traits.h>
template<
typename T,
auto Vs...>
[[nodiscard]]
consteval
bool
contains ();
» more...
template<
template<typename...> typename T,
typename... Ts>
[[nodiscard]]
consteval
bool
contains ();
» more...
template<
template<auto...> typename T,
typename... Ts>
[[nodiscard]]
consteval
bool
contains ();
» more...
Synopsis
Declared in <mp-units/ext/type_traits.h>
template<
typename T,
auto Vs...>
[[nodiscard]]
consteval
bool
contains();
Synopsis
Declared in <mp-units/ext/type_traits.h>
template<
template<typename...> typename T,
typename... Ts>
[[nodiscard]]
consteval
bool
contains();
Synopsis
Declared in <mp-units/ext/type_traits.h>
template<
template<auto...> typename T,
typename... Ts>
[[nodiscard]]
consteval
bool
contains();
Computes the cubic power of a unit
Synopsis
Declared in <mp-units/framework/unit.h>
[[nodiscard]]
consteval
Unit auto
cubic(auto u);
Return Value
Unit The result of computation
Parameters
Name
Description
u
Unit being the base of the operation
Synopsis
Declared in <mp-units/framework/dimension.h>
template<
dimension_symbol_formatting fmt = dimension_symbol_formatting{},
typename CharT = char,
Dimension D>
[[nodiscard]]
consteval
std::basic_string_view<CharT>
dimension_symbol(D);
Synopsis
Declared in <mp-units/framework/dimension.h>
template<
typename CharT = char,
std::output_iterator<CharT> Out,
Dimension D>
constexpr
Out
dimension_symbol_to(
Out out,
D d,
dimension_symbol_formatting const& fmt = dimension_symbol_formatting{});
Returns the epsilon of the quantity
Synopsis
Declared in <mp-units/math.h>
template<
typename Rep,
Reference R>
requires RepresentationOf<Rep, get_quantity_spec(R{})> && requires { std::numeric_limits<Rep>::epsilon(); }
[[deprecated, nodiscard]]
constexpr
quantity<R{}, Rep>
epsilon(R r) noexcept;
Description
The returned value is defined by a .
Return Value
Quantity The epsilon value for quantity's representation type
Template Parameters
Name
Description
Q
Quantity type being the base of the operation
Computes Euler's raised to the given power
Description
NOTE
Such an operation has sense only for a dimensionless quantity.
Return Value
Quantity The value of the same quantity type
Parameters
Name
Description
q
Quantity being the base of the operation
Synopsis
Declared in <mp-units/framework/quantity_spec.h>
template<
QuantitySpec From,
QuantitySpec To>
[[nodiscard]]
consteval
bool
explicitly_convertible(
From from,
To to);
Computes the largest quantity with integer representation and unit type To with its number not greater than q
Synopsis
Declared in <mp-units/math.h>
template<
Unit auto To,
auto R,
typename Rep>
[[nodiscard]]
constexpr
quantity<detail::clone_reference_with<To>(R), Rep>
floor(quantity<R, Rep> const& q) noexcept
requires requires { q.force_in(To); } &&
((treat_as_floating_point<Rep> && (requires(Rep v) { floor(v); } || requires(Rep v) { std::floor(v); })) ||
(!treat_as_floating_point<Rep> && requires { representation_values<Rep>::one(); }));
Return Value
Quantity The rounded quantity with unit type To
Template Parameters
Name
Description
q
Quantity being the base of the operation
Parameters
Name
Description
q
A quantity
fma
overloads
Synopses
Declared in <mp-units/math.h>
Computes the fma of 3 quantities
template<
auto R,
auto S,
auto T,
typename Rep1,
typename Rep2,
typename Rep3>
requires requires { get_common_quantity_spec(get_quantity_spec(R) * get_quantity_spec(S), get_quantity_spec(T)); } &&
(equivalent(get_unit(R) * get_unit(S), get_unit(T))) && requires(Rep1 v1, Rep2 v2, Rep3 v3) {
requires requires { fma(v1, v2, v3); } || requires { std::fma(v1, v2, v3); };
}
[[nodiscard]]
constexpr
QuantityOf<get_common_quantity_spec(get_quantity_spec(R) * get_quantity_spec(S), get_quantity_spec(T))> auto
fma (
quantity<R, Rep1> const& a,
quantity<S, Rep2> const& x,
quantity<T, Rep3> const& b) noexcept;
» more...
Computes the fma of 2 quantities and a quantity point
template<
auto R,
auto S,
auto T,
auto Origin,
typename Rep1,
typename Rep2,
typename Rep3>
requires requires { get_common_quantity_spec(get_quantity_spec(R) * get_quantity_spec(S), get_quantity_spec(T)); } &&
(equivalent(get_unit(R) * get_unit(S), get_unit(T))) && requires(Rep1 v1, Rep2 v2, Rep3 v3) {
requires requires { fma(v1, v2, v3); } || requires { std::fma(v1, v2, v3); };
}
[[nodiscard]]
constexpr
QuantityPointOf<get_common_quantity_spec(get_quantity_spec(R) * get_quantity_spec(S), get_quantity_spec(T))> auto
fma (
quantity<R, Rep1> const& a,
quantity<S, Rep2> const& x,
quantity_point<T, Origin, Rep3> const& b) noexcept;
» more...
Return Value
Quantity: The nearest floating point representable to ax+b
QuantityPoint: The nearest floating point representable to ax+b
Parameters
Name
Description
a:
Multiplicand
x:
Multiplicand
b:
Addend
Computes the fma of 3 quantities
Synopsis
Declared in <mp-units/math.h>
template<
auto R,
auto S,
auto T,
typename Rep1,
typename Rep2,
typename Rep3>
requires requires { get_common_quantity_spec(get_quantity_spec(R) * get_quantity_spec(S), get_quantity_spec(T)); } &&
(equivalent(get_unit(R) * get_unit(S), get_unit(T))) && requires(Rep1 v1, Rep2 v2, Rep3 v3) {
requires requires { fma(v1, v2, v3); } || requires { std::fma(v1, v2, v3); };
}
[[nodiscard]]
constexpr
QuantityOf<get_common_quantity_spec(get_quantity_spec(R) * get_quantity_spec(S), get_quantity_spec(T))> auto
fma(
quantity<R, Rep1> const& a,
quantity<S, Rep2> const& x,
quantity<T, Rep3> const& b) noexcept;
Return Value
Quantity: The nearest floating point representable to ax+b
Parameters
Name
Description
a:
Multiplicand
x:
Multiplicand
b:
Addend
a
A quantity
x
A quantity
b
A quantity
Computes the fma of 2 quantities and a quantity point
Synopsis
Declared in <mp-units/math.h>
template<
auto R,
auto S,
auto T,
auto Origin,
typename Rep1,
typename Rep2,
typename Rep3>
requires requires { get_common_quantity_spec(get_quantity_spec(R) * get_quantity_spec(S), get_quantity_spec(T)); } &&
(equivalent(get_unit(R) * get_unit(S), get_unit(T))) && requires(Rep1 v1, Rep2 v2, Rep3 v3) {
requires requires { fma(v1, v2, v3); } || requires { std::fma(v1, v2, v3); };
}
[[nodiscard]]
constexpr
QuantityPointOf<get_common_quantity_spec(get_quantity_spec(R) * get_quantity_spec(S), get_quantity_spec(T))> auto
fma(
quantity<R, Rep1> const& a,
quantity<S, Rep2> const& x,
quantity_point<T, Origin, Rep3> const& b) noexcept;
Return Value
QuantityPoint: The nearest floating point representable to ax+b
Parameters
Name
Description
a:
Multiplicand
x:
Multiplicand
b:
Addend
a
A quantity
x
A quantity
b
A quantity point
Computes the floating-point remainder of the division operation x / y.
Synopsis
Declared in <mp-units/math.h>
template<
auto R1,
typename Rep1,
auto R2,
typename Rep2>
requires requires(Rep1 v1, Rep2 v2) {
get_common_reference(R1, R2);
requires requires { fmod(v1, v2); } || requires { std::fmod(v1, v2); };
}
[[nodiscard]]
constexpr
QuantityOf<get_quantity_spec(R1)> auto
fmod(
quantity<R1, Rep1> const& x,
quantity<R2, Rep2> const& y) noexcept;
Parameters
Name
Description
x
A quantity
y
A quantity
Synopses
Declared in <mp-units/ext/type_traits.h>
template<
typename T,
same_as<T> auto V>
[[nodiscard]]
consteval
auto
get ();
» more...
template<
template<typename...> typename T,
typename T1>
requires is_specialization_of<T1, T>
[[nodiscard]]
consteval
auto
get ();
» more...
template<
template<auto...> typename T,
typename T1>
requires is_specialization_of_v<T1, T>
[[nodiscard]]
consteval
auto
get ();
» more...
template<
typename T,
auto V1,
auto V2,
auto Vs...>
[[nodiscard]]
consteval
auto
get ();
» more...
template<
template<typename...> typename T,
typename T1,
typename T2,
typename... Ts>
[[nodiscard]]
consteval
auto
get ();
» more...
template<
template<auto...> typename T,
typename T1,
typename T2,
typename... Ts>
[[nodiscard]]
consteval
auto
get ();
» more...
Synopsis
Declared in <mp-units/ext/type_traits.h>
template<
typename T,
same_as<T> auto V>
[[nodiscard]]
consteval
auto
get();
Synopsis
Declared in <mp-units/ext/type_traits.h>
template<
template<typename...> typename T,
typename T1>
requires is_specialization_of<T1, T>
[[nodiscard]]
consteval
auto
get();
Synopsis
Declared in <mp-units/ext/type_traits.h>
template<
template<auto...> typename T,
typename T1>
requires is_specialization_of_v<T1, T>
[[nodiscard]]
consteval
auto
get();
Synopsis
Declared in <mp-units/ext/type_traits.h>
template<
typename T,
auto V1,
auto V2,
auto Vs...>
[[nodiscard]]
consteval
auto
get();
Synopsis
Declared in <mp-units/ext/type_traits.h>
template<
template<typename...> typename T,
typename T1,
typename T2,
typename... Ts>
[[nodiscard]]
consteval
auto
get();
Synopsis
Declared in <mp-units/ext/type_traits.h>
template<
template<auto...> typename T,
typename T1,
typename T2,
typename... Ts>
[[nodiscard]]
consteval
auto
get();
Synopsis
Declared in <mp-units/framework/unit.h>
[[nodiscard]]
consteval
auto
get_canonical_unit(auto u);
Synopsis
Declared in <mp-units/framework/quantity_spec.h>
[[nodiscard]]
consteval
QuantitySpec auto
get_common_quantity_spec(auto q);
Synopsis
Declared in <mp-units/framework/quantity_spec.h>
template<
QuantitySpec Q1,
QuantitySpec Q2>
requires (detail::have_common_quantity_spec(Q1{}, Q2{}))
[[nodiscard]]
consteval
QuantitySpec auto
get_common_quantity_spec(
Q1,
Q2);
Synopsis
Declared in <mp-units/framework/quantity_spec.h>
[[nodiscard]]
consteval
QuantitySpec auto
get_common_quantity_spec(
auto q1,
auto q2,
auto q3,
auto... rest)
requires requires { mp_units::get_common_quantity_spec(mp_units::get_common_quantity_spec(q1, q2), q3, rest...); };
Synopsis
Declared in <mp-units/framework/reference.h>
template<
Reference R1,
Reference R2,
Reference ... Rest>
[[nodiscard]]
consteval
Reference auto
get_common_reference(
auto u1,
auto u2,
auto... rest)
requires (!(MP_UNITS_ASSOCIATED_UNIT_T(R1) && MP_UNITS_ASSOCIATED_UNIT_T(R2) &&
(... && MP_UNITS_ASSOCIATED_UNIT_T(Rest)))) &&
requires {
get_common_quantity_spec(get_quantity_spec(r1), get_quantity_spec(r2), get_quantity_spec(rest)...);
get_common_unit(get_unit(r1), get_unit(r2), get_unit(rest)...);
};
Synopses
Declared in <mp-units/framework/unit.h>
[[nodiscard]]
consteval
Unit auto
get_common_unit (auto u);
» more...
template<
Unit ... Us,
/* implementation-defined */ NewUnit>
[[nodiscard]]
consteval
Unit auto
get_common_unit (
NewUnit nu,
common_unit<Us...> cu);
» more...
template<
Unit U1,
/* implementation-defined */ U2>
[[nodiscard]]
consteval
Unit auto
get_common_unit (
U1 u1,
U2 u2);
» more...
template<
Unit ... Us,
/* implementation-defined */ NewUnit>
[[nodiscard]]
consteval
Unit auto
get_common_unit (
common_unit<Us...> ,
NewUnit);
» more...
template<
Unit Front,
Unit ... Rest,
Unit ... Us>
requires (detail::UnitConvertibleTo<common_unit<Front, Rest...>, common_unit<Us...>{}>)
[[nodiscard]]
consteval
Unit auto
get_common_unit (
common_unit<Front, Rest...> ,
common_unit<Us...> );
» more...
[[nodiscard]]
consteval
Unit auto
get_common_unit (
auto u1,
auto u2,
auto u3,
auto... rest)
requires requires { get_common_unit(get_common_unit(u1, u2), u3, rest...); };
» more...
Synopsis
Declared in <mp-units/framework/unit.h>
[[nodiscard]]
consteval
Unit auto
get_common_unit(auto u);
Synopsis
Declared in <mp-units/framework/unit.h>
template<
Unit ... Us,
/* implementation-defined */ NewUnit>
[[nodiscard]]
consteval
Unit auto
get_common_unit(
NewUnit nu,
common_unit<Us...> cu);
Synopsis
Declared in <mp-units/framework/unit.h>
template<
Unit U1,
/* implementation-defined */ U2>
[[nodiscard]]
consteval
Unit auto
get_common_unit(
U1 u1,
U2 u2);
Synopsis
Declared in <mp-units/framework/unit.h>
template<
Unit ... Us,
/* implementation-defined */ NewUnit>
[[nodiscard]]
consteval
Unit auto
get_common_unit(
common_unit<Us...> ,
NewUnit);
Synopsis
Declared in <mp-units/framework/unit.h>
[[nodiscard]]
consteval
Unit auto
get_common_unit(
auto u1,
auto u2,
auto u3,
auto... rest)
requires requires { get_common_unit(get_common_unit(u1, u2), u3, rest...); };
Synopsis
Declared in <mp-units/framework/quantity_spec.h>
template<QuantitySpec Q>
[[nodiscard]]
consteval
/* implementation-defined */ auto
get_kind(Q);
Synopsis
Declared in <mp-units/framework/reference_concepts.h>
template<AssociatedUnit U>
[[nodiscard]]
consteval
QuantitySpec auto
get_quantity_spec(U);
Synopsis
Declared in <mp-units/framework/reference_concepts.h>
template<
typename Q,
typename U>
[[nodiscard]]
consteval
QuantitySpec auto
get_quantity_spec(reference<Q, U> );
Synopsis
Declared in <mp-units/framework/reference_concepts.h>
[[nodiscard]]
consteval
Unit auto
get_unit(auto u);
Synopsis
Declared in <mp-units/framework/reference_concepts.h>
template<
typename Q,
typename U>
[[nodiscard]]
consteval
Unit auto
get_unit(reference<Q, U> );
hypot
overloads
Synopses
Declared in <mp-units/math.h>
Computes the square root of the sum of the squares of x and y, without undue overflow or underflow at intermediate stages of the computation
template<
auto R1,
typename Rep1,
auto R2,
typename Rep2>
requires requires(Rep1 v1, Rep2 v2) {
get_common_reference(R1, R2);
requires requires { hypot(v1, v2); } || requires { std::hypot(v1, v2); };
}
[[nodiscard]]
constexpr
QuantityOf<get_quantity_spec(get_common_reference(R1, R2))> auto
hypot (
quantity<R1, Rep1> const& x,
quantity<R2, Rep2> const& y) noexcept;
» more...
Computes the square root of the sum of the squares of x, y, and z, without undue overflow or underflow at intermediate stages of the computation
template<
auto R1,
typename Rep1,
auto R2,
typename Rep2,
auto R3,
typename Rep3>
requires requires(Rep1 v1, Rep2 v2, Rep3 v3) {
get_common_reference(R1, R2, R3);
requires requires { hypot(v1, v2, v3); } || requires { std::hypot(v1, v2, v3); };
}
[[nodiscard]]
constexpr
QuantityOf<get_quantity_spec(get_common_reference(R1, R2, R3))> auto
hypot (
quantity<R1, Rep1> const& x,
quantity<R2, Rep2> const& y,
quantity<R3, Rep3> const& z) noexcept;
» more...
Computes the square root of the sum of the squares of x and y, without undue overflow or underflow at intermediate stages of the computation
Synopsis
Declared in <mp-units/math.h>
template<
auto R1,
typename Rep1,
auto R2,
typename Rep2>
requires requires(Rep1 v1, Rep2 v2) {
get_common_reference(R1, R2);
requires requires { hypot(v1, v2); } || requires { std::hypot(v1, v2); };
}
[[nodiscard]]
constexpr
QuantityOf<get_quantity_spec(get_common_reference(R1, R2))> auto
hypot(
quantity<R1, Rep1> const& x,
quantity<R2, Rep2> const& y) noexcept;
Parameters
Name
Description
x
A quantity
y
A quantity
Computes the square root of the sum of the squares of x, y, and z, without undue overflow or underflow at intermediate stages of the computation
Synopsis
Declared in <mp-units/math.h>
template<
auto R1,
typename Rep1,
auto R2,
typename Rep2,
auto R3,
typename Rep3>
requires requires(Rep1 v1, Rep2 v2, Rep3 v3) {
get_common_reference(R1, R2, R3);
requires requires { hypot(v1, v2, v3); } || requires { std::hypot(v1, v2, v3); };
}
[[nodiscard]]
constexpr
QuantityOf<get_quantity_spec(get_common_reference(R1, R2, R3))> auto
hypot(
quantity<R1, Rep1> const& x,
quantity<R2, Rep2> const& y,
quantity<R3, Rep3> const& z) noexcept;
Parameters
Name
Description
x
A quantity
y
A quantity
z
A quantity
Synopsis
Declared in <mp-units/framework/quantity_spec_concepts.h>
template<
QuantitySpec From,
QuantitySpec To>
[[nodiscard]]
consteval
bool
implicitly_convertible(
From from,
To to);
Synopsis
Declared in <mp-units/framework/quantity_spec.h>
template<
QuantitySpec QS1,
QuantitySpec QS2>
[[nodiscard]]
consteval
bool
interconvertible(
QS1 qs1,
QS2 qs2);
Computes the inverse of a quantity in a provided unit
Synopses
Declared in <mp-units/math.h>
[[nodiscard]]
consteval
Unit auto
inverse (auto d);
» more...
[[nodiscard]]
consteval
/* implementation-defined */
inverse (reference );
» more...
Computes the inverse of a quantity in a provided unit
template<
Unit auto To,
auto R,
typename Rep>
[[nodiscard]]
constexpr
Quantity auto
inverse (quantity<R, Rep> const& q)
requires (!detail::scaling_overflows_non_zero_values<Rep>(one / get_unit(R), To)) && requires {
representation_values<Rep>::one();
value_cast<To>(representation_values<Rep>::one() / q);
};
» more...
Synopsis
Declared in <mp-units/framework/dimension.h>
[[nodiscard]]
consteval
Unit auto
inverse(auto d);
Synopsis
Declared in <mp-units/framework/reference.h>
[[nodiscard]]
consteval
/* implementation-defined */
inverse(reference );
Computes the inverse of a quantity in a provided unit
Synopsis
Declared in <mp-units/math.h>
template<
Unit auto To,
auto R,
typename Rep>
[[nodiscard]]
constexpr
Quantity auto
inverse(quantity<R, Rep> const& q)
requires (!detail::scaling_overflows_non_zero_values<Rep>(one / get_unit(R), To)) && requires {
representation_values<Rep>::one();
value_cast<To>(representation_values<Rep>::one() / q);
};
Parameters
Name
Description
q
A quantity
Synopsis
Declared in <mp-units/framework/compare.h>
template<typename T>
requires requires {
{ T::zero() } -> std::equality_comparable_with<T>;
}
[[nodiscard]]
constexpr
bool
is_eq_zero(T v);
Synopsis
Declared in <mp-units/framework/compare.h>
template<typename T>
requires requires {
{ T::zero() } -> std::three_way_comparable_with<T>;
}
[[nodiscard]]
constexpr
bool
is_gt_zero(T v);
Synopsis
Declared in <mp-units/framework/compare.h>
template<typename T>
requires requires {
{ T::zero() } -> std::three_way_comparable_with<T>;
}
[[nodiscard]]
constexpr
bool
is_gteq_zero(T v);
Synopsis
Declared in <mp-units/framework/compare.h>
template<typename T>
requires requires {
{ T::zero() } -> std::three_way_comparable_with<T>;
}
[[nodiscard]]
constexpr
bool
is_lt_zero(T v);
Synopsis
Declared in <mp-units/framework/compare.h>
template<typename T>
requires requires {
{ T::zero() } -> std::three_way_comparable_with<T>;
}
[[nodiscard]]
constexpr
bool
is_lteq_zero(T v);
Synopsis
Declared in <mp-units/framework/compare.h>
template<typename T>
requires requires {
{ T::zero() } -> std::equality_comparable_with<T>;
}
[[nodiscard]]
constexpr
bool
is_neq_zero(T v);
isfinite
overloads
Synopses
Declared in <mp-units/math.h>
Determines if a quantity is finite.
template<
auto R,
typename Rep>
requires requires(Rep v) { isfinite(v); } || requires(Rep v) { std::isfinite(v); }
[[nodiscard]]
constexpr
bool
isfinite (quantity<R, Rep> const& a) noexcept;
» more...
Determines if a quantity point is finite.
template<
auto R,
auto PO,
typename Rep>
requires requires(quantity<R, Rep> q) { isfinite(q); }
[[nodiscard]]
constexpr
bool
isfinite (quantity_point<R, PO, Rep> const& a) noexcept;
» more...
Return Value
bool: Whether the quantity is finite or not.
bool: Whether the quantity point is finite or not.
Parameters
Name
Description
a:
Quantity to analyze.
Determines if a quantity is finite.
Synopsis
Declared in <mp-units/math.h>
template<
auto R,
typename Rep>
requires requires(Rep v) { isfinite(v); } || requires(Rep v) { std::isfinite(v); }
[[nodiscard]]
constexpr
bool
isfinite(quantity<R, Rep> const& a) noexcept;
Return Value
bool: Whether the quantity is finite or not.
Parameters
Name
Description
a:
Quantity to analyze.
a
A quantity
Determines if a quantity point is finite.
Synopsis
Declared in <mp-units/math.h>
template<
auto R,
auto PO,
typename Rep>
requires requires(quantity<R, Rep> q) { isfinite(q); }
[[nodiscard]]
constexpr
bool
isfinite(quantity_point<R, PO, Rep> const& a) noexcept;
Return Value
bool: Whether the quantity point is finite or not.
Parameters
Name
Description
a:
Quantity point to analyze.
a
A quantity point
isinf
overloads
Synopses
Declared in <mp-units/math.h>
Determines if a quantity is infinite.
template<
auto R,
typename Rep>
requires requires(Rep v) { isinf(v); } || requires(Rep v) { std::isinf(v); }
[[nodiscard]]
constexpr
bool
isinf (quantity<R, Rep> const& a) noexcept;
» more...
Determines if a quantity point is infinite.
template<
auto R,
auto PO,
typename Rep>
requires requires(quantity<R, Rep> q) { isinf(q); }
[[nodiscard]]
constexpr
bool
isinf (quantity_point<R, PO, Rep> const& a) noexcept;
» more...
Return Value
bool: Whether the quantity is infinite or not.
bool: Whether the quantity point is infinite or not.
Parameters
Name
Description
a:
Quantity to analyze.
Determines if a quantity is infinite.
Synopsis
Declared in <mp-units/math.h>
template<
auto R,
typename Rep>
requires requires(Rep v) { isinf(v); } || requires(Rep v) { std::isinf(v); }
[[nodiscard]]
constexpr
bool
isinf(quantity<R, Rep> const& a) noexcept;
Return Value
bool: Whether the quantity is infinite or not.
Parameters
Name
Description
a:
Quantity to analyze.
a
A quantity
Determines if a quantity point is infinite.
Synopsis
Declared in <mp-units/math.h>
template<
auto R,
auto PO,
typename Rep>
requires requires(quantity<R, Rep> q) { isinf(q); }
[[nodiscard]]
constexpr
bool
isinf(quantity_point<R, PO, Rep> const& a) noexcept;
Return Value
bool: Whether the quantity point is infinite or not.
Parameters
Name
Description
a:
Quantity point to analyze.
a
A quantity point
isnan
overloads
Synopses
Declared in <mp-units/math.h>
Determines if a quantity is a nan.
template<
auto R,
typename Rep>
requires requires(Rep v) { isnan(v); } || requires(Rep v) { std::isnan(v); }
[[nodiscard]]
constexpr
bool
isnan (quantity<R, Rep> const& a) noexcept;
» more...
Determines if a quantity point is a nan.
template<
auto R,
auto PO,
typename Rep>
requires requires(quantity<R, Rep> q) { isnan(q); }
[[nodiscard]]
constexpr
bool
isnan (quantity_point<R, PO, Rep> const& a) noexcept;
» more...
Return Value
bool: Whether the quantity is a NaN or not.
bool: Whether the quantity point is a NaN or not.
Parameters
Name
Description
a:
Quantity to analyze.
Determines if a quantity is a nan.
Synopsis
Declared in <mp-units/math.h>
template<
auto R,
typename Rep>
requires requires(Rep v) { isnan(v); } || requires(Rep v) { std::isnan(v); }
[[nodiscard]]
constexpr
bool
isnan(quantity<R, Rep> const& a) noexcept;
Return Value
bool: Whether the quantity is a NaN or not.
Parameters
Name
Description
a:
Quantity to analyze.
a
A quantity
Determines if a quantity point is a nan.
Synopsis
Declared in <mp-units/math.h>
template<
auto R,
auto PO,
typename Rep>
requires requires(quantity<R, Rep> q) { isnan(q); }
[[nodiscard]]
constexpr
bool
isnan(quantity_point<R, PO, Rep> const& a) noexcept;
Return Value
bool: Whether the quantity point is a NaN or not.
Parameters
Name
Description
a:
Quantity point to analyze.
a
A quantity point
Linear interpolation or extrapolation
Synopsis
Declared in <mp-units/math.h>
template<
auto R1,
auto Origin,
typename Rep1,
auto R2,
typename Rep2,
typename Factor>
requires requires(Rep1 a, Rep2 b, Factor t) {
get_common_reference(R1, R2);
requires requires { lerp(a, b, t); } || requires { std::lerp(a, b, t); };
}
[[nodiscard]]
constexpr
QuantityPointOf<get_quantity_spec(get_common_reference(R1, R2))> auto
lerp(
quantity_point<R1, Origin, Rep1> const& a,
quantity_point<R2, Origin, Rep2> const& b,
Factor const& t) noexcept;
Description
Computes the linear interpolation between a
and b
, if the parameter t
is inside [0, 1)
(the linear extrapolation otherwise), i.e. the result of a + t(b − a)
with accounting for floating-point calculation imprecision.
Parameters
Name
Description
a
A quantity point
b
A quantity point
Synopsis
Declared in <mp-units/cartesian_vector.h>
[[nodiscard]]
constexpr
T
magnitude(cartesian_vector const& vec)
requires treat_as_floating_point<T>;
Computes the midpoint of two points
Synopsis
Declared in <mp-units/math.h>
template<
auto R1,
auto Origin,
typename Rep1,
auto R2,
typename Rep2>
requires requires(Rep1 a, Rep2 b) {
get_common_reference(R1, R2);
requires requires { midpoint(a, b); } || requires { std::midpoint(a, b); };
}
[[nodiscard]]
constexpr
QuantityPointOf<get_quantity_spec(get_common_reference(R1, R2))> auto
midpoint(
quantity_point<R1, Origin, Rep1> const& a,
quantity_point<R2, Origin, Rep2> const& b) noexcept;
Parameters
Name
Description
a
A quantity point
b
A quantity point
Modulus operators
Synopses
Declared in <mp-units/framework/quantity.h>
template<
std::derived_from<quantity> Q,
RepresentationOf<quantity_spec> Value>
requires detail::DimensionlessOne<Q::reference> &&
detail::InvokeResultOf<quantity_spec, std::modulus<>, Rep, const Value&>
[[nodiscard]]
constexpr
Quantity auto
operator% (
Q const& lhs,
Value const& rhs);
» more...
template<
std::derived_from<quantity> Q,
RepresentationOf<quantity_spec> Value>
requires detail::DimensionlessOne<Q::reference> &&
detail::InvokeResultOf<quantity_spec, std::modulus<>, Rep, const Value&>
[[nodiscard]]
constexpr
Quantity auto
operator% (
Value const& lhs,
Q const& rhs);
» more...
template<
std::derived_from<quantity> Q,
auto R2,
typename Rep2>
requires (!treat_as_floating_point<Rep>) && (!treat_as_floating_point<Rep2>) &&
detail::CommonlyInvocableQuantities<std::modulus<>, quantity, quantity<R2, Rep2>>
[[nodiscard]]
constexpr
Quantity auto
operator% (
Q const& lhs,
quantity<R2, Rep2> const& rhs);
» more...
Synopsis
Declared in <mp-units/framework/quantity.h>
template<
std::derived_from<quantity> Q,
RepresentationOf<quantity_spec> Value>
requires detail::DimensionlessOne<Q::reference> &&
detail::InvokeResultOf<quantity_spec, std::modulus<>, Rep, const Value&>
[[nodiscard]]
constexpr
Quantity auto
operator%(
Q const& lhs,
Value const& rhs);
Synopsis
Declared in <mp-units/framework/quantity.h>
template<
std::derived_from<quantity> Q,
RepresentationOf<quantity_spec> Value>
requires detail::DimensionlessOne<Q::reference> &&
detail::InvokeResultOf<quantity_spec, std::modulus<>, Rep, const Value&>
[[nodiscard]]
constexpr
Quantity auto
operator%(
Value const& lhs,
Q const& rhs);
Synopsis
Declared in <mp-units/framework/quantity.h>
template<
std::derived_from<quantity> Q,
auto R2,
typename Rep2>
requires (!treat_as_floating_point<Rep>) && (!treat_as_floating_point<Rep2>) &&
detail::CommonlyInvocableQuantities<std::modulus<>, quantity, quantity<R2, Rep2>>
[[nodiscard]]
constexpr
Quantity auto
operator%(
Q const& lhs,
quantity<R2, Rep2> const& rhs);
Multiplication operators
Synopses
Declared in <mp-units/framework/quantity.h>
template<AssociatedUnit U1>
[[nodiscard]]
consteval
/* implementation-defined */
operator* (
U1 lhs,
reference rhs);
» more...
template<AssociatedUnit U2>
[[nodiscard]]
consteval
/* implementation-defined */
operator* (
reference lhs,
U2 rhs);
» more...
template<
Reference R,
typename Q>
requires Quantity<std::remove_cvref_t<Q>>
constexpr
auto
operator* (
R lhs,
Q&& q) = delete;
» more...
template<
Reference R,
typename Rep>
requires RepresentationOf<std::remove_cvref_t<Rep>, get_quantity_spec(R{})>
constexpr
auto
operator* (
R lhs,
Rep&& rhs) = delete;
» more...
template<
typename Q2,
typename U2>
[[nodiscard]]
consteval
/* implementation-defined */
operator* (
reference lhs,
reference<Q2, U2> rhs);
» more...
template<
std::derived_from<quantity> Q,
typename Value>
requires (!Quantity<Value>) &&
(!Reference<Value>) && detail::InvokeResultOf<quantity_spec, std::multiplies<>, rep, const Value&>
[[nodiscard]]
constexpr
QuantityOf<quantity_spec> auto
operator* (
Q const& q,
Value const& val);
» more...
template<
typename Value,
std::derived_from<quantity> Q>
requires (!Quantity<Value>) &&
(!Reference<Value>) && detail::InvokeResultOf<quantity_spec, std::multiplies<>, const Value&, rep>
[[nodiscard]]
constexpr
QuantityOf<quantity_spec> auto
operator* (
Value const& val,
Q const& q);
» more...
template<
std::derived_from<quantity> Q,
auto R2,
typename Rep2>
requires detail::InvocableQuantities<std::multiplies<>, quantity, quantity<R2, Rep2>>
[[nodiscard]]
constexpr
Quantity auto
operator* (
Q const& lhs,
quantity<R2, Rep2> const& rhs);
» more...
template<
typename FwdQ,
Reference R,
Quantity Q = std::remove_cvref_t<FwdQ>>
[[nodiscard]]
constexpr
Quantity auto
operator* (
FwdQ&& q,
R rhs);
» more...
template<
typename FwdRep,
Reference R,
RepresentationOf<get_quantity_spec(R{})> Rep = std::remove_cvref_t<FwdRep>>
requires detail::OffsetUnit<decltype(get_unit(R{}))>
[[deprecated]]
constexpr
auto
operator* (
FwdRep&& lhs,
R r);
» more...
Multiplication operator
template<
typename FwdRep,
Reference R,
RepresentationOf<get_quantity_spec(R{})> Rep = std::remove_cvref_t<FwdRep>>
requires (!detail::OffsetUnit<decltype(get_unit(R{}))>)
[[nodiscard]]
constexpr
quantity<R{}, Rep>
operator* (
FwdRep&& lhs,
R r);
» more...
Synopsis
Declared in <mp-units/framework/reference.h>
template<AssociatedUnit U1>
[[nodiscard]]
consteval
/* implementation-defined */
operator*(
U1 lhs,
reference rhs);
Synopsis
Declared in <mp-units/framework/reference.h>
template<AssociatedUnit U2>
[[nodiscard]]
consteval
/* implementation-defined */
operator*(
reference lhs,
U2 rhs);
Synopsis
Declared in <mp-units/framework/reference.h>
template<
Reference R,
typename Q>
requires Quantity<std::remove_cvref_t<Q>>
constexpr
auto
operator*(
R lhs,
Q&& q) = delete;
Synopsis
Declared in <mp-units/framework/reference.h>
template<
Reference R,
typename Rep>
requires RepresentationOf<std::remove_cvref_t<Rep>, get_quantity_spec(R{})>
constexpr
auto
operator*(
R lhs,
Rep&& rhs) = delete;
Synopsis
Declared in <mp-units/framework/reference.h>
template<
typename Q2,
typename U2>
[[nodiscard]]
consteval
/* implementation-defined */
operator*(
reference lhs,
reference<Q2, U2> rhs);
Synopsis
Declared in <mp-units/framework/quantity.h>
template<
std::derived_from<quantity> Q,
typename Value>
requires (!Quantity<Value>) &&
(!Reference<Value>) && detail::InvokeResultOf<quantity_spec, std::multiplies<>, rep, const Value&>
[[nodiscard]]
constexpr
QuantityOf<quantity_spec> auto
operator*(
Q const& q,
Value const& val);
Synopsis
Declared in <mp-units/framework/quantity.h>
template<
typename Value,
std::derived_from<quantity> Q>
requires (!Quantity<Value>) &&
(!Reference<Value>) && detail::InvokeResultOf<quantity_spec, std::multiplies<>, const Value&, rep>
[[nodiscard]]
constexpr
QuantityOf<quantity_spec> auto
operator*(
Value const& val,
Q const& q);
Synopsis
Declared in <mp-units/framework/quantity.h>
template<
std::derived_from<quantity> Q,
auto R2,
typename Rep2>
requires detail::InvocableQuantities<std::multiplies<>, quantity, quantity<R2, Rep2>>
[[nodiscard]]
constexpr
Quantity auto
operator*(
Q const& lhs,
quantity<R2, Rep2> const& rhs);
Synopsis
Declared in <mp-units/framework/reference.h>
template<
typename FwdQ,
Reference R,
Quantity Q = std::remove_cvref_t<FwdQ>>
[[nodiscard]]
constexpr
Quantity auto
operator*(
FwdQ&& q,
R rhs);
Synopsis
Declared in <mp-units/framework/reference.h>
template<
typename FwdRep,
Reference R,
RepresentationOf<get_quantity_spec(R{})> Rep = std::remove_cvref_t<FwdRep>>
requires detail::OffsetUnit<decltype(get_unit(R{}))>
[[deprecated]]
constexpr
auto
operator*(
FwdRep&& lhs,
R r);
Multiplication operator
Return Value
A quantity
Parameters
Name
Description
lhs
The left operand
r
The right operand
Addition operators
Synopses
Declared in <mp-units/ext/fixed_string.h>
Addition operator
[[nodiscard]]
constexpr
basic_fixed_string<CharT, 1 + N>
operator+ (
CharT const lhs,
basic_fixed_string const& rhs) noexcept;
» more...
Addition operator
[[nodiscard]]
constexpr
basic_fixed_string<CharT, N + 1>
operator+ (
basic_fixed_string const& lhs,
CharT rhs) noexcept;
» more...
Addition operator
template<std::size_t N2>
[[nodiscard]]
constexpr
basic_fixed_string<CharT, N + N2>
operator+ (
basic_fixed_string const& lhs,
basic_fixed_string<CharT, N2> const& rhs) noexcept;
» more...
Addition operator
template<std::size_t N2>
[[nodiscard]]
consteval
basic_fixed_string<CharT, N + N2 - 1>
operator+ (
basic_fixed_string const& lhs,
CharT const(& rhs)[]) noexcept;
» more...
Addition operator
template<std::size_t N1>
[[nodiscard]]
consteval
basic_fixed_string<CharT, N1 + N - 1>
operator+ (
CharT const(& lhs)[],
basic_fixed_string const& rhs) noexcept;
» more...
template<
std::derived_from<quantity> Q,
RepresentationOf<quantity_spec> Value>
requires detail::DimensionlessOne<Q::reference> &&
detail::InvokeResultOf<quantity_spec, std::plus<>, Rep, const Value&>
[[nodiscard]]
constexpr
Quantity auto
operator+ (
Q const& lhs,
Value const& rhs);
» more...
template<
std::derived_from<quantity> Q,
RepresentationOf<quantity_spec> Value>
requires detail::DimensionlessOne<Q::reference> &&
detail::InvokeResultOf<quantity_spec, std::plus<>, Rep, const Value&>
[[nodiscard]]
constexpr
Quantity auto
operator+ (
Value const& lhs,
Q const& rhs);
» more...
Addition operator
template<
std::size_t N2,
std::size_t M2>
[[nodiscard]]
constexpr
symbol_text<N + N2, M + M2>
operator+ (
symbol_text const& lhs,
symbol_text<N2, M2> const& rhs);
» more...
template<
std::derived_from<quantity> Q,
auto R2,
typename Rep2>
requires detail::CommonlyInvocableQuantities<std::plus<>, quantity, quantity<R2, Rep2>>
[[nodiscard]]
constexpr
Quantity auto
operator+ (
Q const& lhs,
quantity<R2, Rep2> const& rhs);
» more...
template<
std::derived_from<quantity_point> QP,
ReferenceOf<PO._quantity_spec_> auto R2,
typename Rep2>
[[nodiscard]]
constexpr
QuantityPoint auto
operator+ (
QP const& qp,
quantity<R2, Rep2> const& q)
requires requires { qp.quantity_ref_from(PO) + q; };
» more...
template<
ReferenceOf<PO._quantity_spec_> auto R1,
typename Rep1,
std::derived_from<quantity_point> QP>
[[nodiscard]]
constexpr
QuantityPoint auto
operator+ (
quantity<R1, Rep1> const& q,
QP const& qp)
requires requires { q + qp.quantity_ref_from(PO); };
» more...
Addition operator
Return Value
A compile-time fixed string
Parameters
Name
Description
lhs
The left operand
rhs
The right operand
Addition operator
Return Value
A compile-time fixed string
Parameters
Name
Description
lhs
The left operand
rhs
The right operand
Addition operator
Return Value
A compile-time fixed string
Parameters
Name
Description
lhs
The left operand
rhs
The right operand
Addition operator
Return Value
A compile-time fixed string
Parameters
Name
Description
lhs
The left operand
rhs
The right operand
Addition operator
Return Value
A compile-time fixed string
Parameters
Name
Description
lhs
The left operand
rhs
The right operand
Synopsis
Declared in <mp-units/framework/quantity.h>
template<
std::derived_from<quantity> Q,
RepresentationOf<quantity_spec> Value>
requires detail::DimensionlessOne<Q::reference> &&
detail::InvokeResultOf<quantity_spec, std::plus<>, Rep, const Value&>
[[nodiscard]]
constexpr
Quantity auto
operator+(
Q const& lhs,
Value const& rhs);
Synopsis
Declared in <mp-units/framework/quantity.h>
template<
std::derived_from<quantity> Q,
RepresentationOf<quantity_spec> Value>
requires detail::DimensionlessOne<Q::reference> &&
detail::InvokeResultOf<quantity_spec, std::plus<>, Rep, const Value&>
[[nodiscard]]
constexpr
Quantity auto
operator+(
Value const& lhs,
Q const& rhs);
Addition operator
Return Value
A symbol text representation
Parameters
Name
Description
lhs
The left operand
rhs
The right operand
Synopsis
Declared in <mp-units/framework/quantity.h>
template<
std::derived_from<quantity> Q,
auto R2,
typename Rep2>
requires detail::CommonlyInvocableQuantities<std::plus<>, quantity, quantity<R2, Rep2>>
[[nodiscard]]
constexpr
Quantity auto
operator+(
Q const& lhs,
quantity<R2, Rep2> const& rhs);
Synopsis
Declared in <mp-units/framework/quantity_point.h>
template<
std::derived_from<quantity_point> QP,
ReferenceOf<PO._quantity_spec_> auto R2,
typename Rep2>
[[nodiscard]]
constexpr
QuantityPoint auto
operator+(
QP const& qp,
quantity<R2, Rep2> const& q)
requires requires { qp.quantity_ref_from(PO) + q; };
Synopsis
Declared in <mp-units/framework/quantity_point.h>
template<
ReferenceOf<PO._quantity_spec_> auto R1,
typename Rep1,
std::derived_from<quantity_point> QP>
[[nodiscard]]
constexpr
QuantityPoint auto
operator+(
quantity<R1, Rep1> const& q,
QP const& qp)
requires requires { q + qp.quantity_ref_from(PO); };
Subtraction operators
Synopses
Declared in <mp-units/framework/quantity.h>
template<
PointOrigin PO1,
std::derived_from<quantity_point> QP>
requires QuantityPointOf<quantity_point, PO1{}> &&
ReferenceOf<MP_UNITS_NONCONST_TYPE(reference), PO1::_quantity_spec_>
[[nodiscard]]
constexpr
Quantity auto
operator- (
PO1 po,
QP const& qp);
» more...
template<
std::derived_from<quantity> Q,
RepresentationOf<quantity_spec> Value>
requires detail::DimensionlessOne<Q::reference> &&
detail::InvokeResultOf<quantity_spec, std::minus<>, Rep, const Value&>
[[nodiscard]]
constexpr
Quantity auto
operator- (
Q const& lhs,
Value const& rhs);
» more...
template<
std::derived_from<quantity_point> QP,
QuantityPointOf<absolute_point_origin> QP2>
[[nodiscard]]
constexpr
Quantity auto
operator- (
QP const& lhs,
QP2 const& rhs)
requires requires { lhs.quantity_ref_from(point_origin) - rhs.quantity_ref_from(QP2::point_origin); };
» more...
template<
std::derived_from<quantity_point> QP,
PointOrigin PO2>
requires QuantityPointOf<quantity_point, PO2{}> &&
ReferenceOf<MP_UNITS_NONCONST_TYPE(reference), PO2::_quantity_spec_>
[[nodiscard]]
constexpr
Quantity auto
operator- (
QP const& qp,
PO2 po);
» more...
template<
std::derived_from<quantity> Q,
RepresentationOf<quantity_spec> Value>
requires detail::DimensionlessOne<Q::reference> &&
detail::InvokeResultOf<quantity_spec, std::minus<>, Rep, const Value&>
[[nodiscard]]
constexpr
Quantity auto
operator- (
Value const& lhs,
Q const& rhs);
» more...
template<
std::derived_from<quantity> Q,
auto R2,
typename Rep2>
requires detail::CommonlyInvocableQuantities<std::minus<>, quantity, quantity<R2, Rep2>>
[[nodiscard]]
constexpr
Quantity auto
operator- (
Q const& lhs,
quantity<R2, Rep2> const& rhs);
» more...
template<
std::derived_from<quantity_point> QP,
ReferenceOf<PO._quantity_spec_> auto R2,
typename Rep2>
[[nodiscard]]
constexpr
QuantityPoint auto
operator- (
QP const& qp,
quantity<R2, Rep2> const& q)
requires requires { qp.quantity_ref_from(PO) - q; };
» more...
Synopsis
Declared in <mp-units/framework/quantity_point.h>
template<
PointOrigin PO1,
std::derived_from<quantity_point> QP>
requires QuantityPointOf<quantity_point, PO1{}> &&
ReferenceOf<MP_UNITS_NONCONST_TYPE(reference), PO1::_quantity_spec_>
[[nodiscard]]
constexpr
Quantity auto
operator-(
PO1 po,
QP const& qp);
Synopsis
Declared in <mp-units/framework/quantity.h>
template<
std::derived_from<quantity> Q,
RepresentationOf<quantity_spec> Value>
requires detail::DimensionlessOne<Q::reference> &&
detail::InvokeResultOf<quantity_spec, std::minus<>, Rep, const Value&>
[[nodiscard]]
constexpr
Quantity auto
operator-(
Q const& lhs,
Value const& rhs);
Synopsis
Declared in <mp-units/framework/quantity_point.h>
template<
std::derived_from<quantity_point> QP,
QuantityPointOf<absolute_point_origin> QP2>
[[nodiscard]]
constexpr
Quantity auto
operator-(
QP const& lhs,
QP2 const& rhs)
requires requires { lhs.quantity_ref_from(point_origin) - rhs.quantity_ref_from(QP2::point_origin); };
Synopsis
Declared in <mp-units/framework/quantity_point.h>
template<
std::derived_from<quantity_point> QP,
PointOrigin PO2>
requires QuantityPointOf<quantity_point, PO2{}> &&
ReferenceOf<MP_UNITS_NONCONST_TYPE(reference), PO2::_quantity_spec_>
[[nodiscard]]
constexpr
Quantity auto
operator-(
QP const& qp,
PO2 po);
Synopsis
Declared in <mp-units/framework/quantity.h>
template<
std::derived_from<quantity> Q,
RepresentationOf<quantity_spec> Value>
requires detail::DimensionlessOne<Q::reference> &&
detail::InvokeResultOf<quantity_spec, std::minus<>, Rep, const Value&>
[[nodiscard]]
constexpr
Quantity auto
operator-(
Value const& lhs,
Q const& rhs);
Synopsis
Declared in <mp-units/framework/quantity.h>
template<
std::derived_from<quantity> Q,
auto R2,
typename Rep2>
requires detail::CommonlyInvocableQuantities<std::minus<>, quantity, quantity<R2, Rep2>>
[[nodiscard]]
constexpr
Quantity auto
operator-(
Q const& lhs,
quantity<R2, Rep2> const& rhs);
Synopsis
Declared in <mp-units/framework/quantity_point.h>
template<
std::derived_from<quantity_point> QP,
ReferenceOf<PO._quantity_spec_> auto R2,
typename Rep2>
[[nodiscard]]
constexpr
QuantityPoint auto
operator-(
QP const& qp,
quantity<R2, Rep2> const& q)
requires requires { qp.quantity_ref_from(PO) - q; };
Division operators
Synopses
Declared in <mp-units/framework/quantity.h>
template<AssociatedUnit U1>
[[nodiscard]]
consteval
/* implementation-defined */
operator/ (
U1 lhs,
reference rhs);
» more...
template<AssociatedUnit U2>
[[nodiscard]]
consteval
/* implementation-defined */
operator/ (
reference lhs,
U2 rhs);
» more...
template<
Reference R,
typename Q>
requires Quantity<std::remove_cvref_t<Q>>
constexpr
auto
operator/ (
R lhs,
Q&& q) = delete;
» more...
template<
Reference R,
typename Rep>
requires RepresentationOf<std::remove_cvref_t<Rep>, get_quantity_spec(R{})>
constexpr
auto
operator/ (
R lhs,
Rep&& rhs) = delete;
» more...
template<
typename Q2,
typename U2>
[[nodiscard]]
consteval
/* implementation-defined */
operator/ (
reference lhs,
reference<Q2, U2> rhs);
» more...
template<
std::derived_from<quantity> Q,
typename Value>
requires (!Quantity<Value>) &&
(!Reference<Value>) && detail::InvokeResultOf<quantity_spec, std::divides<>, rep, const Value&>
[[nodiscard]]
constexpr
QuantityOf<quantity_spec> auto
operator/ (
Q const& q,
Value const& val);
» more...
template<
typename Value,
std::derived_from<quantity> Q>
requires (!Quantity<Value>) &&
(!Reference<Value>) && detail::InvokeResultOf<quantity_spec, std::divides<>, const Value&, rep>
[[nodiscard]]
constexpr
Quantity auto
operator/ (
Value const& val,
Q const& q);
» more...
template<
std::derived_from<quantity> Q,
auto R2,
typename Rep2>
requires detail::InvocableQuantities<std::divides<>, quantity, quantity<R2, Rep2>>
[[nodiscard]]
constexpr
Quantity auto
operator/ (
Q const& lhs,
quantity<R2, Rep2> const& rhs);
» more...
template<
typename FwdQ,
Reference R,
Quantity Q = std::remove_cvref_t<FwdQ>>
[[nodiscard]]
constexpr
Quantity auto
operator/ (
FwdQ&& q,
R rhs);
» more...
template<
typename FwdRep,
Reference R,
RepresentationOf<get_quantity_spec(R{})> Rep = std::remove_cvref_t<FwdRep>>
requires detail::OffsetUnit<decltype(get_unit(R{}))>
[[deprecated]]
constexpr
auto
operator/ (
FwdRep&& lhs,
R rhs);
» more...
template<
typename FwdRep,
Reference R,
RepresentationOf<get_quantity_spec(R{})> Rep = std::remove_cvref_t<FwdRep>>
requires (!detail::OffsetUnit<decltype(get_unit(R{}))>)
[[nodiscard]]
constexpr
Quantity auto
operator/ (
FwdRep&& lhs,
R rhs);
» more...
Synopsis
Declared in <mp-units/framework/reference.h>
template<AssociatedUnit U1>
[[nodiscard]]
consteval
/* implementation-defined */
operator/(
U1 lhs,
reference rhs);
Synopsis
Declared in <mp-units/framework/reference.h>
template<AssociatedUnit U2>
[[nodiscard]]
consteval
/* implementation-defined */
operator/(
reference lhs,
U2 rhs);
Synopsis
Declared in <mp-units/framework/reference.h>
template<
Reference R,
typename Q>
requires Quantity<std::remove_cvref_t<Q>>
constexpr
auto
operator/(
R lhs,
Q&& q) = delete;
Synopsis
Declared in <mp-units/framework/reference.h>
template<
Reference R,
typename Rep>
requires RepresentationOf<std::remove_cvref_t<Rep>, get_quantity_spec(R{})>
constexpr
auto
operator/(
R lhs,
Rep&& rhs) = delete;
Synopsis
Declared in <mp-units/framework/reference.h>
template<
typename Q2,
typename U2>
[[nodiscard]]
consteval
/* implementation-defined */
operator/(
reference lhs,
reference<Q2, U2> rhs);
Synopsis
Declared in <mp-units/framework/quantity.h>
template<
std::derived_from<quantity> Q,
typename Value>
requires (!Quantity<Value>) &&
(!Reference<Value>) && detail::InvokeResultOf<quantity_spec, std::divides<>, rep, const Value&>
[[nodiscard]]
constexpr
QuantityOf<quantity_spec> auto
operator/(
Q const& q,
Value const& val);
Synopsis
Declared in <mp-units/framework/quantity.h>
template<
typename Value,
std::derived_from<quantity> Q>
requires (!Quantity<Value>) &&
(!Reference<Value>) && detail::InvokeResultOf<quantity_spec, std::divides<>, const Value&, rep>
[[nodiscard]]
constexpr
Quantity auto
operator/(
Value const& val,
Q const& q);
Synopsis
Declared in <mp-units/framework/quantity.h>
template<
std::derived_from<quantity> Q,
auto R2,
typename Rep2>
requires detail::InvocableQuantities<std::divides<>, quantity, quantity<R2, Rep2>>
[[nodiscard]]
constexpr
Quantity auto
operator/(
Q const& lhs,
quantity<R2, Rep2> const& rhs);
Synopsis
Declared in <mp-units/framework/reference.h>
template<
typename FwdQ,
Reference R,
Quantity Q = std::remove_cvref_t<FwdQ>>
[[nodiscard]]
constexpr
Quantity auto
operator/(
FwdQ&& q,
R rhs);
Synopsis
Declared in <mp-units/framework/reference.h>
template<
typename FwdRep,
Reference R,
RepresentationOf<get_quantity_spec(R{})> Rep = std::remove_cvref_t<FwdRep>>
requires detail::OffsetUnit<decltype(get_unit(R{}))>
[[deprecated]]
constexpr
auto
operator/(
FwdRep&& lhs,
R rhs);
Synopsis
Declared in <mp-units/framework/reference.h>
template<
typename FwdRep,
Reference R,
RepresentationOf<get_quantity_spec(R{})> Rep = std::remove_cvref_t<FwdRep>>
requires (!detail::OffsetUnit<decltype(get_unit(R{}))>)
[[nodiscard]]
constexpr
Quantity auto
operator/(
FwdRep&& lhs,
R rhs);
pow
overloads
Synopses
Declared in <mp-units/framework/dimension.h>
Computes the value of a reference raised to the Num/Den
power
template<
intmax_t Num,
intmax_t Den = 1>
requires (Den != 0)
[[nodiscard]]
consteval
/* implementation-defined */
pow (reference );
» more...
Computes the value of a dimension raised to the Num/Den
power
template<
intmax_t Num,
intmax_t Den = 1,
Unit D>
requires (Den != 0)
[[nodiscard]]
consteval
Unit auto
pow (D d);
» more...
Computes the value of a quantity raised to the Num/Den
power
template<
intmax_t Num,
intmax_t Den = 1,
auto R,
typename Rep>
requires (Den != 0) && requires(Rep v) {
representation_values<Rep>::one();
requires requires { pow(v, 1.0); } || requires { std::pow(v, 1.0); };
}
[[nodiscard]]
constexpr
quantity<pow<Num, Den>(R), Rep>
pow (quantity<R, Rep> const& q) noexcept;
» more...
Return Value
The result of computation
Dimension The result of computation
QuantitySpec The result of computation
Unit The result of computation
Quantity The result of computation
Template Parameters
Name
Description
Num
Exponent numerator
Den
Exponent denominator
Parameters
Name
Description
r
Reference being the base of the operation
d
Dimension being the base of the operation
q
Quantity specification being the base of the operation
u
Unit being the base of the operation
Computes the value of a reference raised to the Num/Den
power
Synopsis
Declared in <mp-units/framework/reference.h>
template<
intmax_t Num,
intmax_t Den = 1>
requires (Den != 0)
[[nodiscard]]
consteval
/* implementation-defined */
pow(reference );
Return Value
The result of computation
Template Parameters
Name
Description
Num
Exponent numerator
Den
Exponent denominator
Parameters
Name
Description
r
Reference being the base of the operation
Computes the value of a dimension raised to the Num/Den
power
Synopsis
Declared in <mp-units/framework/dimension.h>
template<
intmax_t Num,
intmax_t Den = 1,
Unit D>
requires (Den != 0)
[[nodiscard]]
consteval
Unit auto
pow(D d);
Return Value
Dimension The result of computation
QuantitySpec The result of computation
Unit The result of computation
Template Parameters
Name
Description
Num
Exponent numerator
Den
Exponent denominator
Parameters
Name
Description
d
Dimension being the base of the operation
q
Quantity specification being the base of the operation
u
Unit being the base of the operation
Computes the value of a quantity raised to the Num/Den
power
Synopsis
Declared in <mp-units/math.h>
template<
intmax_t Num,
intmax_t Den = 1,
auto R,
typename Rep>
requires (Den != 0) && requires(Rep v) {
representation_values<Rep>::one();
requires requires { pow(v, 1.0); } || requires { std::pow(v, 1.0); };
}
[[nodiscard]]
constexpr
quantity<pow<Num, Den>(R), Rep>
pow(quantity<R, Rep> const& q) noexcept;
Description
Both the quantity value and its quantity specification are the base of the operation.
Return Value
Quantity The result of computation
Template Parameters
Name
Description
Num
Exponent numerator
Den
Exponent denominator
Parameters
Name
Description
q
Quantity being the base of the operation
quantity_cast
overloads
Synopses
Declared in <mp-units/framework/quantity_cast.h>
Explicit cast of a quantity type
template<
QuantitySpec auto ToQS,
typename FwdQ,
Quantity Q = std::remove_cvref_t<FwdQ>>
requires (castable(Q::quantity_spec, ToQS)) && (MP_UNITS_WEAK_UNIT_OF(MP_UNITS_NONCONST_TYPE(Q::unit), ToQS))
[[nodiscard]]
constexpr
Quantity auto
quantity_cast (FwdQ&& q);
» more...
Explicit cast of a quantity point type
template<
QuantitySpec auto ToQS,
typename FwdQP,
QuantityPoint QP = std::remove_cvref_t<FwdQP>>
requires (castable(QP::quantity_spec, ToQS)) && (MP_UNITS_WEAK_UNIT_OF(MP_UNITS_NONCONST_TYPE(QP::unit), ToQS))
[[nodiscard]]
constexpr
QuantityPoint auto
quantity_cast (FwdQP&& qp);
» more...
Template Parameters
Name
Description
ToQS
a quantity specification to use for a target quantity
Explicit cast of a quantity type
Synopsis
Declared in <mp-units/framework/quantity_cast.h>
template<
QuantitySpec auto ToQS,
typename FwdQ,
Quantity Q = std::remove_cvref_t<FwdQ>>
requires (castable(Q::quantity_spec, ToQS)) && (MP_UNITS_WEAK_UNIT_OF(MP_UNITS_NONCONST_TYPE(Q::unit), ToQS))
[[nodiscard]]
constexpr
Quantity auto
quantity_cast(FwdQ&& q);
Description
This cast converts only a quantity type. It might be used to force some quantity type conversions that are not implicitly allowed but are allowed explicitly.
For example:
{.cpp}
auto length = isq::length(42 * m);
auto distance = quantity_cast(length);
NOTE
This cast does not affect the underlying value of a number stored in a quantity.
Template Parameters
Name
Description
ToQS
a quantity specification to use for a target quantity
Explicit cast of a quantity point type
Synopsis
Declared in <mp-units/framework/quantity_cast.h>
template<
QuantitySpec auto ToQS,
typename FwdQP,
QuantityPoint QP = std::remove_cvref_t<FwdQP>>
requires (castable(QP::quantity_spec, ToQS)) && (MP_UNITS_WEAK_UNIT_OF(MP_UNITS_NONCONST_TYPE(QP::unit), ToQS))
[[nodiscard]]
constexpr
QuantityPoint auto
quantity_cast(FwdQP&& qp);
Description
This cast converts only a quantity point type. It might be used to force some quantity point type conversions that are not implicitly allowed but are allowed explicitly.
For example:
{.cpp}
auto length = isq::length(quantity_point{42 * m});
auto altitude = quantity_cast(length);
NOTE
This cast does not affect the underlying value of a number stored in a quantity point.
Template Parameters
Name
Description
ToQS
a quantity specification to use for a target quantity point
Computes the IEEE remainder of the floating point division operation x / y.
Synopsis
Declared in <mp-units/math.h>
template<
auto R1,
typename Rep1,
auto R2,
typename Rep2>
requires requires(Rep1 v1, Rep2 v2) {
get_common_reference(R1, R2);
requires requires { remainder(v1, v2); } || requires { std::remainder(v1, v2); };
}
[[nodiscard]]
constexpr
QuantityOf<get_quantity_spec(R1)> auto
remainder(
quantity<R1, Rep1> const& x,
quantity<R2, Rep2> const& y) noexcept;
Parameters
Name
Description
x
A quantity
y
A quantity
Computes the nearest quantity with integer representation and unit type To
to q
Description
Returns the value res
representable in To
unit that is the closest to q
. If there are two such values, returns the even value (that is, the value res
such that res % 2 == 0
).
Return Value
Quantity The quantity rounded to the nearest unit To
, rounding to even in halfway cases.
Template Parameters
Name
Description
q
Quantity being the base of the operation
Parameters
Name
Description
q
A quantity
sqrt
overloads
Synopses
Declared in <mp-units/framework/dimension.h>
Computes the square root of a dimension
[[nodiscard]]
consteval
Unit auto
sqrt (auto d);
» more...
[[nodiscard]]
consteval
/* implementation-defined */
sqrt (reference );
» more...
Computes the square root of a quantity
template<
auto R,
typename Rep>
requires requires(Rep v) { sqrt(v); } || requires(Rep v) { std::sqrt(v); }
[[nodiscard]]
constexpr
quantity<sqrt(R), Rep>
sqrt (quantity<R, Rep> const& q) noexcept;
» more...
Return Value
Dimension The result of computation
QuantitySpec The result of computation
Unit The result of computation
Quantity The result of computation
Parameters
Name
Description
d
Dimension being the base of the operation
q
Quantity specification being the base of the operation
u
Unit being the base of the operation
Computes the square root of a dimension
Synopsis
Declared in <mp-units/framework/dimension.h>
[[nodiscard]]
consteval
Unit auto
sqrt(auto d);
Return Value
Dimension The result of computation
QuantitySpec The result of computation
Unit The result of computation
Parameters
Name
Description
d
Dimension being the base of the operation
q
Quantity specification being the base of the operation
u
Unit being the base of the operation
Synopsis
Declared in <mp-units/framework/reference.h>
[[nodiscard]]
consteval
/* implementation-defined */
sqrt(reference );
Computes the square root of a quantity
Synopsis
Declared in <mp-units/math.h>
template<
auto R,
typename Rep>
requires requires(Rep v) { sqrt(v); } || requires(Rep v) { std::sqrt(v); }
[[nodiscard]]
constexpr
quantity<sqrt(R), Rep>
sqrt(quantity<R, Rep> const& q) noexcept;
Description
Both the quantity value and its quantity specification are the base of the operation.
Return Value
Quantity The result of computation
Parameters
Name
Description
q
Quantity being the base of the operation
Computes the square power of a unit
Synopsis
Declared in <mp-units/framework/unit.h>
[[nodiscard]]
consteval
Unit auto
square(auto u);
Return Value
Unit The result of computation
Parameters
Name
Description
u
Unit being the base of the operation
Synopsis
Declared in <mp-units/framework/unit.h>
template<
unit_symbol_formatting fmt = unit_symbol_formatting{},
typename CharT = char,
Unit U>
[[nodiscard]]
consteval
std::basic_string_view<CharT>
unit_symbol(U);
Synopsis
Declared in <mp-units/framework/unit.h>
template<
typename CharT = char,
std::output_iterator<CharT> Out,
Unit U>
constexpr
Out
unit_symbol_to(
Out out,
U u,
unit_symbol_formatting const& fmt = unit_symbol_formatting{});
Synopsis
Declared in <mp-units/cartesian_vector.h>
[[nodiscard]]
constexpr
cartesian_vector
unit_vector(cartesian_vector const& vec)
requires treat_as_floating_point<T>;
value_cast
overloads
Synopses
Declared in <mp-units/framework/value_cast.h>
Explicit cast of a quantity's representation
template<
Quantity ToQ,
typename FwdQ,
Quantity Q = std::remove_cvref_t<FwdQ>>
requires (ToQ::quantity_spec == Q::quantity_spec) &&
(MP_UNITS_WEAK_UNIT_OF(MP_UNITS_NONCONST_TYPE(ToQ::unit), Q::quantity_spec)) &&
std::constructible_from<typename ToQ::rep, typename Q::rep> &&
detail::SaneScaling<Q::unit, ToQ::unit, typename ToQ::rep>
[[nodiscard]]
constexpr
Quantity auto
value_cast (FwdQ&& q);
» more...
Explicit cast of a quantity's representation type
template<
typename ToRep,
typename FwdQ,
Quantity Q = std::remove_cvref_t<FwdQ>>
requires RepresentationOf<ToRep, Q::quantity_spec> && std::constructible_from<ToRep, typename Q::rep>
[[nodiscard]]
constexpr
quantity<Q::reference, ToRep>
value_cast (FwdQ&& q);
» more...
Explicit cast of a quantity's unit
template<
auto ToU,
typename FwdQ,
Quantity Q = std::remove_cvref_t<FwdQ>>
requires (MP_UNITS_WEAK_UNIT_OF(MP_UNITS_REMOVE_CONST(decltype(ToU)), Q::quantity_spec)) &&
detail::SaneScaling<Q::unit, ToU, typename Q::rep>
[[nodiscard]]
constexpr
Quantity auto
value_cast (FwdQ&& q);
» more...
Explicit cast of a quantity point's representation
template<
Quantity ToQ,
typename FwdQP,
QuantityPoint QP = std::remove_cvref_t<FwdQP>>
requires (ToQ::quantity_spec == QP::quantity_spec) &&
(MP_UNITS_WEAK_UNIT_OF(MP_UNITS_NONCONST_TYPE(ToQ::unit), QP::quantity_spec)) &&
std::constructible_from<typename ToQ::rep, typename QP::rep> &&
detail::SaneScaling<QP::unit, ToQ::unit, typename ToQ::rep>
[[nodiscard]]
constexpr
QuantityPoint auto
value_cast (FwdQP&& qp);
» more...
Explicit cast of a quantity point's representation, including potentially the point origin
template<
QuantityPoint ToQP,
typename FwdQP,
QuantityPoint QP = std::remove_cvref_t<FwdQP>>
requires (ToQP::quantity_spec == QP::quantity_spec) &&
(MP_UNITS_WEAK_UNIT_OF(MP_UNITS_NONCONST_TYPE(ToQP::unit), QP::quantity_spec)) &&
(detail::same_absolute_point_origins(ToQP::point_origin, QP::point_origin)) &&
std::constructible_from<typename ToQP::rep, typename QP::rep> &&
detail::SaneScaling<QP::unit, ToQP::unit, typename ToQP::rep>
[[nodiscard]]
constexpr
QuantityPoint auto
value_cast (FwdQP&& qp);
» more...
Explicit cast of a quantity point's representation type
template<
typename ToRep,
typename FwdQP,
QuantityPoint QP = std::remove_cvref_t<FwdQP>>
requires RepresentationOf<ToRep, QP::quantity_spec> && std::constructible_from<ToRep, typename QP::rep>
[[nodiscard]]
constexpr
quantity_point<QP::reference, QP::point_origin, ToRep>
value_cast (FwdQP&& qp);
» more...
Explicit cast of a quantity point's unit
template<
Unit auto ToU,
typename FwdQP,
QuantityPoint QP = std::remove_cvref_t<FwdQP>>
requires (MP_UNITS_WEAK_UNIT_OF(MP_UNITS_REMOVE_CONST(decltype(ToU)), QP::quantity_spec)) &&
detail::SaneScaling<QP::unit, ToU, typename QP::rep>
[[nodiscard]]
constexpr
QuantityPoint auto
value_cast (FwdQP&& qp);
» more...
template<
typename ToRep,
Unit auto ToU,
typename FwdQ,
Quantity Q = std::remove_cvref_t<FwdQ>>
requires (MP_UNITS_WEAK_UNIT_OF(MP_UNITS_REMOVE_CONST(decltype(ToU)), Q::quantity_spec)) &&
RepresentationOf<ToRep, Q::quantity_spec> && std::constructible_from<ToRep, typename Q::rep> &&
detail::SaneScaling<Q::unit, ToU, ToRep>
[[nodiscard]]
constexpr
Quantity auto
value_cast (FwdQ&& q);
» more...
Explicit cast of a quantity's unit and representation type
template<
Unit auto ToU,
typename ToRep,
typename FwdQ,
Quantity Q = std::remove_cvref_t<FwdQ>>
requires (MP_UNITS_WEAK_UNIT_OF(MP_UNITS_REMOVE_CONST(decltype(ToU)), Q::quantity_spec)) &&
RepresentationOf<ToRep, Q::quantity_spec> && std::constructible_from<ToRep, typename Q::rep> &&
detail::SaneScaling<Q::unit, ToU, ToRep>
[[nodiscard]]
constexpr
Quantity auto
value_cast (FwdQ&& q);
» more...
template<
typename ToRep,
Unit auto ToU,
typename FwdQP,
QuantityPoint QP = std::remove_cvref_t<FwdQP>>
requires (MP_UNITS_WEAK_UNIT_OF(MP_UNITS_REMOVE_CONST(decltype(ToU)), QP::quantity_spec)) &&
RepresentationOf<ToRep, QP::quantity_spec> && std::constructible_from<ToRep, typename QP::rep> &&
detail::SaneScaling<QP::unit, ToU, ToRep>
[[nodiscard]]
constexpr
QuantityPoint auto
value_cast (FwdQP&& qp);
» more...
Explicit cast of a quantity point's unit and representation type
template<
Unit auto ToU,
typename ToRep,
typename FwdQP,
QuantityPoint QP = std::remove_cvref_t<FwdQP>>
requires (MP_UNITS_WEAK_UNIT_OF(MP_UNITS_REMOVE_CONST(decltype(ToU)), QP::quantity_spec)) &&
RepresentationOf<ToRep, QP::quantity_spec> && std::constructible_from<ToRep, typename QP::rep> &&
detail::SaneScaling<QP::unit, ToU, ToRep>
[[nodiscard]]
constexpr
QuantityPoint auto
value_cast (FwdQP&& qp);
» more...
Template Parameters
Name
Description
ToQ
a target quantity type to which to cast the representation
ToRep
a representation type to use for a target quantity
ToU
a unit to use for a target quantity
ToQP
a target quantity point type to which to cast the representation of the point
Explicit cast of a quantity's representation
Synopsis
Declared in <mp-units/framework/value_cast.h>
template<
Quantity ToQ,
typename FwdQ,
Quantity Q = std::remove_cvref_t<FwdQ>>
requires (ToQ::quantity_spec == Q::quantity_spec) &&
(MP_UNITS_WEAK_UNIT_OF(MP_UNITS_NONCONST_TYPE(ToQ::unit), Q::quantity_spec)) &&
std::constructible_from<typename ToQ::rep, typename Q::rep> &&
detail::SaneScaling<Q::unit, ToQ::unit, typename ToQ::rep>
[[nodiscard]]
constexpr
Quantity auto
value_cast(FwdQ&& q);
Description
Implicit conversions between quantities of different types are allowed only for "safe" (e.g. non-truncating) conversion. In truncating cases an explicit cast have to be used.
using ToQ = quantity<us, int>; auto q = value_cast<ToQ>(1.23 ms);
Note that value_cast only changes the "representation aspects" (unit and representation type), but not the "meaning" (quantity type).
Template Parameters
Name
Description
ToQ
a target quantity type to which to cast the representation
Explicit cast of a quantity's representation type
Synopsis
Declared in <mp-units/framework/value_cast.h>
template<
typename ToRep,
typename FwdQ,
Quantity Q = std::remove_cvref_t<FwdQ>>
requires RepresentationOf<ToRep, Q::quantity_spec> && std::constructible_from<ToRep, typename Q::rep>
[[nodiscard]]
constexpr
quantity<Q::reference, ToRep>
value_cast(FwdQ&& q);
Description
Implicit conversions between quantities of different types are allowed only for "safe" (e.g. non-truncating) conversion. In truncating cases an explicit cast have to be used.
auto q = value_cast<int>(1.23 ms);
Return Value
A quantity
Template Parameters
Name
Description
ToRep
a representation type to use for a target quantity
Explicit cast of a quantity's unit
Synopsis
Declared in <mp-units/framework/value_cast.h>
template<
auto ToU,
typename FwdQ,
Quantity Q = std::remove_cvref_t<FwdQ>>
requires (MP_UNITS_WEAK_UNIT_OF(MP_UNITS_REMOVE_CONST(decltype(ToU)), Q::quantity_spec)) &&
detail::SaneScaling<Q::unit, ToU, typename Q::rep>
[[nodiscard]]
constexpr
Quantity auto
value_cast(FwdQ&& q);
Description
Implicit conversions between quantities of different types are allowed only for "safe" (e.g. non-truncating) conversion. In truncating cases an explicit cast have to be used.
auto d = value_cast<si::second>(1234 ms);
Template Parameters
Name
Description
ToU
a unit to use for a target quantity
Explicit cast of a quantity point's representation
Synopsis
Declared in <mp-units/framework/value_cast.h>
template<
Quantity ToQ,
typename FwdQP,
QuantityPoint QP = std::remove_cvref_t<FwdQP>>
requires (ToQ::quantity_spec == QP::quantity_spec) &&
(MP_UNITS_WEAK_UNIT_OF(MP_UNITS_NONCONST_TYPE(ToQ::unit), QP::quantity_spec)) &&
std::constructible_from<typename ToQ::rep, typename QP::rep> &&
detail::SaneScaling<QP::unit, ToQ::unit, typename ToQ::rep>
[[nodiscard]]
constexpr
QuantityPoint auto
value_cast(FwdQP&& qp);
Description
Implicit conversions between quantities of different types are allowed only for "safe" (e.g. non-truncating) conversion. In truncating cases an explicit cast have to be used.
inline constexpr struct A : absolute_point_origin<A, isq::distance> A;
using ToQ = quantity<mm, int>; auto qp = value_cast<ToQ>(quantity_point{1.23 m});
Note that value_cast only changes the "representation aspects" (unit and representation type), but not the "meaning" (quantity type or the actual point that is being described).
Template Parameters
Name
Description
ToQ
a target quantity type to which to cast the representation of the point
Explicit cast of a quantity point's representation, including potentially the point origin
Synopsis
Declared in <mp-units/framework/value_cast.h>
template<
QuantityPoint ToQP,
typename FwdQP,
QuantityPoint QP = std::remove_cvref_t<FwdQP>>
requires (ToQP::quantity_spec == QP::quantity_spec) &&
(MP_UNITS_WEAK_UNIT_OF(MP_UNITS_NONCONST_TYPE(ToQP::unit), QP::quantity_spec)) &&
(detail::same_absolute_point_origins(ToQP::point_origin, QP::point_origin)) &&
std::constructible_from<typename ToQP::rep, typename QP::rep> &&
detail::SaneScaling<QP::unit, ToQP::unit, typename ToQP::rep>
[[nodiscard]]
constexpr
QuantityPoint auto
value_cast(FwdQP&& qp);
Description
Implicit conversions between quantities of different types are allowed only for "safe" (e.g. non-truncating) conversion. In truncating cases an explicit cast have to be used.
inline constexpr struct A : absolute_point_origin<A, isq::distance> A; inline constexpr struct B : relative_point_origin<A + 1*m> B;
using ToQP = quantity_point<mm, B, int>; auto qp = value_cast<ToQP>(quantity_point{1.23 m});
Note that value_cast only changes the "representation aspects" (unit, representation type and point origin), but not the "meaning" (quantity type or the actual point that is being described).
Note also that changing the point origin bears risks regarding truncation and overflow similar to other casts that change representation (which is why we require a value_cast
and disallow implicit conversions). This cast is guaranteed not to cause overflow of any intermediate representation type provided that the input quantity point is within the range of ToQP
. Calling value_cast<ToQP>(qp)
on a qp
outside of the range of ToQP
is potentially undefined behaviour. The implementation further attempts not to cause more than rounding error than approximately the sum of the resolution of qp
as represented in FromQP
, plust the resolution of qp
as represented in ToQP
.
Template Parameters
Name
Description
ToQP
a target quantity point type to which to cast the representation of the point
Explicit cast of a quantity point's representation type
Synopsis
Declared in <mp-units/framework/value_cast.h>
template<
typename ToRep,
typename FwdQP,
QuantityPoint QP = std::remove_cvref_t<FwdQP>>
requires RepresentationOf<ToRep, QP::quantity_spec> && std::constructible_from<ToRep, typename QP::rep>
[[nodiscard]]
constexpr
quantity_point<QP::reference, QP::point_origin, ToRep>
value_cast(FwdQP&& qp);
Description
Implicit conversions between quantity points of different types are allowed only for "safe" (e.g. non-truncating) conversion. In truncating cases an explicit cast have to be used.
auto qp = value_cast<int>(quantity_point{1.23 ms});
Return Value
A quantity point
Template Parameters
Name
Description
ToRep
a representation type to use for a target quantity point
Explicit cast of a quantity point's unit
Synopsis
Declared in <mp-units/framework/value_cast.h>
template<
Unit auto ToU,
typename FwdQP,
QuantityPoint QP = std::remove_cvref_t<FwdQP>>
requires (MP_UNITS_WEAK_UNIT_OF(MP_UNITS_REMOVE_CONST(decltype(ToU)), QP::quantity_spec)) &&
detail::SaneScaling<QP::unit, ToU, typename QP::rep>
[[nodiscard]]
constexpr
QuantityPoint auto
value_cast(FwdQP&& qp);
Description
Implicit conversions between quantity points of different types are allowed only for "safe" (e.g. non-truncating) conversion. In truncating cases an explicit cast have to be used.
auto qp = value_cast<si::second>(quantity_point{1234 ms});
Template Parameters
Name
Description
ToU
a unit to use for a target quantity point
Synopsis
Declared in <mp-units/framework/value_cast.h>
template<
typename ToRep,
Unit auto ToU,
typename FwdQ,
Quantity Q = std::remove_cvref_t<FwdQ>>
requires (MP_UNITS_WEAK_UNIT_OF(MP_UNITS_REMOVE_CONST(decltype(ToU)), Q::quantity_spec)) &&
RepresentationOf<ToRep, Q::quantity_spec> && std::constructible_from<ToRep, typename Q::rep> &&
detail::SaneScaling<Q::unit, ToU, ToRep>
[[nodiscard]]
constexpr
Quantity auto
value_cast(FwdQ&& q);
Explicit cast of a quantity's unit and representation type
Synopsis
Declared in <mp-units/framework/value_cast.h>
template<
Unit auto ToU,
typename ToRep,
typename FwdQ,
Quantity Q = std::remove_cvref_t<FwdQ>>
requires (MP_UNITS_WEAK_UNIT_OF(MP_UNITS_REMOVE_CONST(decltype(ToU)), Q::quantity_spec)) &&
RepresentationOf<ToRep, Q::quantity_spec> && std::constructible_from<ToRep, typename Q::rep> &&
detail::SaneScaling<Q::unit, ToU, ToRep>
[[nodiscard]]
constexpr
Quantity auto
value_cast(FwdQ&& q);
Description
Implicit conversions between quantities of different types are allowed only for "safe" (e.g. non-truncating) conversion. In truncating cases an explicit cast have to be used.
auto q = value_cast<us, int>(1.23 ms);
Template Parameters
Name
Description
ToU
a unit to use for the target quantity
ToRep
a representation type to use for the target quantity
Synopsis
Declared in <mp-units/framework/value_cast.h>
template<
typename ToRep,
Unit auto ToU,
typename FwdQP,
QuantityPoint QP = std::remove_cvref_t<FwdQP>>
requires (MP_UNITS_WEAK_UNIT_OF(MP_UNITS_REMOVE_CONST(decltype(ToU)), QP::quantity_spec)) &&
RepresentationOf<ToRep, QP::quantity_spec> && std::constructible_from<ToRep, typename QP::rep> &&
detail::SaneScaling<QP::unit, ToU, ToRep>
[[nodiscard]]
constexpr
QuantityPoint auto
value_cast(FwdQP&& qp);
Explicit cast of a quantity point's unit and representation type
Synopsis
Declared in <mp-units/framework/value_cast.h>
template<
Unit auto ToU,
typename ToRep,
typename FwdQP,
QuantityPoint QP = std::remove_cvref_t<FwdQP>>
requires (MP_UNITS_WEAK_UNIT_OF(MP_UNITS_REMOVE_CONST(decltype(ToU)), QP::quantity_spec)) &&
RepresentationOf<ToRep, QP::quantity_spec> && std::constructible_from<ToRep, typename QP::rep> &&
detail::SaneScaling<QP::unit, ToU, ToRep>
[[nodiscard]]
constexpr
QuantityPoint auto
value_cast(FwdQP&& qp);
Description
Implicit conversions between quantities of different types are allowed only for "safe" (e.g. non-truncating) conversion. In truncating cases an explicit cast have to be used.
auto qp = value_cast<us, int>(quantity_point{1.23 ms});
Template Parameters
Name
Description
ToU
a unit to use for the target quantity
ToRep
a representation type to use for the target quantity
Stream insertion operators
Synopses
Declared in <mp-units/cartesian_vector.h>
Stream insertion operator
std::basic_ostream<CharT>&
operator<< (
std::basic_ostream<CharT>& os,
basic_fixed_string const& str);
» more...
Stream insertion operator
template<
typename CharT,
typename Traits,
Unit D>
std::basic_ostream<CharT, Traits>&
operator<< (
std::basic_ostream<CharT, Traits>& os,
D d);
» more...
Stream insertion operator
template<
typename CharT,
typename Traits,
auto R,
typename Rep>
std::basic_ostream<CharT, Traits>&
operator<< (
std::basic_ostream<CharT, Traits>& os,
quantity<R, Rep> const& q)
requires requires { os << q.numerical_value_ref_in(q.unit); };
» more...
Stream insertion operator
constexpr
std::ostream&
operator<< (
std::ostream& os,
cartesian_vector const& vec);
» more...
Stream insertion operator
Synopsis
Declared in <mp-units/ext/fixed_string.h>
std::basic_ostream<CharT>&
operator<<(
std::basic_ostream<CharT>& os,
basic_fixed_string const& str);
Return Value
Reference to the current output stream
Parameters
Name
Description
os
An output stream
str
The object to output
Stream insertion operator
Synopsis
Declared in <mp-units/framework/dimension.h>
template<
typename CharT,
typename Traits,
Unit D>
std::basic_ostream<CharT, Traits>&
operator<<(
std::basic_ostream<CharT, Traits>& os,
D d);
Return Value
Reference to the current output stream
Parameters
Name
Description
os
An output stream
d
The object to output
Stream insertion operator
Synopsis
Declared in <mp-units/framework/quantity.h>
template<
typename CharT,
typename Traits,
auto R,
typename Rep>
std::basic_ostream<CharT, Traits>&
operator<<(
std::basic_ostream<CharT, Traits>& os,
quantity<R, Rep> const& q)
requires requires { os << q.numerical_value_ref_in(q.unit); };
Return Value
Reference to the current output stream
Parameters
Name
Description
os
An output stream
q
The object to output
Stream insertion operator
Synopsis
Declared in <mp-units/cartesian_vector.h>
constexpr
std::ostream&
operator<<(
std::ostream& os,
cartesian_vector const& vec);
Return Value
Reference to the current output stream
Parameters
Name
Description
os
An output stream
vec
The object to output
Equality operators
Synopses
Declared in <mp-units/ext/fixed_string.h>
Equality operator
template<std::size_t N2>
[[nodiscard]]
consteval
bool
operator== (
basic_fixed_string const& lhs,
CharT const(& rhs)[]);
» more...
Equality operator
template<std::size_t N2>
[[nodiscard]]
constexpr
bool
operator== (
basic_fixed_string const& lhs,
basic_fixed_string<CharT, N2> const& rhs);
» more...
Equality operator
template<
std::size_t N2,
std::size_t M2>
[[nodiscard]]
constexpr
bool
operator== (
symbol_text const& lhs,
symbol_text<N2, M2> const& rhs) noexcept;
» more...
Equality operator
template<AssociatedUnit U2>
[[nodiscard]]
consteval
bool
operator== (
reference lhs,
U2 u2);
» more...
Equality operator
template<
typename Q2,
typename U2>
[[nodiscard]]
consteval
bool
operator== (
reference lhs,
reference<Q2, U2> rhs);
» more...
Equality operator
template<
std::derived_from<quantity> Q,
RepresentationOf<quantity_spec> Value>
requires detail::DimensionlessOne<Q::reference> && std::equality_comparable_with<rep, Value>
[[nodiscard]]
constexpr
bool
operator== (
Q const& lhs,
Value const& rhs);
» more...
Equality operator
template<
std::derived_from<quantity> Q,
auto R2,
typename Rep2>
requires requires { typename std::common_type_t<quantity, quantity<R2, Rep2>>; } &&
std::equality_comparable<typename std::common_type_t<quantity, quantity<R2, Rep2>>::rep>
[[nodiscard]]
constexpr
bool
operator== (
Q const& lhs,
quantity<R2, Rep2> const& rhs);
» more...
Equality operator
template<
std::derived_from<quantity_point> QP,
QuantityPointOf<absolute_point_origin> QP2>
requires std::equality_comparable_with<quantity_type, typename QP2::quantity_type>
[[nodiscard]]
constexpr
bool
operator== (
QP const& lhs,
QP2 const& rhs);
» more...
Equality operator
Synopsis
Declared in <mp-units/ext/fixed_string.h>
template<std::size_t N2>
[[nodiscard]]
consteval
bool
operator==(
basic_fixed_string const& lhs,
CharT const(& rhs)[]);
Return Value
true
if the objects are equal, false
otherwise
Parameters
Name
Description
lhs
The left operand
rhs
The right operand
Equality operator
Return Value
true
if the objects are equal, false
otherwise
Parameters
Name
Description
lhs
The left operand
rhs
The right operand
Equality operator
Synopsis
Declared in <mp-units/framework/symbol_text.h>
template<
std::size_t N2,
std::size_t M2>
[[nodiscard]]
constexpr
bool
operator==(
symbol_text const& lhs,
symbol_text<N2, M2> const& rhs) noexcept;
Return Value
true
if the objects are equal, false
otherwise
Parameters
Name
Description
lhs
The left operand
rhs
The right operand
Equality operator
Synopsis
Declared in <mp-units/framework/reference.h>
template<AssociatedUnit U2>
[[nodiscard]]
consteval
bool
operator==(
reference lhs,
U2 u2);
Return Value
true
if the objects are equal, false
otherwise
Parameters
Name
Description
lhs
The left operand
u2
The right operand
Equality operator
Synopsis
Declared in <mp-units/framework/reference.h>
template<
typename Q2,
typename U2>
[[nodiscard]]
consteval
bool
operator==(
reference lhs,
reference<Q2, U2> rhs);
Return Value
true
if the objects are equal, false
otherwise
Parameters
Name
Description
lhs
The left operand
rhs
The right operand
Equality operator
Synopsis
Declared in <mp-units/framework/quantity.h>
template<
std::derived_from<quantity> Q,
RepresentationOf<quantity_spec> Value>
requires detail::DimensionlessOne<Q::reference> && std::equality_comparable_with<rep, Value>
[[nodiscard]]
constexpr
bool
operator==(
Q const& lhs,
Value const& rhs);
Return Value
true
if the objects are equal, false
otherwise
Parameters
Name
Description
lhs
The left operand
rhs
The right operand
Equality operator
Synopsis
Declared in <mp-units/framework/quantity.h>
template<
std::derived_from<quantity> Q,
auto R2,
typename Rep2>
requires requires { typename std::common_type_t<quantity, quantity<R2, Rep2>>; } &&
std::equality_comparable<typename std::common_type_t<quantity, quantity<R2, Rep2>>::rep>
[[nodiscard]]
constexpr
bool
operator==(
Q const& lhs,
quantity<R2, Rep2> const& rhs);
Return Value
true
if the objects are equal, false
otherwise
Parameters
Name
Description
lhs
The left operand
rhs
The right operand
Equality operator
Synopsis
Declared in <mp-units/framework/quantity_point.h>
template<
std::derived_from<quantity_point> QP,
QuantityPointOf<absolute_point_origin> QP2>
requires std::equality_comparable_with<quantity_type, typename QP2::quantity_type>
[[nodiscard]]
constexpr
bool
operator==(
QP const& lhs,
QP2 const& rhs);
Return Value
true
if the objects are equal, false
otherwise
Parameters
Name
Description
lhs
The left operand
rhs
The right operand
Three-way comparison operators
Synopses
Declared in <mp-units/ext/fixed_string.h>
Three-way comparison operator
template<std::size_t N2>
[[nodiscard]]
consteval
auto
operator<=> (
basic_fixed_string const& lhs,
CharT const(& rhs)[]);
» more...
Three-way comparison operator
template<std::size_t N2>
[[nodiscard]]
constexpr
auto
operator<=> (
basic_fixed_string const& lhs,
basic_fixed_string<CharT, N2> const& rhs);
» more...
Three-way comparison operator
template<
std::size_t N2,
std::size_t M2>
[[nodiscard]]
constexpr
auto
operator<=> (
symbol_text const& lhs,
symbol_text<N2, M2> const& rhs) noexcept;
» more...
Three-way comparison operator
template<
std::derived_from<quantity> Q,
RepresentationOf<quantity_spec> Value>
requires detail::DimensionlessOne<Q::reference> && std::three_way_comparable_with<rep, Value>
[[nodiscard]]
constexpr
auto
operator<=> (
Q const& lhs,
Value const& rhs);
» more...
Three-way comparison operator
template<
std::derived_from<quantity> Q,
auto R2,
typename Rep2>
requires requires { typename std::common_type_t<quantity, quantity<R2, Rep2>>; } &&
std::three_way_comparable<typename std::common_type_t<quantity, quantity<R2, Rep2>>::rep>
[[nodiscard]]
constexpr
auto
operator<=> (
Q const& lhs,
quantity<R2, Rep2> const& rhs);
» more...
Three-way comparison operator
template<
std::derived_from<quantity_point> QP,
QuantityPointOf<absolute_point_origin> QP2>
requires std::three_way_comparable_with<quantity_type, typename QP2::quantity_type>
[[nodiscard]]
constexpr
auto
operator<=> (
QP const& lhs,
QP2 const& rhs);
» more...
Three-way comparison operator
Synopsis
Declared in <mp-units/ext/fixed_string.h>
template<std::size_t N2>
[[nodiscard]]
consteval
auto
operator<=>(
basic_fixed_string const& lhs,
CharT const(& rhs)[]);
Return Value
The relative order of the objects
Parameters
Name
Description
lhs
The left operand
rhs
The right operand
Three-way comparison operator
Return Value
The relative order of the objects
Parameters
Name
Description
lhs
The left operand
rhs
The right operand
Three-way comparison operator
Synopsis
Declared in <mp-units/framework/symbol_text.h>
template<
std::size_t N2,
std::size_t M2>
[[nodiscard]]
constexpr
auto
operator<=>(
symbol_text const& lhs,
symbol_text<N2, M2> const& rhs) noexcept;
Return Value
The relative order of the objects
Parameters
Name
Description
lhs
The left operand
rhs
The right operand
Three-way comparison operator
Synopsis
Declared in <mp-units/framework/quantity.h>
template<
std::derived_from<quantity> Q,
RepresentationOf<quantity_spec> Value>
requires detail::DimensionlessOne<Q::reference> && std::three_way_comparable_with<rep, Value>
[[nodiscard]]
constexpr
auto
operator<=>(
Q const& lhs,
Value const& rhs);
Return Value
The relative order of the objects
Parameters
Name
Description
lhs
The left operand
rhs
The right operand
Three-way comparison operator
Synopsis
Declared in <mp-units/framework/quantity.h>
template<
std::derived_from<quantity> Q,
auto R2,
typename Rep2>
requires requires { typename std::common_type_t<quantity, quantity<R2, Rep2>>; } &&
std::three_way_comparable<typename std::common_type_t<quantity, quantity<R2, Rep2>>::rep>
[[nodiscard]]
constexpr
auto
operator<=>(
Q const& lhs,
quantity<R2, Rep2> const& rhs);
Return Value
The relative order of the objects
Parameters
Name
Description
lhs
The left operand
rhs
The right operand
Three-way comparison operator
Synopsis
Declared in <mp-units/framework/quantity_point.h>
template<
std::derived_from<quantity_point> QP,
QuantityPointOf<absolute_point_origin> QP2>
requires std::three_way_comparable_with<quantity_type, typename QP2::quantity_type>
[[nodiscard]]
constexpr
auto
operator<=>(
QP const& lhs,
QP2 const& rhs);
Return Value
The relative order of the objects
Parameters
Name
Description
lhs
The left operand
rhs
The right operand
Synopsis
Declared in <mp-units/framework/construction_helpers.h>
[[deprecated]]
template<Reference auto R>
constexpr point_<decltype(R)> absolute = {};
Synopsis
Declared in <mp-units/framework/dimension.h>
inline constexpr dimension_one dimension_one = dimension_one;
Quantity of dimension one
Synopsis
Declared in <mp-units/framework/quantity_spec.h>
inline constexpr dimensionless dimensionless = dimensionless;
Description
Quantity of dimension one also commonly named as "dimensionless" is a quantity with a dimension for which all the exponents of the factors corresponding to the base dimensions are zero.
//////////// REAL SCALAR ///////////////
Synopsis
Declared in <mp-units/framework/representation_concepts.h>
template<typename T>
constexpr bool disable_real = false;
Synopsis
Declared in <mp-units/framework/representation_concepts.h>
template<>
inline constexpr bool disable_real<bool> = true;
Synopsis
Declared in <mp-units/framework/representation_concepts.h>
inline constexpr /* implementation-defined */ imag = imag;
Synopsis
Declared in <mp-units/framework/customization_points.h>
[[deprecated]]
template<typename Rep>
constexpr bool is_complex = false;
Synopsis
Declared in <mp-units/ext/type_traits.h>
template<
typename T,
template<typename...> typename Type>
constexpr bool is_derived_from_specialization_of = requires(T* t) { detail::to_base_specialization_of<Type>(t); };
Synopsis
Declared in <mp-units/ext/type_traits.h>
template<
typename T,
template<auto...> typename Type>
constexpr bool is_derived_from_specialization_of_v = requires(T* t) { detail::to_base_specialization_of_v<Type>(t); };
Synopsis
Declared in <mp-units/framework/quantity_spec.h>
inline constexpr is_kind is_kind = is_kind;
Synopsis
Declared in <mp-units/ext/type_traits.h>
template<
class T,
class U>
constexpr bool is_same_v = false;
Synopsis
Declared in <mp-units/ext/type_traits.h>
template<class T>
constexpr bool is_same_v<T, T> = true;
Synopsis
Declared in <mp-units/framework/customization_points.h>
[[deprecated]]
template<typename Rep>
constexpr bool is_scalar = false;
Synopsis
Declared in <mp-units/ext/type_traits.h>
template<
typename T,
template<typename...> typename Type>
constexpr bool is_specialization_of = false;
Synopsis
Declared in <mp-units/ext/type_traits.h>
template<
typename... Params,
template<typename...> typename Type>
constexpr bool is_specialization_of<Type<Params...>, Type> = true;
Synopsis
Declared in <mp-units/ext/type_traits.h>
template<
typename T,
template<auto...> typename Type>
constexpr bool is_specialization_of_v = false;
Synopsis
Declared in <mp-units/ext/type_traits.h>
template<
auto Params...,
template<auto...> typename Type>
constexpr bool is_specialization_of_v<Type<Params...>, Type> = true;
Synopsis
Declared in <mp-units/framework/customization_points.h>
[[deprecated]]
template<typename Rep>
constexpr bool is_tensor = false;
Specifies if a specific conversion between two types preserves the value
Synopsis
Declared in <mp-units/framework/customization_points.h>
template<
typename From,
typename To>
constexpr bool is_value_preserving = treat_as_floating_point<To> || !treat_as_floating_point<From>;
Description
This type trait should be specialized for a custom representation types to specify weather the conversion from the source type to the destination type preserves the value or not. Value-truncating conversions should be forced by the user with explicit casts.
Template Parameters
Name
Description
From
a source representation type
To
a destination representation type
Synopsis
Declared in <mp-units/framework/customization_points.h>
[[deprecated]]
template<typename Rep>
constexpr bool is_vector = false;
Synopsis
Declared in <mp-units/framework/quantity_spec.h>
template<QuantitySpec auto Q>
requires requires { typename kind_of_<decltype(Q)>; }
constexpr kind_of_<decltype(Q)> kind_of;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Synopsis
Declared in <mp-units/framework/unit_magnitude.h>
[[deprecated]]
template<intmax_t N>
constexpr std::optional<intmax_t> known_first_factor = std::nullopt;
Synopsis
Declared in <mp-units/framework/unit_magnitude.h>
template</* implementation-defined */ auto V>
requires (detail::get_base_value(V) > 0)
constexpr UnitMagnitude auto mag = detail::make_magnitude<V>();
Synopsis
Declared in <mp-units/framework/unit_magnitude.h>
[[deprecated]]
inline constexpr UnitMagnitude auto mag_pi = mag<pi>;
Create a Magnitude which is some rational number raised to a rational power.
Synopsis
Declared in <mp-units/framework/unit_magnitude.h>
template<
/* implementation-defined */ auto Base,
int Num,
int Den = 1>
requires (detail::get_base_value(Base) > 0)
constexpr UnitMagnitude auto mag_power = pow<Num, Den>(mag<Base>);
Synopsis
Declared in <mp-units/framework/unit_magnitude.h>
template<
intmax_t N,
intmax_t D>
requires (N > 0)
constexpr UnitMagnitude auto mag_ratio = detail::prime_factorization_v<N> / detail::prime_factorization_v<D>;
Synopsis
Declared in <mp-units/framework/representation_concepts.h>
inline constexpr /* implementation-defined */ magnitude = magnitude;
Synopsis
Declared in <mp-units/framework/representation_concepts.h>
inline constexpr /* implementation-defined */ modulus = modulus;
Synopsis
Declared in <mp-units/framework/unit.h>
inline constexpr one one = one;
Synopsis
Declared in <mp-units/framework/unit.h>
inline constexpr parts_per_million parts_per_million = parts_per_million;
Synopsis
Declared in <mp-units/framework/unit.h>
inline constexpr per_mille per_mille = per_mille;
Synopsis
Declared in <mp-units/framework/unit.h>
inline constexpr percent percent = percent;
Synopsis
Declared in <mp-units/framework/unit_magnitude.h>
inline constexpr pi pi = pi;
Synopsis
Declared in <mp-units/framework/unit.h>
inline constexpr auto ppm = parts_per_million;
Synopsis
Declared in <mp-units/framework/representation_concepts.h>
inline constexpr /* implementation-defined */ real = real;
Puts a space ' ' sign before a unit symbol
Synopsis
Declared in <mp-units/framework/unit.h>
template<Unit auto U>
constexpr bool space_before_unit_symbol = true;
Description
Quantities of some units (e.g. degree, arcminute, arcsecond) should not be printed with the space between a number and a unit. For those a partial specialization with the value false
should be provided.
Specifies if a value of a type should be treated as a floating-point value
Synopsis
Declared in <mp-units/framework/customization_points.h>
template<typename Rep>
constexpr bool treat_as_floating_point = std::chrono::treat_as_floating_point_v<value_type_t<Rep>>;
Description
This type trait should be specialized for a custom representation type to specify that values of this type should be treated by the library as a floating-point ones which will enable implicit conversions between quantities.
Template Parameters
Name
Description
Rep
a representation type for which a type trait is defined
Synopsis
Declared in <mp-units/framework/unit_magnitude.h>
inline constexpr auto π = pi;
A concept matching all units that can be used as quantity references
Synopsis
Declared in <mp-units/framework/unit_concepts.h>
template<typename U>
concept AssociatedUnit = Unit<U> && detail::has_associated_quantity(U{});
A concept matching all dimensions in the library.
Synopsis
Declared in <mp-units/framework/dimension_concepts.h>
template<typename T>
concept Dimension = std::derived_from<T, detail::dimension_interface> && detail::SymbolicConstant<T>;
Description
Satisfied by all dimension types in the library.
A concept checking if the argument is of the same dimension.
Synopsis
Declared in <mp-units/framework/dimension_concepts.h>
template<
typename T,
auto D>
concept DimensionOf = Dimension<T> && Dimension<MP_UNITS_REMOVE_CONST(decltype(D))> && (T{} == D);
Description
Satisfied when both argument satisfy a Dimension
concept and when they compare equal.
A concept matching all quantity point origins in the library
Synopsis
Declared in <mp-units/framework/quantity_point_concepts.h>
template<typename T>
concept PointOrigin = std::derived_from<T, detail::point_origin_interface> && detail::SymbolicConstant<T>;
Description
Satisfied by either quantity points or by all types derived from absolute_point_origin
class template.
A concept matching all quantity point origins for a specified quantity type in the library
Synopsis
Declared in <mp-units/framework/quantity_point_concepts.h>
template<
typename T,
auto QS>
concept PointOriginFor = PointOrigin<T> && QuantitySpecOf<MP_UNITS_REMOVE_CONST(decltype(QS)), T::_quantity_spec_>;
Description
Satisfied by all quantity point origins that are defined using a provided quantity specification.
A concept to be used to define prefixes for a unit
Synopsis
Declared in <mp-units/framework/unit_concepts.h>
template<typename T>
concept PrefixableUnit = Unit<T> && is_derived_from_specialization_of_v<T, named_unit>;
A concept matching all quantities in the library
Synopsis
Declared in <mp-units/framework/quantity_concepts.h>
template<typename T>
concept Quantity = detail::is_derived_from_specialization_of_quantity<T>;
Description
Satisfied by all types being a either specialization or derived from quantity
A concept matching all external quantities like types
Synopsis
Declared in <mp-units/framework/quantity_concepts.h>
template<typename T>
concept QuantityLike = !Quantity<T> && detail::QuantityLikeImpl<T, quantity_like_traits> && requires {
typename quantity<quantity_like_traits<T>::reference, typename quantity_like_traits<T>::rep>;
};
Description
Satisfied by all external types (not-defined in mp-units) that via a quantity_like_traits
provide all quantity-specific information.
A concept matching all quantities of the provided quantity spec
Synopsis
Declared in <mp-units/framework/quantity_concepts.h>
template<
typename Q,
auto QS>
concept QuantityOf = Quantity<Q> && QuantitySpec<MP_UNITS_REMOVE_CONST(decltype(QS))> &&
ReferenceOf<MP_UNITS_NONCONST_TYPE(Q::reference), QS>;
Description
Satisfied by all quantities with the reference satisfying ReferenceOf<QS>.
A concept matching all quantity points in the library
Synopsis
Declared in <mp-units/framework/quantity_point_concepts.h>
template<typename T>
concept QuantityPoint = detail::is_quantity_point<T>;
Description
Satisfied by all types being either a specialization or derived from quantity_point
A concept matching all external quantity point like types
Synopsis
Declared in <mp-units/framework/quantity_point_concepts.h>
template<typename T>
concept QuantityPointLike = !QuantityPoint<T> && detail::QuantityLikeImpl<T, quantity_point_like_traits> && requires {
typename quantity_point<quantity_point_like_traits<T>::reference, quantity_point_like_traits<T>::point_origin,
typename quantity_point_like_traits<T>::rep>;
};
Description
Satisfied by all external types (not-defined in mp-units) that via a quantity_point_like_traits
provide all quantity_point-specific information.
A concept matching all quantity points of the provided property
Synopsis
Declared in <mp-units/framework/quantity_point_concepts.h>
template<
typename QP,
auto V>
concept QuantityPointOf = QuantityPoint<QP> && (ReferenceOf<MP_UNITS_NONCONST_TYPE(QP::reference), V> ||
detail::SameAbsolutePointOriginAs<MP_UNITS_NONCONST_TYPE(QP::absolute_point_origin), V>);
Description
Satisfied by all quantity points with a quantity_spec being the instantiation derived from the provided quantity_spec type, or quantity points having the origin with the same absolute_point_origin
.
Synopsis
Declared in <mp-units/framework/quantity_spec_concepts.h>
template<typename T>
concept QuantitySpec = std::derived_from<T, detail::quantity_spec_interface_base> && detail::SymbolicConstant<T>;
A concept matching all quantity specifications of a provided quantity spec value
Synopsis
Declared in <mp-units/framework/quantity_spec_concepts.h>
template<
typename T,
auto QS>
concept QuantitySpecOf = QuantitySpec<T> && QuantitySpec<MP_UNITS_REMOVE_CONST(decltype(QS))> && (mp_units::implicitly_convertible(T{}, QS));
Description
Satisfied by all quantity specifications that are implicitly convertible to the provided QS
value.
A concept matching all references in the library.
Synopsis
Declared in <mp-units/framework/reference_concepts.h>
template<typename T>
concept Reference = MP_UNITS_ASSOCIATED_UNIT_T(T) || is_specialization_of<T, reference>;
Description
Satisfied by all specializations of reference.
A concept matching all references of the provided quantity spec
Synopsis
Declared in <mp-units/framework/reference_concepts.h>
template<
typename T,
auto QS>
concept ReferenceOf = Reference<T> && QuantitySpec<MP_UNITS_REMOVE_CONST(decltype(QS))> &&
QuantitySpecOf<decltype(get_quantity_spec(T{})), QS>;
Description
Satisfied by all references for which QuantitySpecOf<QS>
is true.
Synopsis
Declared in <mp-units/framework/representation_concepts.h>
template<
typename T,
auto V>
concept RepresentationOf = ((QuantitySpec<MP_UNITS_REMOVE_CONST(decltype(V))> &&
((detail::QuantityKindSpec<MP_UNITS_REMOVE_CONST(decltype(V))> && detail::SomeRepresentation<T>) ||
detail::IsOfCharacter<T, V.character>)) ||
(std::same_as<quantity_character, decltype(V)> && detail::IsOfCharacter<T, V>));
A concept matching all unit types in the library
Synopsis
Declared in <mp-units/framework/unit_concepts.h>
template<typename T>
concept Unit = std::derived_from<T, detail::unit_interface> && detail::SymbolicConstant<T>;
Description
Satisfied by all unit types provided by the library.
Concept to detect whether T is a valid UnitMagnitude.
Synopsis
Declared in <mp-units/framework/unit_magnitude_concepts.h>
template<typename T>
concept UnitMagnitude = is_specialization_of_v<T, detail::unit_magnitude>;
A concept matching all units associated with the provided quantity spec
Synopsis
Declared in <mp-units/framework/unit_concepts.h>
template<
typename U,
auto QS>
concept UnitOf = MP_UNITS_ASSOCIATED_UNIT<U> && QuantitySpec<MP_UNITS_REMOVE_CONST(decltype(QS))> &&
(implicitly_convertible(get_quantity_spec(U{}), QS) ||
(unsatisfied<"Unit '{}' is associated with quantity of kind '{}' which is not convertible to the '{}' quantity">(
U{}, type_name(get_quantity_spec(U{})._quantity_spec_), type_name(QS))));
Description
Satisfied by all units for which an associated quantity spec is implicitly convertible to the provided QS
value.