0xC0000005中0x770115de处未处理的异常:使用递归矢量搜索读取位置0xccccccc0时发生访问冲突

Unhandled exception at 0x770115de in : 0xC0000005: Access violation reading location 0xccccccc0 with recursive vector search

本文关键字:位置 读取 搜索 0xccccccc0 访问冲突 递归 未处理 0x770115de 异常 0xC0000005      更新时间:2023-10-16

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,并返回一个由parent->childvector单元格组成的串联字符串

这些来自调用堆栈;看起来像字符串析构函数

__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);
}