On 6/17/13 6:29 PM, Joseph Rushton Wakeling wrote:
On 06/17/2013 11:18 PM, Joseph Rushton Wakeling wrote:
A random range should be viewed (IMO) as nothing more than a range that "was"
(conceptually) simply filled with random numbers. Calling front on the same
range twice in a row *should* produce the same result: No call to popFront =>  
no
change to the range. If it did change, it'd be a blatant violation of the range
concept. It also means you can't have safe/nothrow/pure/const "front".

Completely agree, and I don't think this is in contradiction with what I've
proposed.  My proposed "rule" might be better stated to clarify this.

Perhaps this would be a better statement:

     ************************************************************************
     * Iterating fully over a given random range should produce a different *
     * sequence for each such complete iteration.                           *
     ************************************************************************

So, if you do,

     SomeRandomRange r;
     x = r.front;
     y = r.front;
     assert(x == y);  // Passes!!

But

     SomeRandomRange r;
     arr1 = array(r);
     arr2 = array(r);
     assert(x != y);  // the two arrays are filled with different sequences.

Once you consume an input range, there's no way to consume it again. It's done.

Andrei

Reply via email to