Iterator straw-man
Benji Smith
dlanguage at benjismith.net
Wed Nov 8 09:13:43 PST 2006
Bill Baxter wrote:
> I'm guessing the specially-ordained iterator method names will probably
> end up being opIter and opIterReverse (or maybe same with 'Iterator'
> spelled out) just following the pattern established so far.
Why the continued assumption that there are only two valid kinds of
iterator? A hashtable might have forward and reverse iterators for both
its keys and its values, thereby requiring four distinct iterators. A
tree might have depth-first, breadth-first, in-order, and reverse-order
iterators. Any collection class might have a random-order iterator. I
think it's awfully presumptuous to bake the notion of forward and
reverse iteration directly into the language.
--benji
More information about the Digitalmars-d
mailing list