fork download
  1. #include <algorithm>
  2. #include <iostream>
  3. #include <vector>
  4.  
  5. int main()
  6. {
  7. std::vector<int> input {1, 2, 3, 4, 5, 6, 7, 8, 9, 0};
  8. std::partition(input.begin(), input.end(), [](int p){return p % 2 == 0;});
  9. for(int i: input)
  10. std::cout << i << ' ';
  11. }
  12.  
Success #stdin #stdout 0s 3428KB
stdin
Standard input is empty
stdout
0 2 8 4 6 5 7 3 9 1