import std.array: array; assert(flipFlop([0,2,4],[1,3,5]).array == [0,1,2,3,4,5]); assert(flipFlop([0,2],[1,3,5]).array == [0,1,2,3]); assert(flipFlop([0,2,4],[1,3]).array == [0,1,2,3,4]); int[] re = []; assert(flipFlop([0], re).array == [0]); assert(flipFlop(re, re).array == []); assert(flipFlop(re, [0]).array == []);
Returns a lazy input range that alterntively returns the state of one of two sub-ranges.
Similar to std.range roundRobin() or chain() except that the resulting range is considered as empty when one of the sub range is consumed.