std::coroutine_handle<Promise>::operator bool

從 cppreference.com
 
 
 
協程支持
協程特徵
協程句柄
無操作協程
平凡可等待體
範圍生成器
(C++23)
 
 
constexpr explicit operator bool() const noexcept;
(C++20 起)

檢查 *this 是否為非空,即 *this 的值從某協程的承諾對象獲得。等價於 return bool(address());

Promisestd::noop_coroutine_promise,則此轉換函數始終返回 true

[編輯] 參數

(無)

[編輯] 返回值

bool(address()),或若 Promisestd::noop_coroutine_promise 則為 true

[編輯] 參閱

導出底層地址,即指代協程的指針
(公開成員函數) [編輯]