Why ranges don't return vectors?

Chris Cain clcain at uncg.edu
Thu Feb 28 18:35:23 PST 2013


On Friday, 1 March 2013 at 01:02:17 UTC, Piotr Szturmaj wrote:
> Seriously, nobody will ever get performance from single-element 
> iterator/range pattern - this makes CPU stall!

There's no reason you can't do that. In fact, some ranges already 
do this. Take a look at std.stdio.File.byChunk and byLine. This 
isn't appropriate for all ranges, though. Like arrays, for 
instance. You want to be able to access single elements and do 
things with them, otherwise the abstraction is pointless.


More information about the Digitalmars-d mailing list