ideas about ranges

Steven Schveighoffer schveiguy at yahoo.com
Fri May 22 17:49:20 PDT 2009


On Fri, 22 May 2009 17:10:45 -0400, Andrei Alexandrescu  
<SeeWebsiteForEmail at erdani.org> wrote:

> Steven Schveighoffer wrote:
>> I'm concentrating mostly on usages with foreach, not algorithms.  If we  
>> are to have streams that fit into the range model, then they need to be  
>> foreach'able.  I don't know that they need a lot of support to feed  
>> into std.algorithm as reference data.  I.e. you aren't going to sort a  
>> network stream.
>
> Plenty of algorithms work on input ranges.
>

I'm confused, by input range you mean a stream?  Because I'm operating  
under the assumption that an input range is anything that defines front,  
popFront, and empty.  While you can shoehorn a stream into being an input  
range, they don't necessarily implement the required elements easily.  We  
may be confusing terminology.

Can you name an example of an input range that is a stream, and an  
algorithm that mutates the stream in place (thereby requiring ref  
elements)?

-Steve




More information about the Digitalmars-d mailing list