当需要erase list里的元素时
代码可写为以下形式,可避免list iterator incrementable
std::list<int> T;
std::list<int>::iterator rpos;
for(rpos=T.begin();rpos!=T.end();)
rpos = T.erase(rpos);

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-05
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-04-07
  • 2021-07-07
  • 2022-02-09
  • 2021-12-24
  • 2021-10-13
  • 2021-12-06
  • 2022-12-23
相关资源
相似解决方案