terminate called after throwing an instance of 'std::out_of_range' what(): _Map_base::at

描述:运行右边的代码代码:Uisystem uiSystemService(xmlPath); (调用此类Uisystem 的构造函数能够能够正常运行到最后一行,调用完成构造函数之后就报错,我找了好久都没有找到原因。。。)

错误码:terminate called after throwing an instance of 'std::out_of_range'   what():  _Map_base::at

修改代码:Uisystem* uiSystemService = new Uisystem(xmlPath);

原因:此类Uisystem的成员变量中有包含堆上的对象地址元素的map, 所以构造此类的对象需要在堆上进行。

坚持成就伟大
原文地址:https://www.cnblogs.com/xian-yongchao/p/14238496.html