Skip to content

mp_units::abs

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); }
#if MP_UNITS_HOSTED || __cpp_lib_freestanding_cstdlib >= 202306L
           || 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

Note

The return value should not be discarded.

Parameters

NameDescription
qQuantity being the base of the operation