On Saturday, 5 December 2015 at 01:03:05 UTC, Andrei Alexandrescu wrote:
What exactly doesn't work?

Forward ranges.

I see; retro requires a bidirectional range.

I was thinking about

void main()
{
        import std.algorithm : count;
        import std.range : drop;
        import std.stdio : writeln;
        auto a = [1,2,3,4,5];
        writeln(a.drop(a.count-3));
}

But it has the downside that it calls front/empty/pop 2*n times.

What about using a rangified circular buffer of the same size you want the tail to be, and lazily fill it?

Reply via email to