尝试擦除列表的最后一个元素时出现此错误.我调试了代码,并能够找出导致它的原因和位置,这是我的代码:
for(Drop_List_t::iterator i = Drop_System.begin(); i != Drop_System.end() && !Drop_System_Disable; /**/)
{
if(Player->BoundingBox.Intersect(&(*i)->BoundingBox))
{
i = Drop_System.erase(i);
}
++i; //List iterator crashes here if last entry was deleted
}
Run Code Online (Sandbox Code Playgroud)
我无法弄清楚我做错了什么......有什么建议吗?