Namespaces
Variants

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

来自 zh.cppreference.net
 
 
 
协程支持
协程特征
协程句柄
无操作协程
平凡可等待对象
范围生成器
(C++23)
 
范围库
范围适配器
 
 
generator& operator=( generator other ) noexcept;
(自 C++23 起)

替换 generator 对象的内容。等价于:

std::swap(coroutine_, other.coroutine_);
std::swap(active_, other.active_);

参数

其他 - 待移动的另一个生成器

返回值

* this

复杂度

注释

先前从 other 获取的迭代器不会失效——它们将转换为指向 * this 的迭代器。

该赋值运算符在技术上属于 复制赋值运算符 ,尽管 std::generator 仅支持移动赋值。

示例