I will try my best to describe this problem I am having because I am not sure if I can reproduce the error in a small code example as this is part of a large code project.
I have a plain std::vector which contains pointers to objects.
When attempting to delete the objects, even if I know for a fact that the std::vector has at least one object in it as shown by the debugger, I get the "Vector Subscript Out of Range" error.
I'll even do a range for loop like so:
1 2 3 4 5
for (auto & e : CurrentObjects) {
delete e;
}
And yet I still get the "Vector Subscript Out of Range" error. The destructor is never called for the object represented by "e" so I am not sure why I get the error.
And it should be impossible to get that error with range-based loops as they do not use subscript at all. Are you sure that this is the fragment which contains error?