fork download
  1. #include <iostream>
  2. #include<set>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.  
  8. int a[] = {1,2,2,4};
  9. std::set<int> s{1,2,3,4};
  10.  
  11. std::set<int> s1{std::begin(a), std::end(a)};
  12. for(auto f =s1.begin();f!=s1.end();f++)
  13. cout<<*f<<endl;
  14. return 0;
  15. }
Success #stdin #stdout 0.01s 5268KB
stdin
Standard input is empty
stdout
1
2
4