take

fnTake!R take(R)(R input, size_t n) if (isInputRange!(Unqual!R))

Lazily takes only up to n elements of a range. This is particularly useful when using with infinite ranges.

Unlike takeExactly, take does not require that there are n or more elements in input. As a consequence, length information is not applied to the result unless input also has length information.

Parameters

inputan input range to iterate over up to n times
nthe number of elements to take

Returns

At minimum, an input range. If the range offers random access

and length, take offers them as well.