Sergey Gromov Wrote:
[snip]
> OTOH, I'd expect something like the following to also work:
> 
> auto f = new File("blah.txt");
> auto top = take(10, f.lines);
> 

Same here. I feel that take (and some other adaptors) should accept range by 
reference. One of the advantages of ranges over opApply is that you can start 
foreach, break somewhere (throw an exception, recover) and then continue. It 
also means that the range is mutated inside foreach. If foreach mutates the 
range, so can other algorithms that operate on ranges do.

> I.e. I'd expect some ranges to be Translators, and others to be
> Mutators.  Translators are read-only views into underlying anything
> which may involve some expensive bookkeeping.  Mutators are basically
> references into a particular container and make sure that the container
> and other Mutators stay consistent.

Reply via email to