protocol for using InputRanges

Rainer Schuetze r.sagitario at gmx.de
Wed Mar 26 23:58:44 PDT 2014



On 27.03.2014 07:53, Rainer Schuetze wrote:
> bool empty() {
>      if(_cached) return false;
>      _cache = getc!T();
>      return (_cache < 0);
>    }

Ouch, pasted before fixing:

   bool empty() {
     if(_cached) return false;
     _cache = getc!T();
     _cached = _cache >= 0; // this line added
     return !_cached;
   }

The asm is with an unintended "_cached = _cache < 0;", but that's the 
same, just accepting negative input instead of non-negative.



More information about the Digitalmars-d mailing list