std::coroutine_handle<Promise>::coroutine_handle
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)
|
创建一个在恢复或销毁时没有可观察效果的协程句柄
(函数) |