I\'m making a game and I have a vector of bullets flying around. When the bullet is finished, I do bullets.erase(bullets.begin() + i); Then the bullet disappears. However it doe
It may not get rid of the memory.
But next time you need to add a bullit it does not need to re-allocate more space.
It will not re-use the memory that the erased bullet came from.
Note:
If you are erasing from the middle of a container relatively often then vector may not be the correct container. This is becuase if you remove element n then all the elements from [n+1,end) must be moved down one space in memory.