std::chrono::year:: operator+, std::chrono::year:: operator-
From cppreference.net
C++
Date and time library
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
std::chrono::year
| Member functions | ||||
|
year::operator+
year::operator-
|
||||
| Nonmember functions | ||||
| Helper classes | ||||
|
(C++26)
|
|
constexpr
std::
chrono
::
year
operator
+
(
)
noexcept
;
|
(1) | (C++20 이후) |
|
constexpr
std::
chrono
::
year
operator
-
(
)
noexcept
;
|
(2) | (C++20 이후) |
연도 값에 단항 연산자를 적용합니다.
1)
*
this
의 복사본을 반환합니다.
2)
year
값이
*
this
의 year 값의 부정(negation)인
year
를 반환합니다.
반환값
1)
*
this
2)
std::
chrono
::
year
(
-
int
(
*
this
)
)
예제
이 코드 실행
#include <chrono> #include <iostream> int main() { constexpr std::chrono::year y{2020}; constexpr auto ny = -y; std::cout << "The year " << (int)y << " negated is " << (int)ny << '\n'; }
출력:
The year 2020 negated is -2020