table of contents
        
      
      
    - Tumbleweed 2024.07.05-1.3
 - Leap-16.0
 - Leap-15.6
 
| std::chrono::duration::operator++,(3) | C++ Standard Libary | std::chrono::duration::operator++,(3) | 
NAME¶
std::chrono::duration::operator++, - std::chrono::duration::operator++,
Synopsis¶
 duration& operator++(); (1) (since C++11)
  
   (constexpr since C++17)
  
   duration operator++( int ); (2) (since C++11)
  
   (constexpr since C++17)
  
   duration& operator--(); (3) (since C++11)
  
   (constexpr since C++17)
  
   duration operator--( int ); (4) (since C++11)
  
   (constexpr since C++17)
  
   Increments or decrements the number of ticks for this duration.
  
   If rep_ is a member variable holding the number of ticks in a duration
    object,
  
   1) Equivalent to ++rep_; return *this;.
  
   2) Equivalent to return duration(rep_++).
  
   3) Equivalent to --rep_; return *this;.
  
   4) Equivalent to return duration(rep_--);.
Parameters¶
(none)
Return value¶
 1,3) A reference to this duration after modification.
  
   2,4) A copy of the duration made before modification.
Example¶
// Run this code
  
   #include <chrono>
  
   #include <iostream>
  
   int main()
  
   {
  
   std::chrono::hours h(1);
  
   std::chrono::minutes m = ++h;
  
   m--;
  
   std::cout << m.count() << " minutes\n";
  
   }
Output:¶
119 minutes
See also¶
 operator+=
  
   operator-= implements compound assignment between two durations
  
   operator*= (public member function)
  
   operator/=
  
   operator%=
  
   operator+
  
   operator-
  
   operator* implements arithmetic operations with durations as arguments
  
   operator/ (function template)
  
   operator%
  
   (C++11)
| 2024.06.10 | http://cppreference.com |