I'm working in visual studio 2010. I'm getting a "vector subscript out of range debug assertion check" -error, which I believe is incorrect.
I have created a minimal example:
Expand|Select|Wrap|Line Numbers
- int xsize = 4dVector.size();
- int ysize = 4dVector[x].size();
- int zsize = 4dVector[x][y].size();
- int nbelements = 4dVector[x][y][z].size();
- for (uint32_t i = 0; i < 4dVector[x][y][z].size(); i++) {
- Foo* foo = 4dVector[x][y][z][i];
- // do something
- }
Foo* foo = 4dVector[x][y][z][i];
however, when inspecting all variables I find:
xsize = 20;
ysize = 20;
zsize = 20;
nbelements = 17;
x = 11;
y = 17;
z = 14;
i = 14;
I don't see the problem with that?
Also, every time I rerun the program in debugging mode, it breaks with different values in all variables, but always correct values. All help is much appreciated.