C++ std::views::drop
You can create a range that doesn’t have certain elements with the following code:
#include <ranges> #include <iostream> int main() { const auto nums = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }; for (int i : nums | std::views::drop(2)) std::cout << i << " "; std::cout << std::endl; return 0; }
Output
3 4 5 6 7 8 9
- A range adaptor consisting of elements of the underlying sequence, skipping the first N elements.