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

> C++ Atlas: `cppatlas.com/w/cpp/coroutine/generator/operator=` | Source: https://en.cppreference.com/w/cpp/coroutine/generator/operator= | Domain: Coroutine support | Standards: C++23

Replaces the contents of the generator object. Equivalent to:

## Official Specification Summary (cppreference)

```cpp
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_);`

### Parameters

- `other` - another generator to be moved from

### Return value

`*this`

### Complexity

> Note: This section is incomplete

### 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.

### Example

> Note: This section is incomplete Reason: no example

---
Attribution: content from https://en.cppreference.com/w/cpp/coroutine/generator/operator= (cppreference.com), licensed under CC-BY-SA 3.0 and GFDL. Modified: converted to markdown, study notes added. Offline snapshot of 9 February 2025.