I'm seeing some unusual behavior when I compare two iterators.
vector<list<MyClass*>> vlWatchers(10);
list<MyClass*>::iterator itCurrent, itEnd;
for (int i(0); i <= 9; ++i)
{
itCurrent = vlWatchers[i].begin();
itEnd = vlWatchers[i].end();
while (itCurrent != itEnd)
{
//code
}
}
will cause a liste iterators incompatible error on the while() line, and appears to happen when i = 0, although only some of the time.
Upon further investigation after the error is called, itEnd and itCurrent are both equal to 0xcdcdcdcd. The weird part is when i step into the != compare operator, the "this" pointer BECOMES 0xcdcdcdcd. Shouldn't 0xcdcdcdcd be the value that's stored in the iterators, not the address of the iterators themselves? or is there some sort of iterator black magic where the iterator both stores a value and IS the value? This is part of a larger project, but the error is repeatable.
Thank you in advance for any help!