C++
应用 | Utilities

std::chrono::abs(std::chrono::duration)

Std::Time::ABS%28 std::Time::工期%29

Defined in header
template <class Rep, class Period> constexpr duration<Rep, Period> abs(duration<Rep, Period> d)(since C++17)

返回持续时间的绝对值。d具体而言,如果d >= d.zero(),返回d,否则返回-d...

该函数不参与重载解析,除非std::numeric_limits<Rep>::is_signed是true...

参数

d-duration

返回值

绝对值d...

可能的实施

模板<类Rep,类周期,class=std::Enable[医]如果[医]t<std::timeo::工期<rep,期间>:min%28%29<std::time:time<rep,time>:0%28%29>conexpr std::crono::time<rep,期>abs%28工期<rep,期间>d%29{red>=d.0%28%29?D:-d;}

*。

另见

operator+operator-implements unary + and unary - (public member function)
abs(int)labsllabs (C++11)computes absolute value of an integral value (|x|) (function)

© cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

http://en.cppreference.com/w/cpp/rono/time/abs