hello there
i'm having a list iterator not incrementable problem
i have a adjacency matrix "adj(2d vectors)" + i have a char vector in name color and i have a int glist
i'm having a problem with the following function
for(list<int>::iterator it = glist.begin(); it != glist.end(); it++)
{
int x =0;
for(int i=0;i<adj.at(*it).size();i++){
if(color.at(adj.at(*it).at(i)) == 'w')
x++;
}
if(x == 0)
{
it = glist.erase(it);
}
}
what i want from this function is to test if the neghbors of each elemnt in glist hase neighbors with white color (i.e the color of the neighbor in the color vector == "w" if it doesn't then deltet the element from the glist
but when i compile an error of list iterator not incrementable shows up
any help will be appreciated