Original Post
Hi, I'm trying to loop through a map to find if any particular instance (EntityBuilding) of a derived class (from Entity)exists, code snippet as follows: However, it keeps on crashing on me, and I'm not sure why. Using VC2003, it's an unhandled exception. (And yes, I know I should use std::for_each!) Thanks, Jim.
for(std::map<unsigned int, Entity*>::iterator it = entityList_.begin(); it != entityList_.end(); ++it)
{
Entity* curEntity = &(*it->second);
if(typeid(*curEntity) == typeid(EntityBuilding))
{
return true;
}