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

来自cppreference.com


 
 
 
协程支持
协程特征
协程句柄
无操作协程
平凡可等待体
范围生成器
(C++23)
 
 
在标头 <coroutine> 定义
constexprbool
    operator==(std::coroutine_handle<> x, std::coroutine_handle<> y )noexcept;
(1) (C++20 起)
constexprstd::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 的其他特化亦可进行相等比较及三路比较,因为它们可隐式转换成 std::coroutine_handle<>

[编辑]示例

close