# std::generator<Ref,V,Allocator>::begin

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

Pushes coroutine_ into *active_ stack, then evaluates coroutine_.resume().

## Official Specification Summary (cppreference)

```cpp
/*iterator*/ begin(); // (since C++23)
```

Pushes `coroutine_` into `*active_` stack, then evaluates `coroutine_.resume()`.

Before invocation of `begin()` the `coroutine_` must refer to a coroutine suspended at its initial suspend point.

### Return value

An iterator whose `coroutine_` member refers to the same coroutine as `coroutine_` does.

### Notes

It is an undefined behavior to call `begin()` more than once on the same `generator` object.

### Example

> Note: This section is incomplete Reason: no example

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