Je veux effacer un élément de la std::list
et pointera alors à cette liste, mais quand je le fais de cette façonComment retourner correctement à std :: list après avoir effacé un élément (double pour la boucle)?
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++);
}
}
}
Je GOT et exception non gérée: iterator is unincrementable
[double possible] (http://stackoverflow.com/q/596162/624900) – jterrace
Si la condition est symétrique, vous pouvez démarrer la boucle interne à 'jt = ça,'. –