std::chrono::duration<Rep,Period>:: operator++, std::chrono::duration<Rep,Period>:: operator--
From cppreference.net
C++
Date and time library
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
std::chrono::duration
| Member functions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Non-member functions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Helper classes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
duration
&
operator
++
(
)
;
|
(1) |
(C++11부터)
(C++17부터 constexpr) |
|
duration operator
++
(
int
)
;
|
(2) |
(C++11부터)
(C++17부터 constexpr) |
|
duration
&
operator
--
(
)
;
|
(3) |
(C++11부터)
(C++17부터 constexpr) |
|
duration operator
--
(
int
)
;
|
(4) |
(C++11부터)
(C++17부터 constexpr) |
이 지속 시간의 틱 수를 증가시키거나 감소시킵니다.
만약
rep_
가 duration 객체의 틱 수를 보유하는 멤버 변수라면,
1)
다음에 해당함
++
rep_
;
return
*
this
;
.
2)
다음과 동일함
return
duration
(
rep_
++
)
.
3)
다음과 동일함
--
rep_
;
return
*
this
;
.
4)
다음과 동일함
return
duration
(
rep_
--
)
;
.
목차 |
매개변수
(없음)
반환값
1,3)
수정 후 이 duration에 대한 참조.
2,4)
수정 전에 생성된 duration의 복사본입니다.
예제
이 코드 실행
#include <chrono> #include <iostream> int main() { std::chrono::hours h(1); std::chrono::minutes m = ++h; m--; std::cout << m.count() << " minutes\n"; }
출력:
119 minutes
참고 항목
|
두 duration 간의 복합 할당 연산 구현
(public member function) |
|
|
duration을 인자로 사용하는 산술 연산 구현
(function template) |