Iterator straw-man

Craig Black cblack at ara.com
Tue Nov 7 10:34:23 PST 2006


I do agree that using classes and interfaces to represent iterators is a bad 
idea for performance reasons.  I also agree that I don't think it's 
necessary to support raw pointers.

IMO iterators should be structs such that iteration can be performed as 
follows:

for(auto i = container.begin(); i.isValid(); i.next())  write(i.value);

If I am not mistaken, this can already be done in D.  With foreach support 
this would simplify to.

foreach(i; container)  write(i);

-Craig





More information about the Digitalmars-d mailing list