名稱空間
變體
操作

operator==, operator<=>(std::coroutine_handle)

來自 cppreference.com
 
 
 
協程支援
協程特質
協程控制代碼
無操作協程
平凡可等待物件
範圍生成器 (Range generators)
(C++23)
 
 
定義於標頭檔案 <coroutine>
constexpr bool
    operator==( std::coroutine_handle<> x, std::coroutine_handle<> y ) noexcept;
(1) (C++20 起)
constexpr std::strong_ordering
    operator<=>( std::coroutine_handle<> x, std::coroutine_handle<> y ) noexcept;
(2) (C++20 起)

根據兩個 std::coroutine_handle<>xy 的底層地址比較它們。

運算子 <<=>>=!= 分別由 operator<=>operator== 合成

目錄

[編輯] 引數

x, y - 要比較的 std::coroutine_handle<>

[編輯] 返回值

1) x.address() == y.address()
2) std::compare_three_way{}(x.address(), y.address())

[編輯] 注意

雖然這些運算子僅為 std::coroutine_handle<> 過載,但 std::coroutine_handle 的其他特化也滿足相等比較 (equality comparable) 和三路比較 (three-way comparable),因為它們能隱式轉換到 std::coroutine_handle<>

[編輯] 示例