mp_units::quantity

A quantity

Synopsis

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

template<
    Reference auto R,
    RepresentationOf<get_quantity_spec(R)> Rep = double>
class quantity
    : public /* implementation-defined */

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.

Base Classes

NameDescription
/* implementation-defined */

Type Aliases

NameDescription
rep The type used to represent the numerical value of the quantity.

Member Functions

NameDescription
quantity [constructor]Constructors
operator= Assigns a new numerical value to *this.
force_in [deprecated]force_in overloads
force_numerical_value_in [deprecated]Deprecated. Returns the numerical value converted to another unit, truncating if inexact.
in in overloads
magnitude Computes the Euclidean (or, for a complex field, Hermitian) norm of a vector or tensor quantity.
numerical_value_in numerical_value_in overloads
numerical_value_ref_in numerical_value_ref_in overloads
operator%= Computes the remainder of division by another quantity and assigns it to *this.
operator*= Multiplication assignment operators
operator+ Applies unary + to the numerical value.
operator++ Increment operators
operator+= Adds another quantity to *this and assigns the result to *this.
operator- Negates the numerical value.
operator-- Decrement operators
operator-= Subtracts another quantity from *this and assigns the result to *this.
operator/= Division assignment operators
operator Q_ Converts the quantity to an external quantity-like type via quantity_like_traits.
operator V_ Explicitly converts the quantity to its bare numerical value.

Static Member Functions

NameDescription
max Returns a quantity holding the representation type's highest finite value.
min Returns a quantity holding the representation type's lowest finite value.
zero Returns a quantity holding the representation type's zero value.

Data Members

NameDescription
numerical_value_is_an_implementation_detail_ needs to be public for a structural type

Static Data Members

NameDescription
character The quantity character (tensor order and numeric field) extracted from quantity_spec.
dimension The dimension extracted from quantity_spec.
quantity_spec The quantity specification extracted from reference.
reference The reference of the quantity, as provided via the R template parameter.
unit The unit extracted from reference.

Deduction Guides

NameDescription
quantity<R, representation_canonical_type_t<Value>> Deduces a quantity from a numerical value alone, using the one reference by default.
quantity<R{}, representation_canonical_type_t<Value>> Deduces a quantity from a numerical value and an explicit reference.
quantity<quantity_like_traits<Q>::reference, quantity_like_traits<Q>::rep> Deduces a quantity from an external quantity-like type via quantity_like_traits.

Non-Member Functions

NameDescription
absComputes the absolute value of a quantity
cbrtComputes the cubic root of a quantity
ceilComputes the smallest quantity with integer representation and unit type To with its number not less than q
deltaConstructs a quantity of reference R from a raw representation value
epsilonReturns the epsilon of the quantity
expComputes Euler's raised to the given power
floorComputes the largest quantity with integer representation and unit type To with its number not greater than q
fmaComputes the fma of 3 quantities
fmaComputes the fma of 2 quantities and a quantity point
fmodComputes the floating-point remainder of the division operation x / y.
hypotComputes 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
hypotComputes the square root of the sum of the squares of x and y, without undue overflow or underflow at intermediate stages of the computation
inverseComputes the inverse of a quantity in a provided unit
isfiniteDetermines if a quantity is finite.
isinfDetermines if a quantity is infinite.
isnanDetermines if a quantity is a nan.
operator*Constructs a quantity from a representation value and a reference
powComputes the value of a quantity raised to the Num/Den power
remainderComputes the IEEE remainder of the floating point division operation x / y.
roundComputes the nearest quantity with integer representation and unit type To to q
sqrtComputes the square root of a quantity
value_castExplicit cast of a quantity's representation type

Template Parameters

NameDescription
Ra reference of the quantity providing all information about quantity properties
Repa type to be used to represent values of a quantity