chain

fnauto chain(Ranges...)(Ranges rs) if (Ranges.length > 0 && allSatisfy!(isInputRange, staticMap!(Unqual, Ranges)) && !is(CommonType!(staticMap!(ElementType, staticMap!(Unqual, Ranges))) == void))

Spans multiple ranges in sequence. The function chain takes any number of ranges and returns a Chain!(R1, R2,...) object. The ranges may be different, but they must have the same element type. The result is a range that offers the front, popFront, and empty primitives. If all input ranges offer random access and length, Chain offers them as well.

Note that repeated random access of the resulting range is likely to perform somewhat badly since lengths of the ranges in the chain have to be added up for each random access operation. Random access to elements of the first remaining range is still efficient.

If only one range is offered to Chain or chain, the Chain type exits the picture by aliasing itself directly to that range's type.

Parameters

rsthe input ranges to chain together

Returns

An input range at minimum. If all of the ranges in rs provide

a range primitive, the returned range will also provide that range primitive.

See Also

only to chain values to a range