|
CeresEngine 0.2.0
A game development framework
|
An iterator type that allows the caller to iterate over the results of a generator. More...
#include <CeresEngine/Foundation/Generator.hpp>
Public Types | |
| using | iterator_category = std::input_iterator_tag |
| using | difference_type = std::ptrdiff_t |
| using | value_type = typename Promise::Value |
| using | reference = typename Promise::Reference |
| using | pointer = typename Promise::Pointer |
Public Member Functions | |
| Iterator () noexcept | |
Iterator needs to be default-constructible to satisfy the Range concept. | |
| Iterator (CoroutineHandle coroutine) noexcept | |
Creates a new Iterator object with an attached coroutine handle. | |
| bool | operator== (const Iterator &other) const noexcept |
| Check if two iterator are equal. | |
| bool | operator!= (const Iterator &other) const noexcept |
| Check if two iterator are not equal. | |
| Iterator & | operator++ () |
| Resumes the generator coroutine and runs until the next value is yielded by it. | |
| void | operator++ (int) |
| Resumes the generator coroutine and runs until the next value is yielded by it. | |
| reference | operator* () const noexcept |
| Dereferences the iterator and returns a reference to the last yielded value. | |
| pointer | operator-> () const noexcept |
| Dereferences the iterator and returns a pointer to the last yielded value. | |
Private Attributes | |
| CoroutineHandle | mCoroutine = nullptr |
| The coroutine handle instance. | |
An iterator type that allows the caller to iterate over the results of a generator.
| using CeresEngine::Generator< T >::Iterator::difference_type = std::ptrdiff_t |
| using CeresEngine::Generator< T >::Iterator::iterator_category = std::input_iterator_tag |
| using CeresEngine::Generator< T >::Iterator::pointer = typename Promise::Pointer |
| using CeresEngine::Generator< T >::Iterator::reference = typename Promise::Reference |
| using CeresEngine::Generator< T >::Iterator::value_type = typename Promise::Value |
|
inlinenoexcept |
Iterator needs to be default-constructible to satisfy the Range concept.
|
inlineexplicitnoexcept |
Creates a new Iterator object with an attached coroutine handle.
| coroutine | The coroutine handle |
|
inlinenoexcept |
Check if two iterator are not equal.
See operator== for more details.
| other | The iterator to check against |
true if the generator has reached the end.
|
inlinenoexcept |
Dereferences the iterator and returns a reference to the last yielded value.
|
inline |
Resumes the generator coroutine and runs until the next value is yielded by it.
*this. Resumes the generator coroutine and runs until the next value is yielded by it.
This only provided so that the iterator can implement the Range concept.
|
inlinenoexcept |
Dereferences the iterator and returns a pointer to the last yielded value.
|
inlinenoexcept |
Check if two iterator are equal.
Since a generator sequence is potentially infinite, this only checks if there is any value remaining in the sequence.
| other | The iterator to check against |
true if there is at least one more value in the generator sequence.
|
private |
The coroutine handle instance.
This is used to resume the generator on operator++.