I get this error when i try to run this code for an inventory in debug mode in VS. But for some reason it works just fine in release mode.
1 2 3 4 5 6 7 8 9 10 11
void Push_Back_Item(Item *item){
for(int y = 0; y < InvSizeY; y ++)
for(int x = 0; x < InvSizeX; x ++){
auto Iter = ItemList.find(std::make_pair(x,y));
if(Iter != ItemList.end()){
item->SetDead(); // ERROR
}
}
}
This isnt the full code though but it still gives me the same error.
The only thing "item->SetDead()" does is to set a bool to true.
This is the map i get the iterator from std::map<std::pair<int,int>,Item*> ItemList;
This have been bugging me for quite some time now.
There are no vector iterators in the code you supplied, therefore either the error message you supplied is not correct, or the code you supplied does more than you say it does. You seem to indicate that line 7 is where the error occurs. There are no iterators on that line, unless they exist within the Item::SetDead method.
Also, why doesn't your Push_Back_Item function push back any items?