Are iterators and ranges going to co-exist?

Peter Alexander peter.alexander.au at gmail.com
Mon Jul 19 14:26:43 PDT 2010


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?

P.S. I prefer the name cursor as opposed to iterator (for this usage).



More information about the Digitalmars-d mailing list