N
ngaloppo
Hi,
compiling a program with the code blurb below causes a runtime error
("Expression: vector iterators incompatible") due to the debug
iterators in VC++ 8. The error happens in the ind_len.push_back() call,
at the second iteration. I suspect that the iterator has been
invalidated, but I can't see how this would be from one iteration to
another in this tiny for loop. Could anyone give me more insight?
Thanks!
std::vector<int*> indices;
std::vector<int> ind_len;
[...]
int patch_count = in.readUInt32();
for (int i = 0; i < patch_count; i++)
{
int index_count = in.readUInt32();
ind_len.push_back(index_count);
indices.push_back(new int[index_count]);
if (!indices)
return false;
in.readInt32(indices, index_count);
}
--nico
compiling a program with the code blurb below causes a runtime error
("Expression: vector iterators incompatible") due to the debug
iterators in VC++ 8. The error happens in the ind_len.push_back() call,
at the second iteration. I suspect that the iterator has been
invalidated, but I can't see how this would be from one iteration to
another in this tiny for loop. Could anyone give me more insight?
Thanks!
std::vector<int*> indices;
std::vector<int> ind_len;
[...]
int patch_count = in.readUInt32();
for (int i = 0; i < patch_count; i++)
{
int index_count = in.readUInt32();
ind_len.push_back(index_count);
indices.push_back(new int[index_count]);
if (!indices)
return false;
in.readInt32(indices, index_count);
}
--nico