protocol for using InputRanges

Walter Bright newshound2 at digitalmars.com
Thu Mar 27 13:54:52 PDT 2014


On 3/27/2014 3:49 AM, "Marc Schütz" <schuetzm at gmx.net>" wrote:
> I was originally going to do that, but then I took a closer look at the
> documentation, which says ([1] in the documentation of `isInputRange()`):
>
> "Calling r.front is allowed only if calling r.empty has, or would have, returned
> false."
>
> (And the same for `popFront()`.)
>
> That is, the documentation more or less explicitly states that you don't
> actually need to call `empty` if you know it returned `true`.
>
> [1] http://dlang.org/phobos/std_range.html

Right, it does say that, and it is seriously wrong.


More information about the Digitalmars-d mailing list