template<typename T>
py::Generator class

Minimal generator using C++20 coroutines.

Template parameters
T Value type to yield

Models a Python-style generator that lazily yields values of type T. Used with co_yield inside a coroutine function.

Supports both value types (Generator<int>) and reference types (Generator<Container&>), using pointer storage to avoid copies.