Iterators Must Go

Sean Kelly sean at invisibleduck.org
Sat May 9 09:06:48 PDT 2009


Walter Bright wrote:
> 
> If you had an iterator that knew its beginning and end, then the whole 
> paradigm of:
> 
>    for (iterator i = begin; i != end; i++)
> 
> doesn't make much sense because of the redundancy.

Yup.  And most of the "interesting" iterators fall into this 
category--the one returned from begin or rbegin is the real iterator and 
the one returned from end or rend is just used to tell the real cursor 
to check whether it's at the end or not.  This is why I commented on 
Andrei's statement that it's impossible to make an iterator for a 
delimited range.  It's possible, the design is just unnatural.



More information about the Digitalmars-d mailing list