📜  unordered_set 为向量 - C++ 代码示例

📅  最后修改于: 2022-03-11 14:44:48.397000             🧑  作者: Mango

代码示例1
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()));
}