unordered set to vector

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

showing results for - "unordered set to vector"
Yannic
11 Nov 2020
1Before C++17
2vector.insert(vector.end(), set.begin(), set.end());
3
4After C++17
5vector.reserve(set.size());
6for (auto it = set.begin(); it != set.end(); ) {
7    vector.push_back(std::move(set.extract(it++).value()));
8}
9