代码
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返回不为空即可。
代码
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
网友评论