std::chrono::operator==(std::chrono::month_weekday_last)

来自cppreference.com
 
 
 
 
在标头 <chrono> 定义
constexpr bool operator==(const std::chrono::month_weekday_last& x,
                          const std::chrono::month_weekday_last& y) noexcept;
(C++20 起)

比较二个 month_weekday_lastxy

!= 运算符从 == 运算符合成

返回值

x.month() == y.month() && x.weekday_last() == y.weekday_last()

示例

#include <iostream>
#include <chrono>
 
int main()
{
    constexpr auto mwdl1 {std::chrono::March/std::chrono::Friday[std::chrono::last]};
    constexpr std::chrono::month_weekday_last mwdl2 {
                  std::chrono::March,
                  std::chrono::Friday[std::chrono::last]
              };
    static_assert(mwdl1 == mwdl2);
    std::cout << "Test passed.\n";
}

输出:

Test passed.