Prototype for coroutine-like iterators that generate elements such as combinations.
More...
#include <Generators.hpp>
template<class spec_t, class gen_t>
class mackey::FactoryGenerator< spec_t, gen_t >
Prototype for coroutine-like iterators that generate elements such as combinations.
Inherit from this class and define a method update() to get a const iterator.
You will also need begin()
and end()
methods returning such iterators; end()
should always be defined by calling the factory end()
.
Example implementations: CombinationGenerator
and PermutationGenerator
- Attention
- Probably not thread-safe (depends on specialization's
update()
method).
- Todo:
- Implement as coroutine (C++20)
- Template Parameters
-
spec_t | Used for compile-time polymorphism (CRTP): set it to be the child class. |
gen_t | The type of the generated element. |
◆ operator*()
const gen_t& operator* |
( |
| ) |
const |
Returns the generated element.
◆ operator!=()
Inequality of iterators (used to detect if generation has been completed)
◆ operator++()
◆ end()
◆ completed
1 if the iterator is end() i.e. if all elements have been generated
◆ generated
The currently generated element.
The documentation for this class was generated from the following file: