http://dlang.org/phobos/std_range.html#roundRobin
As would be expected, RoundRobin goes into an infinite loop if the range is infinite; perhaps !isInfinite!R would be suitable to test against the input ranges?
This may benefit other exhausting range functions also.
Comment #1 by peter.alexander.au — 2013-01-01T14:12:27Z
It's not a good idea to constrain the function unnecessarily. For example, you might want to construct an infinite round robin, but then take a finite number of elements from the start.
e.g.
auto r = roundRobin(cycle([0, 1]), cycle([0, 1, 2])).take(10);
This should work, even though cycle is infinite. There's nothing wrong with infinite ranges, as long as you don't try to iterate them in their entirety :-)
Comment #2 by justin — 2014-06-06T18:19:37Z
roundRobin appears to work as documented, and accepting infinite ranges is a valid use case, as explained by Peter Alexander.