阅读背景:

pop_back()是否真的使std :: vector上的* all *迭代器无效?

来源:互联网 
std::vector<int> ints;

// ... fill ints with random values

for(std::vector<int>::iterator it = ints.begin(); it != ints.end(); )
{
    if(*it < 10)
    {
        *it = ints.back();
        ints.pop_back();
        continue;
    }
    it++;
}
std::vector<int> ints;

// ... fill ints with r



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: