protocol for using InputRanges

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Mar 27 08:19:15 PDT 2014


On 3/27/14, 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."

Probably we need to amend that. For efficient ranges, front() and 
popFront() should only be guaranteed to work if either empty() or 
length() were evaluated first, and they returned false or nonzero, 
respectively.

Andrei




More information about the Digitalmars-d mailing list