vs2005里List Iterator Not Incrementable?

当需要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);

posted on 2007-08-02 16:00  cloudseawang  阅读(1868)  评论(0编辑  收藏  举报

导航