Iterators for D

Sean Kelly sean at f4.ca
Tue Nov 7 09:50:37 PST 2006


Walter Bright wrote:
> Sean Kelly wrote:
>> Since D has slicing, the argument for using iterators to define the 
>> boundaries of a range of randomly accessible elements seems kind of 
>> small to me.  ie.
>>
>>     sort( a.begin, a.begin + 5 ); // sort the first 5 elements
>> or
>>     sort( a[0 .. 5] );
>>
>> I find the second to be cleaner to look at.  But I'm undecided whether 
>> we'd lose any power or flexibility by not bothering with random access 
>> iterators.
> 
> Hmm, instead of 'pointers as iterators', have 'arrays as iterators'. 
> That definitely sounds like a good area to explore.

I went ahead and wrote everything up during my commute this morning. 
It's posted separately as "Iterator straw-man."  And I apologize for it 
being a bit longer than expected :-)

Sean



More information about the Digitalmars-d mailing list