move elements from vector to unordered set

Solutions on MaxInterview for move elements from vector to unordered set by the best coders in the world

showing results for - "move elements from vector to unordered set"
Gia
24 Jan 2021
1#include <iostream>
2#include <vector>
3#include <unordered_set>
4 
5int main()
6{
7    std::vector<int> input({ 1, 2, 2, 1, 3, 1, 4 });
8 
9    std::unordered_set<int> set(input.begin(), input.end());
10 
11    for (const int &i: set) {
12        std::cout << i << " ";
13    }
14 
15    return 0;
16}