|
LdsGen 1.2.6
|
CRTP mixin adding STL iterator support to a GeneratorBase. More...
#include <lds.hpp>
Public Member Functions | |
| auto | begin () -> GeneratorIterator< Derived, Value > |
| Get iterator to beginning. | |
| auto | end () const -> GeneratorIterator< Derived, Value > |
| Get iterator to end (infinite sequence) | |
Public Member Functions inherited from ldsgen::GeneratorBase< Derived, Value > | |
| auto | pop () -> Value |
| Generate the next value in the sequence (advances state). | |
| auto | peek () -> Value |
| Peek at the next value without advancing state. | |
| auto | skip (unsigned int n) -> void |
| Skip n values in the sequence. | |
| auto | reseed (const unsigned long &seed) -> void |
| Reset the generator to a specific seed value. | |
| auto | get_index () const -> unsigned long |
| Get current index in the sequence. | |
Additional Inherited Members | |
Protected Attributes inherited from ldsgen::GeneratorBase< Derived, Value > | |
| std::atomic< unsigned long > | count_ {0} |
| Current sequence index (single source of state) | |
CRTP mixin adding STL iterator support to a GeneratorBase.
Provides begin()/end() so generators can be consumed with range-for, std::begin/ std::end and STL algorithms. Combined with GeneratorIterator, this realizes the Iterator pattern for every generator without repeating the iterator boilerplate.
| Derived | The CRTP-derived generator class. |
| Value | The value type produced by the generator. |
|
inline |
Get iterator to beginning.
|
inline |
Get iterator to end (infinite sequence)
For infinite sequences, you typically use begin() + n to get a specific position