C++ map中使用erase应该注意到的问题

注意:此程序在win环境下会出现上述描述的问题;在mac环境下第一种方式是正常运行的。Map.erase有3个重载函数:

void erase(iterator position);

size_type erase(const key_type& x);  // 这个如果size_type为int,则返回值为1时代表删除成功,为0代表删除失败。

void erase(iterator first, iterator last);   // 相当于map.clean()。

原文地址:https://www.cnblogs.com/xuelisheng/p/9736547.html