I have a list like
2 , 6 , 6 , 8 , 9
I want this like
2, 8 , 9
I wrote a code
for(std::list<int>::iterator i = almostPrimeList.begin(); i != almostPrimeList.end(); ++i) {
for(std::list<int>::iterator j = ++std::list<int>::iterator(i); j != almostPrimeList.end(); ++j) {
if(*i == *j) {
cout <<*i << " found";
//almostPrimeList.remove(*i);
break;
}
}
}
it appears found the values which has duplicate, but when I want to remove it make an infinite loop