www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16724] New: RandomCover.popFront is a no-op for the first call

https://issues.dlang.org/show_bug.cgi?id=16724

          Issue ID: 16724
           Summary: RandomCover.popFront is a no-op for the first call
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: dlang supradigital.org

I let the code speak for itself.


import std.random;
import std.range;
import std.algorithm;

void main ()
{
    auto range = iota(10);

    auto randy = range.randomCover;

    //randy.front // uncomment this and the assert works

    randy.popFront;

    assert(randy.array.length == range.length - 1);
}

--
Nov 22 2016