std::chrono::duration<Rep,Period>::operator+=, -=, *=, /=, %=

来自cppreference.com
< cpp‎ | chrono‎ | duration
 
 
 
 
(1)
duration& operator+=( const duration& d );
(C++11 起)
(C++17 起为 constexpr)
(2)
duration& operator-=( const duration& d );
(C++11 起)
(C++17 起为 constexpr)
(3)
duration& operator*=( const rep& rhs );
(C++11 起)
(C++17 起为 constexpr)
(4)
duration& operator/=( const rep& rhs );
(C++11 起)
(C++17 起为 constexpr)
(5)
duration& operator%=( const rep& rhs );
(C++11 起)
(C++17 起为 constexpr)
(6)
duration& operator%=( const duration& rhs );
(C++11 起)
(C++17 起为 constexpr)

在两个拥有同一周期的时长或时长和计次值之间进行复合赋值。

rep_ 是此 duration 对象中保有计次数的成员变量,则

1) 等价于 rep_ += d.count(); return *this;
2) 等价于 rep_ -= d.count(); return *this;
3) 等价于 rep_ *= rhs; return *this;
4) 等价于 rep_ /= rhs; return *this;
5) 等价于 rep_ %= rhs; return *this;
6) 等价于 rep_ %= d.count(); return *this;

目录