fork download
  1. #include <vector>
  2. #include <iostream>
  3. #include <algorithm>
  4.  
  5. int main()
  6. {
  7. float lim=5;
  8. std::vector<float> v = {1.0f,4.5f,3.9f,0.2f,8.4f};
  9. v.erase(std::remove_if(v.begin(),v.end(),[&](float f){return f > lim;}),v.end());
  10. for (auto i : v) std::cout << i<<std::endl;
  11. return 0;
  12. }
Success #stdin #stdout 0s 16064KB
stdin
Standard input is empty
stdout
1
4.5
3.9
0.2