Boost logo

Boost :

From: Daryle Walker (darylew_at_[hidden])
Date: 2001-08-08 17:20:54

on 8/8/01 1:41 AM, John Max Skaller at skaller_at_[hidden] wrote:

> Daryle Walker wrote:
>> Looking at the (beginning of the) "(infinite) sequences using recurrence
>> relations" thread, I guess we need an iterating generator concept. It's a
>> generator with an iterator interface.
>> operator *() gets the current element, possibly from a cache
>> operator ++() goes to the next element
>> Optionally, operator --() could go to the previous element
> ?? But that is just the idea of an iterator in the first place.
> What am I missing?

I see an iterator as traversing over a container or a virtual container.
Generators in C++, with an operator()(), don't seem to be connected to a
container, but just create values. I sometimes want a generator to look
like an iterator. Now operator()() would "become" operator*() followed by
operator++(); the new-state returning functionality has been split up into
current-state returning and moving to the next state. Now I also have an
option of evaluating any previous states (bidirectional), at least by single
step. We could have the option of skipping several states (random access),
if it's efficient.

Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT com

Boost list run by bdawes at, gregod at, cpdaniel at, john at