Iterators for D
Sean Kelly
sean at f4.ca
Mon Nov 6 15:50:53 PST 2006
Walter Bright wrote:
> Sean Kelly wrote:
>> Is it worth discussing whether the pointer-style C++ iterators are the
>> best approach? They certainly are if random access iterators are a
>> requirement, but if we're just implementing forward and reverse
>> iterators, the all-in-one Java approach may be better. In that vein,
>> I assume alose that reverse iteration would work with reverse
>> iterators and an .rbegin type method instead of .begin and
>> foreach_reverse?
>
> Hmm, or it could be done starting with .end and going to .begin.
Yup. About the only potentially weird thing there is that, assuming C++
style iterators, it would require reverse iterators and forward
iterators to be comparable to one another. And, I suppose, for .end to
return a reverse style iterator even for sequences that don't support
reverse iteration?
Sean
More information about the Digitalmars-d
mailing list