std::chrono:: operator==,<=> (std::chrono::month_day)
From cppreference.net
C++
Date and time library
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
std::chrono::month_day
| Member functions | ||||
| Nonmember functions | ||||
|
operator==
operator<=>
|
||||
| Helper classes | ||||
|
(C++26)
|
|
헤더에 정의됨
<chrono>
|
||
|
constexpr
bool
operator
==
(
const
std::
chrono
::
month_day
&
x,
const std:: chrono :: month_day & y ) noexcept ; |
(1) | (C++20부터) |
|
constexpr
std::
strong_ordering
operator
<=>
(
const
std::
chrono
::
month_day
&
x,
const std:: chrono :: month_day & y ) noexcept ; |
(2) | (C++20부터) |
두
month_day
값을 비교합니다.
<
,
<=
,
>
,
>=
, 그리고
!=
연산자들은 각각
합성됩니다
operator
<=>
와
operator
==
로부터.
반환값
1)
x.
month
(
)
==
y.
month
(
)
&&
x.
day
(
)
==
y.
day
(
)
2)
x.
month
(
)
<=>
y.
month
(
)
!
=
0
?
x.
month
(
)
<=>
y.
month
(
)
:
x.
day
(
)
<=>
y.
day
(
)
예제
이 코드 실행
#include <chrono> #include <iostream> int main() { constexpr auto md1{std::chrono::August/15}; constexpr auto md2{std::chrono::month(8)/std::chrono::day(15)}; std::cout << std::boolalpha << (md1 == md2) << '\n'; static_assert(md1 <= md2); }
출력:
true