名稱空間
變體
操作

std::chrono::operator==(std::chrono::year_month_weekday_last)

來自 cppreference.com
 
 
 
 
定義於標頭檔案 <chrono>
constexpr bool operator==( const std::chrono::year_month_weekday_last& x,
                           const std::chrono::year_month_weekday_last& y ) noexcept;
(C++20 起)

比較兩個 year_month_weekday_lastxy

!= 運算子由 operator== 合成

[編輯] 返回值

x.year() == y.year() && x.month() == y.month() && x.weekday() == y.weekday()

[編輯] 示例

#include <chrono>
#include <iostream>
using namespace std::chrono;
 
int main()
{
    constexpr auto ymwdl1{Tuesday[last]/11/2021};
    auto ymwdl2 = Tuesday[last]/11/2020;
    ymwdl2 += months(12);
    std::cout << std::boolalpha << (ymwdl1 == ymwdl2) << '\n';
}

輸出

true