当我通过“m_itFileBuffer”字符串列表容器进行迭代时,在从迭代器中获取值时出现异常。这行代码在大多数情况下都有效,但只有有时会出现异常。在我的代码中,我正在设置“m_itFileBuffer”迭代器到不同的值。部分代码如下
StringList m_listFileBuffer; //this contains list of CString`s, I read from file and insert into this.
StringList::iterator m_itFileBuffer;
....
....
....
....
....
{
bool notEmpty = (m_itFileBuffer != m_MylistFileBuffer.end());
if (notEmpty)
{
m_strLine = static_cast<CString>(*m_itFileBuffer);//Here i get exception
++m_itFileBuffer;
}
}
下面是我在输出窗口中得到的异常:
Severity: Critical Error (10 - 'System Crit.'), Returncode: 0x80040835, Error No.: 0 (access violation)
Description: C system exception code: C0000005
任何帮助,为什么我得到这个例外?另外,我们如何重置迭代器?