So, I have created my own containerclass that holds a vector. Im using it in a game and when certain objects hits a wall I want them to be erased. Here is the code:
When i try to do this I get a compile error on the "=" saying that: "no operator "=" matches these operands". If I remove the "i=" the program crashes and I get "vector iterator not incrementable".Code:void Game::aliveTest() { for (std::vector<Entity*>::iterator i = container.begin(); i!=container.end(); i++) { if ((*i)->getType() == 8) { if (((Projectile*)*i)->isAlive()==false) { delete (*i); i=container.erase(i); } } } }
Do I need to specify my own "= operator" in my containerclass or what's the problem?