Defined in header <chrono> | ||
---|---|---|
template <class Rep, class Period> constexpr duration<Rep, Period> abs(duration<Rep, Period> d) | (since C++17) |
Returns the absolute value of the duration d
. Specifically, if d >= d.zero()
, return d
, otherwise return -d
.
The function does not participate in the overload resolution unless std::numeric_limits<Rep>::is_signed
is true
.
d | - | duration |
Absolute value of d
.
implements unary + and unary - (public member function) |
|
(C++11) | computes absolute value of an integral value (|x|) (function) |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
http://en.cppreference.com/w/cpp/chrono/duration/abs