1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
#include <iostream>
#include <vector>
#include <unordered_set>
int main()
{
std::vector<int> seq { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 6, 4, 2, 0, 1, 3, 5, 7, 9 } ;
{
std::unordered_set<int> set { std::begin(seq), std::end(seq) } ;
seq = { std::begin(set), std::end(set) };
}
for( int v : seq ) std::cout << v << ' ' ;
std::cout << '\n' ;
}
|