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

< cpp‎ | coroutine‎ | generator
generator& operator=( generator other ) noexcept;
(C++23 起)

替换生成器对象的内容。

等价于:

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

参数

other - 要被移动的生成器对象

返回值

*this

复杂度

注解

来自 other 的迭代器不会失效 – 他们现在是 *this 中的迭代器。

这个赋值运算符技术上是一个复制赋值运算符,虽然 std::generator 仅可移动赋值。

示例