Are iterators and ranges going to co-exist?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Jul 19 15:43:25 PDT 2010


On 07/19/2010 04:26 PM, Peter Alexander wrote:
> On 19/07/10 10:06 PM, Steven Schveighoffer wrote:
>> You may want to check out cursors from dcollections. I apologize, the
>> online docs are still for the D1 version, but you can learn about D2
>> cursors here:
>>
>> http://www.dsource.org/projects/dcollections/browser/branches/d2/concepts.txt#L21
>>
>>
>>
>> Note that cursors are still ranges, but enjoy many of the benefits that
>> iterators are used for in STL, such as referring to single elements and
>> using as endpoints for slices.
>>
>> I'm unsure whether Andrei will admit them into phobos. All
>> correspondence I have with him both private and public indicates they
>> will not be admitted. But they are still ranges, so they effectively can
>> be used in some alogrithms (though the usefulness in that capacity
>> remains to be seen). They should make 3-legged algorithms much easier to
>> write, and code that gets ranges from a container much more natural.
>>
>> -Steve
>
> Thanks Steve. That looks good to me :)
>
> Andrei, can we convince you to add these into Phobos?

This has been discussed in the past, you may want to refer to the 
discussions containing "container" in the title in this group. I was 
essentially tasked by Walter with deciding, and I decided to go with a 
different design than the one promoted by dcollections. This is because 
I believe hierarchies are too constraining to express the multitude of 
containers in existence. I opted for a design that prescribes certain 
named functions for methods of specific complexity, and otherwise leaves 
containers not regimented.

Andrei


More information about the Digitalmars-d mailing list