命名空间
变体
操作

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

来自 cppreference.cn
< cpp‎ | 协程‎ | generator
 
 
 
协程支持
协程特质
协程句柄
无操作协程
平凡可等待对象
范围生成器 (Range generators)
(C++23)
 
范围库 (Ranges library)
范围适配器 (Range adaptors)
 
 
/*iterator*/ begin();
(C++23 起)

coroutine_ 推入 *active_ 栈中,然后计算 coroutine_.resume()

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

[编辑] 返回值

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

[编辑] 注意

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

[编辑] 示例