美文网首页
运行时提示错误basic_string::_S_construc

运行时提示错误basic_string::_S_construc

作者: DayDayUp08 | 来源:发表于2018-03-28 16:21 被阅读0次

    代码

    char* xxx = func();

    string yyy(xxx);

    运行时提示错误:

    terminate called after throwing an instance of 'std::logic_error' what(): basic_string::_S_construct null not valid

    提示的错误已经很明确,是string构造不能传入空指针xxx,即在xxx为空时会报上面错误,保证func返回不为空即可。

    相关文章

      网友评论

          本文标题:运行时提示错误basic_string::_S_construc

          本文链接:https://www.haomeiwen.com/subject/ckqucftx.html