std::coroutine_handle<Promise>:: coroutine_handle
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Coroutine traits | ||||
|
(C++20)
|
||||
| Coroutine handle | ||||
|
(C++20)
|
||||
| No-op coroutines | ||||
|
(C++20)
|
||||
|
(C++20)
|
||||
| Trivial awaitables | ||||
|
(C++20)
|
||||
|
(C++20)
|
||||
| Range generators | ||||
|
(C++23)
|
| Member functions | ||||
|
coroutine_handle::coroutine_handle
|
||||
| Conversion | ||||
| Observers | ||||
| Control | ||||
| Promise access | ||||
| Export/import | ||||
| Non-member functions | ||||
| Helper classes | ||||
|
constexpr
coroutine_handle
(
)
noexcept
;
|
(1) | (C++20 起) |
|
constexpr
coroutine_handle
(
std::
nullptr_t
)
noexcept
;
|
(2) | (C++20 起) |
|
coroutine_handle
(
const
coroutine_handle
&
other
)
=
default
;
|
(3) | (C++20 起) |
|
coroutine_handle
(
coroutine_handle
&&
other
)
=
default
;
|
(4) | (C++20 起) |
创建一个不引用协程的
coroutine_handle
,或复制一个
coroutine_handle
。
ptr
初始化为
nullptr
。构造完成后,
address()
返回
nullptr
,且该
coroutine_handle
不引用任何协程。这些构造函数未针对特化
std::
coroutine_handle
<
std::
noop_coroutine_promise
>
声明。
参数
| 其他 | - |
待复制的另一个
coroutine_handle
|
说明
std:: coroutine_handle < std:: noop_coroutine_promise > 既不可默认构造,也无法从 std::nullptr_t 构造。 std::noop_coroutine 可用于创建新的 std:: coroutine_handle < std:: noop_coroutine_promise > 。
静态成员函数
from_promise
和
from_address
同样可以创建
coroutine_handle
。
参见
|
[static]
|
从协程的 promise 对象创建
coroutine_handle
(公开静态成员函数) |
|
[static]
|
从指针导入协程
(公开静态成员函数) |
|
(C++20)
|
创建一个在恢复或销毁时没有可观察效果的协程句柄
(函数) |