fork download
  1. #include <algorithm>
  2. #include <vector>
  3. #include <iterator>
  4. #include <iostream>
  5.  
  6. int main() {
  7. std::vector<int> values{1, 2, 3, 4, 5, 6};
  8. int start = 2;
  9. int temp = 0;
  10. std::copy_if(values.cbegin(),
  11. values.cend(),
  12. std::ostream_iterator<int>(std::cout, " "),
  13. [&temp, start](const int val) { return temp ++ != start; });
  14.  
  15. return 0;
  16. }
Success #stdin #stdout 0s 3412KB
stdin
Standard input is empty
stdout
1 2 4 5 6