This is my code. Upon running I get the segmentation fault and I guess it possibly due to the iterator "it" not getting a valid value.
for(it=v.begin();it!=v.end();it++)
{
for(it1=v.begin();it1!=v.end();it1++)
{
if(*it>*it1 && *it<=*it1+k)
{
v.erase(it1);
it1=it1+1;
}
}
}
How can I correct it or if is it even possible to correct it or not
Aucun commentaire:
Enregistrer un commentaire