Im trying to remove elements from STL list, but im getting a weird runtime error: "Exception thrown at 0x00CC417B in PhysicsEngine.exe: 0xC0000005: Access violation reading location 0x0000000C" I dont know what to do to fix this.
How do you know that all Object* in the objects are valid? Someone could call the insert() with a nullptr.
The getIndex() probably expects a valid pointer too.
How do you know that the value returned by getIndex() is either -1 or a valid index to the 'nodes'?
In other words: you have to debug a bit deeper to find out which statement crashes. The erase in itself looks ok.
OK i found the problem. The problem is related to something else, and i thought it would raise problems, but i dont know how to fix it.
I have made a topic about it http://www.cplusplus.com/forum/general/195882/ the issue lies within the merge function.