如何避免错误:terminate在抛出一个'std :: logic_error'实例后调用what():basic_string :: _ S_construct null无效 [英] How to avoid the error: terminate called after throwing an instance of 'std::logic_error' what(): basic_string::_S_construct null not valid
本文介绍了如何避免错误:terminate在抛出一个'std :: logic_error'实例后调用what():basic_string :: _ S_construct null无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
if(player!=NULL)
player->shuffled();
我这样做是为了避免传递null引用到字符串构造函数,错误。
I do such things to avoid passing a null reference to a string constructor, but when compiling it still comes to error.
推荐答案
某处,你调用 std :: string
构造函数与 const char *
值NULL。
Somewhere, somehow, you're calling the std::string
constructor with the const char*
value NULL.
为了避免这个问题。不要这样做。
To avoid the problem. Don't do that.
这篇关于如何避免错误:terminate在抛出一个'std :: logic_error'实例后调用what():basic_string :: _ S_construct null无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文