std::chrono:: operator==,<=> (std::chrono::year_month_day)
|
헤더 파일에 정의됨
<chrono>
|
||
|
constexpr
bool
operator
==
(
const
std::
chrono
::
year_month_day
&
x,
const std:: chrono :: year_month_day & y ) noexcept ; |
(1) | (C++20부터) |
|
constexpr
std::
strong_ordering
operator
<=>
(
const
std::
chrono
::
year_month_day
&
x,
|
(2) | (C++20부터) |
두
year_month_day
값
x
와
y
를 비교합니다. 이는 사전식 비교입니다:
year()
가 먼저 비교되고, 다음으로
month()
, 그 다음
day()
가 비교됩니다.
<
,
<=
,
>
,
>=
, 그리고
!=
연산자들은 각각
합성됩니다
operator
<=>
와
operator
==
로부터.
반환값
참고 사항
만약 x 와 y 가 모두 유효한 날짜를 나타낸다면 ( x. ok ( ) && y. ok ( ) == true ), 사전식 비교 결과는 달력 순서와 일치합니다.
예제
#include <chrono> int main() { constexpr auto ymd1{std::chrono::day(13)/7/1337}; constexpr auto ymd2{std::chrono::year(1337)/7/13}; static_assert(ymd1 == ymd2); static_assert(ymd1 <= ymd2); static_assert(ymd1 >= ymd2); static_assert(ymd1 <=> ymd2 == 0); }