fork download
  1. #include <unordered_set>
  2. #include <vector>
  3. #include <iostream>
  4.  
  5. int main()
  6. {
  7. std::unordered_set<int> tempSet;
  8. std::vector<int> vec { 55, 55, 55, 1, 23, 45 };
  9. for ( auto& val : vec )
  10. {
  11. if (!tempSet.count(val))
  12. std::cout << val << " ";
  13. tempSet.insert(val);
  14. }
  15. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
55 1 23 45