Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

unordered_set to vector

Before C++17
vector.insert(vector.end(), set.begin(), set.end());

After C++17
vector.reserve(set.size());
for (auto it = set.begin(); it != set.end(); ) {
    vector.push_back(std::move(set.extract(it++).value()));
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #vector
ADD COMMENT
Topic
Name
2+7 =