I'm sure once I see the solution to this problem I'll be banging my head on the desk but anyway, here goes.
I created a std::map that I'm iterating through checking for a value. If the value matches, I delete the entry in map and continue on until I reach the end of the list.
The problem I'm having is when I try to delete the last element in the map. It would make sense that there are no further elements after deleting it. A this point the program backs out with a debug error.
I thought to add a check, if(it = map.end()) but I'm getting " conditional expression of type 'std::_Tree<_Traits>::iterator' is illegal" error. So clearly I'm using it incorrectly.
Here's the block of code that I'm using. The only real relevant part is the for() loop iterating through mTextureArray which is a std::map:
Code:for(map<Image*, pair<GLuint, int> >::iterator i ; i != mTextureArray.end(); i++)
{
if((currentTick - i->second.second) > TEXTURE_EXPIRE_TIME)
{
glDeleteTextures(1, &i->second.first);
mTextureArray.erase(i);
}
}