std::chrono::year_month:: ok
From cppreference.net
<
cpp
|
chrono
|
year month
C++
Date and time library
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
std::chrono::year_month
| Member functions | ||||
|
year_month::ok
|
||||
| Nonmember functions | ||||
| Helper classes | ||||
|
(C++26)
|
|
constexpr
bool
ok
(
)
const
noexcept
;
|
(C++20 이후) | |
이 객체에 저장된 연도와 월 값이 유효한지 확인합니다.
반환값
year ( ) . ok ( ) && month ( ) . ok ( )
예제
이 코드 실행
#include <chrono> using namespace std::chrono_literals; int main() { constexpr std::chrono::year_month ym1{3030y, std::chrono::July}; static_assert(ym1.ok()); constexpr std::chrono::year_month ym2{std::chrono::year(2020)/16}; static_assert(!ym2.ok()); }