|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Single-pass input iterator over the yielded sequence. More...
#include <ah-generator.H>
Public Types | |
| using | iterator_category = std::input_iterator_tag |
| Category. | |
| using | value_type = std::remove_reference_t< T > |
| Element type. | |
| using | difference_type = std::ptrdiff_t |
| Distance type. | |
| using | reference = T & |
| Reference type. | |
| using | pointer = std::add_pointer_t< T > |
| Pointer type. | |
Public Member Functions | |
| iterator () noexcept=default | |
| Construct a singular (past-the-end-compatible) iterator. | |
| iterator (Handle h) noexcept | |
| Construct from a coroutine handle (internal use). | |
| iterator & | operator++ () |
Resume the coroutine to its next co_yield (pre-increment). | |
| void | operator++ (int) |
Resume the coroutine to its next co_yield (post-increment). | |
| reference | operator* () const noexcept |
| Dereference to the most recently yielded value. | |
| pointer | operator-> () const noexcept |
| Member access on the most recently yielded value. | |
| bool | done () const noexcept |
| True when the coroutine has run to completion (or was never begun). | |
Private Attributes | |
| Handle | handle_ {} |
Friends | |
| bool | operator== (const iterator &it, std::default_sentinel_t) noexcept |
| Compare against the end sentinel: equal once the sequence is done. | |
Single-pass input iterator over the yielded sequence.
Obtained from Generator::begin(); compares against std::default_sentinel (returned by Generator::end()) to detect exhaustion. Advancing the iterator resumes the coroutine to its next co_yield (or to completion).
Definition at line 217 of file ah-generator.H.
| using Aleph::Generator< T >::iterator::difference_type = std::ptrdiff_t |
Distance type.
Definition at line 224 of file ah-generator.H.
| using Aleph::Generator< T >::iterator::iterator_category = std::input_iterator_tag |
Category.
Definition at line 222 of file ah-generator.H.
Pointer type.
Definition at line 226 of file ah-generator.H.
Reference type.
Definition at line 225 of file ah-generator.H.
Element type.
Definition at line 223 of file ah-generator.H.
|
defaultnoexcept |
Construct a singular (past-the-end-compatible) iterator.
|
inlineexplicitnoexcept |
Construct from a coroutine handle (internal use).
Definition at line 232 of file ah-generator.H.
|
inlinenoexcept |
True when the coroutine has run to completion (or was never begun).
Definition at line 277 of file ah-generator.H.
References Aleph::blossom_maximum_cardinality_matching(), and Aleph::Generator< T >::iterator::handle_.
Referenced by Aleph::Generator< T >::iterator::operator++().
|
inlinenoexcept |
Dereference to the most recently yielded value.
Definition at line 265 of file ah-generator.H.
References Aleph::Generator< T >::iterator::handle_.
|
inline |
Resume the coroutine to its next co_yield (pre-increment).
*this, now referring to the next value (or exhausted). | std::domain_error | if the iterator is already at end(). Resuming a coroutine past its final suspend point is undefined behavior, so this is checked explicitly rather than left to manifest as UB. |
| Whatever | the coroutine body threw before its next co_yield, if anything. |
Definition at line 243 of file ah-generator.H.
References ah_domain_error_if, Aleph::Generator< T >::iterator::done(), and Aleph::Generator< T >::iterator::handle_.
Resume the coroutine to its next co_yield (post-increment).
Returns void rather than the pre-increment value: single-pass input iterators cannot meaningfully support *it++ (there is no previous value left to dereference once the coroutine has resumed), matching the standard library's own single-pass generator iterators.
| Same | as operator++(). |
Definition at line 262 of file ah-generator.H.
|
inlinenoexcept |
Member access on the most recently yielded value.
Definition at line 271 of file ah-generator.H.
References Aleph::Generator< T >::iterator::handle_.
Compare against the end sentinel: equal once the sequence is done.
Definition at line 283 of file ah-generator.H.
|
private |
Definition at line 219 of file ah-generator.H.
Referenced by Aleph::Generator< T >::iterator::done(), Aleph::Generator< T >::iterator::operator*(), Aleph::Generator< T >::iterator::operator++(), and Aleph::Generator< T >::iterator::operator->().