fork download
  1. #include <iomanip>
  2. #include <iostream>
  3. #include <set>
  4. #include <type_traits>
  5. #include <typeinfo>
  6.  
  7. using namespace std;
  8.  
  9.  
  10.  
  11. int main()
  12. {
  13. int array[] = {1,1,1,3,4,7,8,2,4,6,2,7,2,7,21,6,4,1,6,1,4,6};
  14.  
  15. set<int> s;
  16.  
  17. for(auto&& it = begin(array); it != end(array); ++it) s.insert(*it);
  18.  
  19. for(auto&& i : s) cout << i << ", ";
  20.  
  21. }
Success #stdin #stdout 0s 2984KB
stdin
Standard input is empty
stdout
1, 2, 3, 4, 6, 7, 8, 21,