std::operator==, operator<=>(std::coroutine_handle)
来自cppreference.com
< cpp | coroutine | coroutine
handle
工具库
协程支持
| 协程特征 | ||||
|
(C++20)
|
||||
| 协程柄 | ||||
|
(C++20)
|
||||
| 无操作协程 | ||||
|
(C++20)
|
||||
|
(C++20)
|
||||
| 平凡可等待体 | ||||
|
(C++20)
|
||||
|
(C++20)
|
std::coroutine_handle
| 成员函数 | ||||
|
(C++20)
|
||||
|
(C++20)
|
||||
| 转换 | ||||
| 观察器 | ||||
|
(C++20)
|
||||
|
(C++20)
|
||||
| 控制 | ||||
|
(C++20)(C++20)
|
||||
|
(C++20)
|
||||
| 承诺访问 | ||||
|
(C++20)
|
||||
| 导出/导入 | ||||
|
(C++20)
|
||||
|
(C++20)
|
||||
| 非成员函数 | ||||
|
operator==operator<=>
(C++20)(C++20)
|
||||
| 辅助类 | ||||
|
(C++20)
|
|
在标头
<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<> 值
x 与 y 。
<、 <=、 >、 >=
及 != 运算符分别从 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 的其他特化亦可进行相等比较及三路比较,因为它们可隐式转换成 std::coroutine_handle<> 。
示例
| 本节未完成 原因:暂无示例 |