import std.range;

void main()
{
    auto arr = [1, 2, 3, 4, 5, 6, 7, 8];
    auto foo = cycle(arr);
    
    // nope
    foreach (int index, int val; foo)
    {
    }    
    
    // nope
    foreach (int index, int val; take(foo, 5))
    {
    }
    
    // ok
    foreach (int index, int val; take(arr, 5))
    {
    }    
}

Is this because cycle is an infinite range, and index might overflow? I could 
understand that. But I think if I use take() then there should be no problem 
with overflows. It still doesn't work though.

Reply via email to