fork download
  1. #include <iostream>
  2. #include <array>
  3. #include <algorithm>
  4.  
  5. int main() {
  6. std::vector<int> a{6, 10, 14, 20};
  7. std::vector<int> b{4, 8, 16, 20};
  8. std::vector<int> c;
  9.  
  10. std::set_union(a.begin(), a.end(), b.begin(), b.end(), std::back_inserter(c));
  11. for(auto e: c) {
  12. std::cout << e << ' ';
  13. }
  14. std::cout << '\n';
  15. }
Success #stdin #stdout 0s 3460KB
stdin
Standard input is empty
stdout
4 6 8 10 14 16 20