I have all my objects in one vector, but I don't know how to check collisions between each object.
At first, I tried doing a nested for-loop. However, since colliding objects would sometimes destroy each other, it was a really icky way of doing it and is a very rigid architecture.
According to this, Iterator invalidation rules and C++ nested iterators
I shouldn't use nested for loops to check for collision.
Than by what method should I do it? Everything is already in the vector, the collision code is done, as well as the response. I just need a way to move through the entire vector and check collision with everything, and still lets me erase and change things.
Edit: I don't want to break out of the loop either.
Edit 2: The objects that are colliding is namely bullets with other objects such as walls. The bullets are really just quads that fire off. Using a bounding box empirical method, I detect when the bullet is inside the wall, and just delete the bullet. Once the wall hits a certain limit of hp, it too will be deleted. The main problem I have with dealing with this is that my nested for loop would fail upon hitting the parent loop once something is erased. It would throw an iterator not increment able error, but using a break point, I can clearly see that the iterator can be identified.