C++ / Why Iterators Got It All Wrong

Ilya via Digitalmars-d digitalmars-d at puremagic.com
Sun Sep 3 21:29:36 PDT 2017


On Sunday, 3 September 2017 at 16:33:04 UTC, Moritz Maxeiner 
wrote:
> On Sunday, 3 September 2017 at 14:19:19 UTC, Ilya Yaroshenko 
> wrote:
>> Ranges requires for 25% more space for canonical matrixes then 
>> iterators.
>
> We do have to differentiate between a container and the API 
> with which to iterate over its elements.
> D's dynamic arrays (a pointer+length) require more space then 
> using only a raw pointer, of course. If that's more than an 
> iterator depends on the type of iterator you use. Most common 
> iterator implementations I know consist of a begin and an end 
> pointer, essentially requiring the same space as D's dynamic 
> arrays.
> In the case you describe, though, we aren't talking about the 
> iteration API, we are talking about what's used internally for 
> storage.

Maybe I should call it cursors or generic pointers instead of 
iterators.


More information about the Digitalmars-d mailing list