Namespaces
Variants

std::coroutine_handle<Promise>:: promise

From cppreference.net
Utilities library
Coroutine support
Coroutine traits
Coroutine handle
No-op coroutines
Trivial awaitables
Range generators
(C++23)
主模板的成员
Promise & promise ( ) const ;
(自 C++20 起)
std::coroutine_handle<std::noop_coroutine_promise> 特化的成员
std:: noop_coroutine_promise & promise ( ) const noexcept ;
(自 C++20 起)

获取对 promise 对象的引用。

* this 未引用尚未销毁其 promise 对象的协程时,行为是未定义的。

此函数未为特化 std:: coroutine_handle <> 提供。

目录

参数

(无)

返回值

对 promise 对象的引用。

注释

无操作协程的承诺对象只要存在某个 std::noop_coroutine_handle 引用该协程,就不会被销毁。

参见

从协程的 promise 对象创建 coroutine_handle
(公开静态成员函数)