std::coroutine_handle<Promise>::operator bool

explicit constexpr operator bool() const noexcept;
(C++20 起)

检查 *this 是否为非空,即 *this 的值从某协程的承诺对象获得。等价于 return bool(address());

Promisestd::noop_coroutine_promise ,则此转换函数始终返回 true

参数

(无)

返回值

bool(address()) ,或若 Promisestd::noop_coroutine_promise 则为 true

参阅

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