foreach vs. iterators

Sean Kelly sean at f4.ca
Sat Nov 4 16:18:22 PST 2006


Sean Kelly wrote:
> Still, I think it's useful to have in an 
> iterator, so perhaps something roughly like this:
> 
> interface Iterator(T)
> {
>     T val();
>     T next();
>     bool hasNext();
> }

Err... this doesn't work for an iterator returned for an empty 
container.  Perhaps:

interface Iterator(T)
{
     T val();
     T next();
     bool atEnd();
}

Anyway, you get the idea.


Sean



More information about the Digitalmars-d-announce mailing list