fork download
  1. #include <iostream>
  2. #include <vector>
  3. #include <set>
  4.  
  5. int main()
  6. {
  7. std::vector<int> from = { 1, 2, 3 };
  8. std::set<int> to;
  9.  
  10. std::copy(begin(from), end(from), std::inserter(to, begin(to)));
  11.  
  12. for (auto x : to)
  13. std::cout << x << " ";
  14.  
  15. return 0;
  16. }
Success #stdin #stdout 0s 3456KB
stdin
Standard input is empty
stdout
1 2 3