wwa-coro 0.0.1
Yet Another C++20 Coroutine Library
|
An synchronous generator that produces values of type Result
.
More...
#include <generator.h>
Classes | |
class | iterator |
An input iterator that produces values of type Result . More... | |
class | promise_type |
The promise type of the generator. More... | |
Public Member Functions | |
generator () noexcept=default | |
Default constructor. | |
generator (generator &&other) noexcept | |
Move constructor. | |
~generator () | |
Destructor. | |
iterator | begin () |
Returns an iterator to the current item of the generator. | |
iterator | begin () const |
Returns a constant iterator to the current item of the generator. | |
iterator | cbegin () const |
Returns a constant iterator to the current item of the generator. | |
iterator | cend () const noexcept |
Returns a cinstant sentinel iterator. | |
constexpr iterator | end () const noexcept |
Returns a sentinel iterator that marks the end of the generator. | |
generator & | operator= (generator &&other) noexcept |
Move assignment operator. | |
An synchronous generator that produces values of type Result
.
The generator
class represents a coroutine generator that produces values of type ``.
Example:
Result | The type of the values produced by the generator. |
Definition at line 43 of file generator.h.
|
defaultnoexcept |
Default constructor.
Constructs an empty generator. This constructor is not really useful except for testing.
|
inlinenoexcept |
Move constructor.
Constructs a generator by moving the coroutine handle from another generator.
other | The other generator to move from. |
Definition at line 352 of file generator.h.
|
inline |
Destructor.
Destroys the generator and the coroutine handle.
Definition at line 362 of file generator.h.
|
inlinenodiscard |
Returns an iterator to the current item of the generator.
This method returns an iterator to the current item of the generator. It is called begin()
only to allow the generator to be used in range-based for loops or with ranges.
Because generators cannot be restarted, this method can be used to iterate over the generator:
Definition at line 414 of file generator.h.
|
inlinenodiscard |
Returns a constant iterator to the current item of the generator.
Definition at line 430 of file generator.h.
|
inlinenodiscard |
Returns a constant iterator to the current item of the generator.
Alias for begin() const
.
Definition at line 457 of file generator.h.
|
inlinenodiscardnoexcept |
Returns a cinstant sentinel iterator.
Alias for end() const
.
Definition at line 468 of file generator.h.
|
inlinenodiscardconstexprnoexcept |
Returns a sentinel iterator that marks the end of the generator.
This method returns a sentinel iterator that marks the end of the generator. An attempt to dereference this iterator or iterate past it will result in an exception being thrown.
Definition at line 447 of file generator.h.
|
inlinenoexcept |
Move assignment operator.
Assigns the contents of another generator to this generator by moving them.
other | The other generator to move. |
Definition at line 382 of file generator.h.