I recently started programming in c++ with visual studio 2010, my current projekt (or solution) compiles without errors. Then I start the program and then does the program crach with the following error.
Code:
Debug Assertion Failed!
...
Expression: map/set iterators incompatible
I have tried to understand why, and what is causing it but no success. Do anyone know what might be causing it? Program crach when this code run
PHP Code:
for(set<Square*>::iterator itv; itv != vv.end(); itv++ )
// think the problem is at 'itv != vv.end()'
PHP Code:
set<Square*> set1;
map<Square*, set<Square*>> map_set;
for(int i=0;i<9;i++){
for(int j=0;j<9;j++){
Square* sq = sqs[i][j];
set<Square*> un_v = sq->getNeighbours();
map_set.insert(pair<Square*, set<Square*>>(sq, un_v));
}
}
typedef map<Square*, set<Square*>>::iterator it_map;
for(set<Square*>::iterator it_m = set1.begin(); it_m != set1.end(); it_m++){
Square* sq1 = (*it_m); // square 1
for(it_map it = map_set.begin();it != map_set.end(); it++){
set<Square*> vv = it->second;
set<Square*> v;// = set<Square*>(vv.begin(), vv.end());
for(set<Square*>::iterator itv; itv != vv.end(); itv++ ){ // error here <------
v.insert(new Square(**itv));
}
cout << "DEBUGG MSG" << endl; // never printed
}
}