On 04/12/2012 01:27 PM, Joseph Rushton Wakeling wrote:

> What I _still_ don't understand is the statement in the constructor:
>
> // we should skip some elements initially so we don't always
> // start with the first
>
> ... as it seems to me that doing so would bugger up the selection
> algorithm. The whole point of Algorithm S is that it considers one by
> one each of the possible values in sequence.

It is to keep front() trivial. Unless popFront() is called, front() should always return the same element. That's why the constructor goes to the first selection up front so that the first call to front() need not calculate anything.

As a result it reduces the laziness of the whole thing though. Even if popFront() is never called, the original range is consumed.

Ali

Reply via email to