Namespaces
Variants

std::generator<Ref,V,Allocator>::begin

来自 zh.cppreference.net
 
 
 
协程支持
协程特性
协程句柄
无操作协程
平凡可等待体
范围生成器
(C++23)
 
范围库
范围适配器
 
 
/*iterator*/ begin();
(C++23 起)

将 coroutine_ 推入 *active_ 栈,然后求值 coroutine_.resume()。

在调用 begin() 之前,coroutine_ 必须引用一个在其初始挂起点处挂起的协程。

返回值

一个迭代器,其 coroutine_ 成员所引用的协程与 coroutine_ 所引用的是同一个协程。

注释

在同一 generator 对象上多次调用 begin() 是未定义行为。

示例