Namespaces
Variants

std::coroutine_handle<Promise>:: operator bool

From cppreference.net
Utilities library
Coroutine support
Coroutine traits
Coroutine handle
No-op coroutines
Trivial awaitables
Range generators
(C++23)
constexpr explicit operator bool ( ) const noexcept ;
(自 C++20 起)

检查 * this 是否非空,即 * this 的值是否来自某个协程的 promise 对象。等价于 return bool ( address ( ) ) ;

如果 Promise std::noop_coroutine_promise ,此转换函数始终返回 true

参数

(无)

返回值

bool ( address ( ) ) ,或者当 Promise std::noop_coroutine_promise 时返回 true

参见

导出底层地址,即支撑协程的指针
(公开成员函数)