Skip to content
Vlad Riscutia edited this page Nov 7, 2016 · 1 revision

Header pipe/algorithm.h, in namespace pipe::algorithm.

inline auto drop_n(size_t n);

drop_n returns an object which can act as a rhs when applying operator| to a lhs generator. When applied, it skips n elements yielded by the input generator and yields the remaining elements.

Example:

std::vector<int> out { };
count<int>() | take_n(6) | drop_n(3) | collect(std::back_inserter(out));
// out contains { 3, 4, 5 }
Clone this wiki locally