|
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Member functions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Non-member functions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Helper classes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (1) | ||
constexpr duration operator+()const; | (until C++17) | |
constexprstd::common_type_t<duration> operator+()const; | (since C++17) | |
| (2) | ||
constexpr duration operator-()const; | (until C++17) | |
constexprstd::common_type_t<duration> operator-()const; | (since C++17) | |
Implements unary plus and unary minus for the durations.
Ifrep_ is a member variable holding the number of ticks in a duration object, andD is the return type,
Contents |
(none)
#include <chrono>#include <iostream> int main(){constexprstd::chrono::seconds s1(-052);constexprstd::chrono::seconds s2=-s1; std::cout<<"Negated "<< s1<<" are "<< s2<<'\n';}
Output:
Negated -42s are 42s
| increments or decrements the tick count (public member function)[edit] | |
| implements arithmetic operations with durations as arguments (function template)[edit] |