我在Visual Studio“访问冲突读取位置0xDDDDDDDD”中收到此错误

时间:2019-12-29 01:16:44

标签: c++ visual-studio pointers vector iterator

这是我的代码。

vector<Employee*> theEmployee;
...
virtual ~Personal()
{
    for (vector<Employee*>::iterator it = theEmployee.begin(); it != theEmployee.end(); it++)
    {
        delete(*it);   <---the line of that error
    }
}

我试图通过添加if (*it != NULL)来解决此问题,但这没用。

0 个答案:

没有答案