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

来自cppreference.com
< cpp‎ | coroutine‎ | generator
 
 
 
协程支持
协程特征
协程句柄
无操作协程
平凡可等待体
范围生成器
(C++23)
 
范围库
范围适配器
 
 
generator( const generator& ) = delete;
(1)(C++23 起)
generator( generator&& other ) noexcept;
(2)(C++23 起)

构造 generator

1) 复制构造函数被弃置。
2) 移动构造函数使用 std::exchange(other.coroutine_, {}) 初始化底层的 coroutine_,以及用 std::exchange(other.active_, nullptr) 初始化协程句柄的底层栈 (active_)。 注意,此前来自 other 迭代器不会失效,而是成为 *this 的迭代器。

参数

other-要被移入的协程对象。

示例