如何在迭代时从地图中删除?喜欢:
std::map<K, V> map; for(auto i : map) if(needs_removing(i)) // remove it from the map
如果我使用map.erase它将使迭代器无效
map.erase
c++ map c++11
c++ ×1
c++11 ×1
map ×1