I'm trying to delete a record in my vector STL with iterator. But exception is thrown.
for (it = sp.begin(); it != sp.end(); ++it)
{
if (it->Id() == d)
{
sp.erase(it); //Where error starts
}
}
After I reached these code, It pops out to error exception
_STL_VERIFY(_Ptr < _Mycont->_Mylast, "can't increment vector iterator past end");
Exception thrown: read access violation. _Mycont was nullptr.