Iterators for D

Walter Bright newshound at digitalmars.com
Mon Nov 6 18:28:10 PST 2006


Bill Baxter wrote:
> I think the iterator-as-range idea is at least worth discussing.  99% of 
> the time you use an iterator you also need to know where to stop.  It's 
> pretty similar to how arrays in D keep a length, because 99% of the time 
> when you have an array you need to know how long it is too.  So it makes 
> sense to keep those two bits of information together.  Similarly in C++, 
> when you have an iterator, you almost always need the end() too.  And 
> any time you want to pass around iterators you end up having to pass the 
> two bits of information around separately.

That's a very good point. Got any ideas on that?



More information about the Digitalmars-d mailing list