operator==, operator<=>(std::coroutine_handle)
来自cppreference.com
< cpp | coroutine | coroutine handle
在标头 <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<>。
示例
本节未完成 原因:暂无示例 |