daedalus_1.4.exe中0x770115de处未处理的异常:0xC0000005:访问冲突读取位置0xccccccc0。
string temp;
string locName = "0";
vector<vector<string>> l;
int m = 100, n = 3; //vector dimension
l.resize(m);
for(int i = 0; i < m; ++i) l[i].resize(n);
temp.clear();
if(line.substr(1, 17) == "Timing LocationID" && arrayFull == true) {
int i = 0; //starting char
while (line[i++] != '='); //increment to next
while (line[++i] != '"') temp += line[i];
locName = findLocation(temp, 0, "", l);
string findLocation (string temp, int index, string locName, vector<vector<string>> &l)
{
if (temp == "*") return locName; // <------errors here on return
if (l[index][0] == temp) findLocation(l[index][1], 0, locName.insert(0,l[index][2]), l);
else findLocation(temp, ++index, locName, l);
}
该函数遍历2xvector并返回由父级->子级矢量单元格组成的串联字符串
这些来自调用堆栈;看起来像字符串析构函数
__CLR_OR_THIS_CALL ~basic_string()
{ // destroy the string
_Tidy(true);
}
void __CLR_OR_THIS_CALL _Tidy(bool _Built = false,
size_type _Newsize = 0)
{ // initialize buffer, deallocating any storage
if (!_Built)
;
else if (_BUF_SIZE <= _Myres)
{ // copy any leftovers to small buffer and deallocate
_Elem *_Ptr = _Bx._Ptr;
if (0 < _Newsize)
_Traits_helper::copy_s<_Traits>(_Bx._Buf, _BUF_SIZE, _Ptr, _Newsize);
_Mybase::_Alval.deallocate(_Ptr, _Myres + 1);
}
_Myres = _BUF_SIZE - 1;
_Eos(_Newsize);
}
最佳答案
您的函数字符串findLocation()
并非在所有路径上都返回值,也许您的意思是:
string findLocation (string temp, int index, string locName, vector<vector<string>> &l)
{
if (temp == "*") return locName;
if (l[index][0] == temp) return findLocation(l[index][1], 0, locName.insert(0,l[index][2]), l);
else return findLocation(temp, ++index, locName, l);
}
关于c++ - 0x770115de中的未处理异常位于:0xC0000005:使用递归 vector 搜索的访问冲突读取位置0xccccccc0,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/11461892/