我想从中删除一个元素std::list
,然后指向这个列表但是当我这样做时
for(std::list<CvRect>::iterator it = listOfCvRects.begin(); it != listOfCvRects.end(); it++)
{
for(std::list<CvRect>::iterator jt = listOfCvRects.begin(); jt != listOfCvRects.end(); jt++)
{
if( it == jt )
{ continue;}
if( (jt->x) > (it->x) //.. more conditions...)
{
jt = listOfCvRects.erase(jt);
//OR
//listOfCvRects.erase(jt++);
}
}
}
我得到了未处理的异常:iterator is unincrementable