I have gone a bit further with the debugging and compared the vector that crashes with the same vector definition but outside of the class CMeshStructure.
The constructor for both vectors gets called as they should which in turn calls Buy(0).
which looks like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
bool _Buy(size_type _Capacity)
{
// allocate array with _Capacity elements
_Myfirst = 0, _Mylast = 0, _Myend = 0;
if (_Capacity == 0)
return (false);
else if (max_size() < _Capacity)
_Xlen(); // result too long
else
{ // nonempty array, allocate storage
_Myfirst = this->_Alval.allocate(_Capacity);
_Mylast = _Myfirst;
_Myend = _Myfirst + _Capacity;
}
return (true)
}
|
the difference is:
for the vector outside CMeshStructure:
before reaching this line _Myfirst, _Mylast and _Myend is all badfood.
_Myfirst = 0, _Mylast = 0, _Myend = 0;
after this line they are all 0
for the vector inside CMeshStructure:
before reaching this line _Myfirst, _Mylast and _Myend is all badfood.
_Myfirst = 0, _Mylast = 0, _Myend = 0;
after this they are all still badfood except for _Myend which is 0
I'm not experienced enough for this to tell me anything.. :/