Why ranges don't return vectors?

Brad Anderson eco at gnuk.net
Thu Feb 28 19:53:48 PST 2013


On Friday, 1 March 2013 at 03:44:30 UTC, H. S. Teoh wrote:
>
> You can make a buffered range that reads in a large chunk of 
> data at a
> time, and .front and .popFront merely move an internal pointer 
> until it
> reaches the end of the buffer, then the next buffer page is 
> loaded in.
> In this case, .front is very simple (just a pointer lookup) and 
> will
> probably be inlined by an optimizing compiler.
>
> Just because the abstraction is reading per-element, doesn't 
> mean the
> implementation has to literally do that!
>
>
> T

Isn't this essentially what is going on in stdio when a range 
uses fread?


More information about the Digitalmars-d mailing list