std::generator<Ref,V,Allocator>::operator= - cppreference.com (original) (raw)

| generator& operator=( generator other ) noexcept; | | (since C++23) | | -------------------------------------------------- | | ------------- |

Replaces the contents of the generator object. Equivalent to:

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

[edit] Parameters

other - another generator to be moved from

[edit] Return value

*this

[edit] Complexity

[edit] Notes

Iterators previously obtained from other are not invalidated – they become iterators into *this.

This assignment operator is technically a copy assignment operator, although std::generator is only move assignable.

[edit] Example