protocol for using InputRanges

Walter Bright newshound2 at digitalmars.com
Thu Mar 27 21:58:35 PDT 2014


On 3/27/2014 3:21 AM, Chris wrote:
> I agree. I've been using ranges for a while now and have tried
> different implementations based on advice given on this forum and
> depending on each case. After reading this thread I looked at
> some of my ranges and I have to say I still have no clue as to
> what should and should _not_ be done (regardless of whether you
> _can_ do it). For a while I thought that it's my lack of
> understanding, but this thread shows that everyone has a
> different view of ranges. Guidelines with use cases would be
> great. I remember I mentioned this in another thread already. The
> thing is that experimenting without proper guidelines leaves your
> code in an inconsistent state where you have two or more ranges
> doing technically the same thing but each with a different logic.

Following the protocol empty-front-popFront always works.

Where the differences come in is when people skip calling empty.


More information about the Digitalmars-d mailing list