名稱空間
變體
操作

std::chrono::operator==(std::chrono::weekday_last)

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

比較兩個 weekday_lastxy

!= 運算子由 operator== 合成

[編輯] 返回值

x.weekday() == y.weekday()

[編輯] 示例

#include <chrono>
#include <iostream>
 
int main()
{
    constexpr auto wdl1{std::chrono::Tuesday[std::chrono::last]};
    constexpr std::chrono::weekday_last wdl2{std::chrono::weekday(2)};
    std::cout << std::boolalpha
              << (wdl1 == wdl2) << ' '
              << (wdl1 == std::chrono::Wednesday[std::chrono::last]) << '\n';
}

輸出

true false