Feasible Idea?: Range Tester

Nick Sabalausky SeeWebsiteToContactMe at semitwist.com
Thu Mar 21 13:42:37 PDT 2013


On Thu, 21 Mar 2013 20:24:40 +0100
Philippe Sigaud <philippe.sigaud at gmail.com> wrote:

> >> - Upon instantiating a new random access range, 'r.front == r[0]',
> >> and then after 'r.popFront()', 'r.front == r[1]', etc.
> >
> > This should be relatively easy to check.
> 
> Is that really the behaviour for RA ranges? I'd say that after calling
> r.popFront(), then r.front == r[0].
> The test could be:
> 
> assert(r has at least two elements);
> auto nextOne = r[1];
> r.popFront();
> assert(r.front == nextOne);

You might be right.

See why such a tester would be helpful? ;)



More information about the Digitalmars-d mailing list