protocol for using InputRanges

QAston qaston at gmail.com
Thu Mar 27 15:23:00 PDT 2014


>> Even a single byte buffer is not enough, you need a bool to 
>> indicate the stream
>> is done.
>
> Right. But empty for a stream still has to read. Just follow 
> the protocol, and the range will work, even with streams.

The protocol is not intuitive. I'm not entirely against having to 
call something to do lazy initialization but it's not like anyone 
will expect empty @property to lazily initialize.

Empty and front could be methods added by a mixin template which 
would use efficient methods with strict protocol implemented by 
the user.


More information about the Digitalmars-d mailing list