Template Struct Generator¶
Defined in File generator.h
Nested Relationships¶
Nested Types¶
Struct Documentation¶
-
template<typename T>
struct Generator¶ Coroutine-based generator for lazy iteration.
Generator provides a C++20 coroutine-based iterator that yields values on demand. Used for streaming operations where producing all values upfront would be inefficient.
- Template Parameters:
T – Type of values yielded by the generator.
Public Types
-
using handle_type = std::coroutine_handle<promise_type>¶
Public Functions
-
inline explicit Generator(handle_type h)¶
Construct generator from coroutine handle.
-
inline ~Generator()¶
Destructor destroys the coroutine handle.
-
inline explicit operator bool()¶
Check if more values are available.
- Returns:
true if generator has more values, false otherwise.
Public Members
-
handle_type h_¶
-
struct promise_type¶
Coroutine promise implementation.
Public Functions
-
inline std::suspend_always initial_suspend()¶
Suspend at coroutine start.
-
inline std::suspend_always final_suspend() noexcept¶
Suspend at coroutine end.
-
inline void unhandled_exception()¶
Handle unhandled exceptions.
-
template<std::convertible_to<T> From>
inline std::suspend_always yield_value(From &&from)¶ Yield a value from the coroutine.
-
inline void return_void()¶
Complete coroutine without returning a value.
-
inline std::suspend_always initial_suspend()¶