std.stream replacement

BLM768 blm768 at gmail.com
Wed Mar 6 17:20:02 PST 2013


>
> That certain specific types of range can't implement a given 
> operation efficiently isn't a reason to reject the idea.
>
> If somebody tries using takeArray on a range that by its very 
> nature can only pick off elements one by one, they should 
> expect it to be as slow as a for loop.  OTOH, when used on a 
> file, array or similar structure, it will perform much better 
> than this.
>
> But thinking about it now, maybe what we need is the concept of 
> a "block input" range, which is an input range with the 
> addition of the takeArray method.  Of course, standard D arrays 
> would be block input ranges.  Then (for example) a library that 
> reads a binary file format can be built to accept a block input 
> range of bytes.
>
> Stewart.

That's basically what my thinking was, but you've expressed it in 
a better way than I think I could have. I'd definitely like to 
see this idea implemented; it could be useful for just about 
anything involving a buffer.


More information about the Digitalmars-d mailing list