Transient ranges

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Fri Jun 3 04:49:13 PDT 2016


On 6/3/16 4:37 AM, Dicebot wrote:
> Really, many of those issue would have been solved if basic input range
> was defined as `empty` + `ElementType popFront()` instead.

FYI that was on the table, along with many other possible designs. 
(popFront() should be allowed to return by reference, too.) The problem 
with this one is that it is inefficient with arrays when the same 
element is accessed multiple times - the user is forced to create a copy 
or to use other contortions. Arrays are a prime use case for the range 
interface. -- Andrei



More information about the Digitalmars-d mailing list