std::chrono::operator==,<=>(std::chrono::month_day_last)
来自cppreference.com
< cpp | chrono | month day last
日期和时间工具
时间点 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
时长 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
时钟 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
当天时刻 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
日历 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
时区 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
chrono I/O |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(C++20)
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
C 风格日期和时间 |
std::chrono::month_day_last
成员函数 | ||||
非成员函数 | ||||
operator==operator<=>
|
||||
辅助类 | ||||
在标头
<chrono>
定义
|
||
constexpr bool operator==( const std::chrono::month_day_last& x,
const std::chrono::month_day_last& y ) noexcept; |
(1) | (C++20 起) |
constexpr
std::strong_ordering
operator<=>( const std::chrono::month_day_last& x,
const std::chrono::month_day_last& y ) noexcept; |
(2) | (C++20 起) |
比较二个 month_day_last
值 x
与 y
。
<
、 <=
、 >
、 >=
及 !=
运算符分别从 operator<=>
与 operator==
合成。
返回值
1) x.month() == y.month()
2) x.month() <=>
y.month()
示例
运行此代码
#include <iostream> #include <chrono> int main() { constexpr auto mdl1 {std::chrono::February/std::chrono::last}; constexpr std::chrono::month_day_last mdl2 {std::chrono::month(2)}; std::cout << std::boolalpha << (mdl1 == mdl2) << '\n'; static_assert(mdl1 <= mdl2); }
输出:
true