std::chrono::year_month:: year, std::chrono::year_month:: month
From cppreference.net
<
cpp
|
chrono
|
year month
C++
Date and time library
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
std::chrono::year_month
| Member functions | ||||
|
year_month::year
year_month::month
|
||||
| Nonmember functions | ||||
| Helper classes | ||||
|
(C++26)
|
|
constexpr
std::
chrono
::
year
year
(
)
const
noexcept
;
|
(1) | (C++20 이후) |
|
constexpr
std::
chrono
::
month
month
(
)
const
noexcept
;
|
(2) | (C++20 이후) |
이
year_month
객체에 저장된 연도와 월 값을 검색합니다.
반환값
1)
저장된
std::chrono::year
값을 반환합니다.
2)
저장된
std::chrono::month
값을 반환합니다.
예제
이 코드 실행
#include <chrono> #include <iostream> int main() { std::cout << std::boolalpha; constexpr auto ym{std::chrono::year(2021)/std::chrono::July}; std::cout << (ym.year() == std::chrono::year(2021)) << ' '; std::cout << (ym.month() == std::chrono::month(7)) << '\n'; }
출력:
true true