命名空间
变体
操作

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

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

替换生成器对象的内容。等同于

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

目录

[编辑] 参数

其他 - 要从中移动的另一个生成器

[编辑] 返回值

*this

[编辑] 复杂度

[编辑] 注解

以前从 other 获取的迭代器不会失效——它们会变成指向 *this 的迭代器。

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

[编辑] 示例