drop

fnR drop(R)(R range, size_t n) if (isInputRange!R)

drop is a convenience function which calls

popFrontN(range, n) and returns range.

Unlike popFrontN, the range argument is passed by copy, not by ref.

drop makes it easier to pop elements from a range rvalue and then pass it to another function within a single expression, whereas popFrontN would require multiple statements.

dropBack provides the same functionality but instead calls

popBackN(range, n)

Note

drop and dropBack will only pop up to

n elements but will stop if the range is empty first. In other languages this is sometimes called skip.

Parameters

rangethe input range to drop from
nthe number of elements to drop

Returns

range with up to n elements dropped

See Also