std::chrono::year_month_weekday:: ok
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Member functions | ||||
|
year_month_weekday::ok
|
||||
| Nonmember functions | ||||
| Helper classes | ||||
|
constexpr
bool
ok
(
)
const
noexcept
;
|
(C++20부터) | |
이
year_month_weekday
객체가 유효한 날짜를 나타내는지 확인합니다.
반환값
true
를 반환하는 경우는 이
year_month_weekday
객체가 유효한 날짜를 나타낼 때, 즉
year
(
)
.
ok
(
)
&&
month
(
)
.
ok
(
)
&&
weekday_indexed
(
)
.
ok
(
)
가
true
이고 지정된 연도와 월에 최소한
index()
weekday()
이
존재하는 경우입니다. 그렇지 않으면
false
를 반환합니다.
예제
#include <cassert> #include <chrono> int main() { auto ymwdi{std::chrono::Wednesday[1]/1/2021}; assert(ymwdi.ok()); ymwdi = std::chrono::year(2021)/std::chrono::month(1)/std::chrono::Wednesday[42]; assert(!ymwdi.ok()); }