|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Lazy sequence type (Aleph::Generator<T>) built on C++20 coroutines.
More...
#include <coroutine>#include <exception>#include <iterator>#include <memory>#include <type_traits>#include <utility>#include <ah-errors.H>Go to the source code of this file.
Classes | |
| class | Aleph::Generator< T > |
Lazy, single-pass sequence of T values produced by a coroutine. More... | |
| struct | Aleph::Generator< T >::promise_type |
The promise type the compiler instantiates for a coroutine returning Generator<T>. More... | |
| class | Aleph::Generator< T >::iterator |
| Single-pass input iterator over the yielded sequence. More... | |
Namespaces | |
| namespace | Aleph |
| Main namespace for Aleph-w library functions. | |
Lazy sequence type (Aleph::Generator<T>) built on C++20 coroutines.
Aleph::Generator<T> is a single-pass, lazily-evaluated sequence produced by a coroutine that co_yields values of type T. It is the reusable building block behind the lazy counterparts of Aleph's eager enumerators: combinatorics (ah-comb.H), tree traversals (tpl_binNodeUtils.H) and graph traversals (graph-traverse.H).
std::generator<T>. Coroutines are a C++20 language feature — Aleph::Generator needs no C++23 library support and behaves identically on every standard the library targets (17 is unsupported for coroutine use, 20 and 23 behave the same). This mirrors the Aleph::FlatSet/Aleph::FlatMap decision (see tpl_flat_set.H): a smaller, uniform surface beats aliasing a standard facility whose semantics (allocator support, elements_of, reference-type customization) would otherwise leak through and vary by -std. The ALEPH_HAS_STD_GENERATOR macro in ah-cpp-compat.H remains available for consumers who specifically want std::generator itself.Aleph::Generator for ergonomics and memory savings when the full sequence would be expensive to materialize or is only partially consumed (early break). It is not a drop-in replacement for hand-written iterators on hot paths: each resume is a coroutine-frame resumption, which most compilers cannot fully inline away.Definition in file ah-generator.H.