Step 4 of 5
A lazy range
An iterator doesn't have to point at stored data at all. It can compute values on the fly. That's how std::views::iota works, and it's how Python's range() is built: no array is ever allocated, so range(0, 1'000'000'000) costs nothing.
Your turn: write class Range for for (int i : Range(start, stop, step)) with a positive step, like Python: it yields start, start + step, ... while the value is < stop. Careful: with a step of 3, the values may jump past stop without ever equalling it, so the end condition can't be a plain == on the current value.
Previous: Iterator concepts and algorithms Next: Challenge: a ring buffer