fork download
  1. #include <iostream>
  2. #include <list>
  3.  
  4. int main() {
  5. std::list<int> myList = { 0, 1, 2, 3, 4, 5, 6 };
  6.  
  7. myList.remove_if(
  8. [](int value) -> bool {
  9. return value > 1 && value < 4;
  10. }
  11. );
  12.  
  13. for(int value : myList) {
  14. std::cout << value << " ";
  15. }
  16.  
  17. return 0;
  18. }
  19.  
Success #stdin #stdout 0s 3228KB
stdin
Standard input is empty
stdout
0 1 4 5 6