fork(1) download
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <iterator>
  4. #include <vector>
  5.  
  6. int main()
  7. {
  8. std::vector<int> a{ 1, 2, 3, 4, 5 };
  9. std::vector<int> b{ 4, 5, 6, 7 };
  10. std::vector<int> c;
  11.  
  12. std::set_difference(a.begin(), a.end(), b.begin(), b.end(), std::inserter(c, c.begin()));
  13.  
  14. for (auto it : c)
  15. {
  16. std::cout << it << " ";
  17. }
  18.  
  19. return 0;
  20. }
Success #stdin #stdout 0s 3412KB
stdin
Standard input is empty
stdout
1 2 3