Create a Generator as Iterators
Explore how to implement a C++ generator that produces the Fibonacci sequence as a forward iterator, compatible with STL algorithms. This lesson teaches creating an efficient iterator class that generates values on-the-fly without relying on containers, enabling seamless integration with range-based loops and algorithms.
We'll cover the following...
A generator is an iterator that generates its own sequence of values. It does not use a container. It creates values on the fly, returning one at a time as needed. A C++ generator stands on its own; it does not need to wrap around another object.
In this recipe, we'll build a generator for a