std::chrono::duration<Rep,Period>::operator+=, -=, *=, /=, %=
Min standard notice:
Performs compound assignments between two durations with the same period or between a duration and a tick count value.
# Declarations
duration& operator+=( const duration& d );
(since C++11) (constexpr since C++17)
duration& operator-=( const duration& d );
(since C++11) (constexpr since C++17)
duration& operator*=( const rep& rhs );
(since C++11) (constexpr since C++17)
duration& operator/=( const rep& rhs );
(since C++11) (constexpr since C++17)
duration& operator%=( const rep& rhs );
(since C++11) (constexpr since C++17)
duration& operator%=( const duration& rhs );
(since C++11) (constexpr since C++17)
# Parameters
d: duration on the right-hand side of the operatorrhs: number of ticks on the right-hand side of the operator
# Return value
A reference to this duration after modification.
# Example
#include <chrono>
#include <iostream>
int main()
{
std::chrono::minutes m(11);
m *= 2;
m += std::chrono::hours(10); // hours implicitly convert to minutes
std::cout << m.count() << " minutes equals "
<< std::chrono::duration_cast<std::chrono::hours>(m).count()
<< " hours and ";
m %= std::chrono::hours(1);
std::cout << m.count() << " minutes\n";
}