类模板coroutine_handle能用于指代暂停或执行的协程。coroutine_handle的每个特化均为字面类型(LiteralType)。 1)主模板,可从Promise类型的承诺对象创建。 2)特化std::coroutine_handle<void>是其他特化的公开基类。它保有协程柄的底层地址。 3)特化std::coroutine_handle<std::noop_coroutine_promise>指代无操作协程。
void await_transform() = delete; static void unhandled_exception() { throw; } std::optional<T> current_value; }; using Handle = std::coroutine_handle<promise_type>; explicit Generator(Handle coroutine) : m_coroutine{coroutine} {} Generator() = default; ~Generator() { if (m_coroutine) ...
{throw;}std::optional<T>current_value;};usingHandle=std::coroutine_handle<promise_type>;explicitGenerator(constHandle coroutine):m_coroutine{coroutine}{}Generator()=default;~Generator(){if(m_coroutine)m_coroutine.destroy();}Generator(constGenerator&)=delete;Generator&operator=(constGenerator&)=...
This conversion function converts a std::coroutine_handle<Promise> value to a std::coroutine_handle<> holding the same underlying address. It effectively erases the promise type. Parameters (none) Return value std::coroutine_handle<>::from_address(address()). See also operator==operator<=...
但是实际接入SDK的过程中我们有相当一部分类型相同但是接入流程不同的情况,再加上现在各大编译器也都...
- (!RetType->isBooleanType() && !RetType->isVoidType())) { - S.Diag(AwaitSuspend->getCalleeDecl()->getLocation(), - diag::err_await_suspend_invalid_return_type) - << RetType; - S.Diag(Loc, diag::note_coroutine_promise_call_implicitly_required) ...
struct hash<std::coroutine_handle<Promise>>; (since C++20) The template specialization of std::hash for std::coroutine_handle allows users to obtain hashes of objects of type std::coroutine_handle<P>. operator() of the specialization is noexcept. Example This section is incompleteReason:...