Error when trying to remove an object from a list while going through it in C++

Hi I am a beginner in c++ and I would like to know why this code returns a Debug Assertion Failed error everytime an object is erased from the list.

for (auto it = ProjectileList.end(); it != ProjectileList.begin();) {
            if (it->position_y < 0) {
            else {

Read more here:

Content Attribution

This content was originally published by Froncis at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: