Parsing JSON with boost property tree

一笑奈何 提交于 2019-12-05 02:33:59

Problem is not with property_tree, problem is, that you try store pointer to local variable in vector. You can save by value, or use some smart pointer (for example boost::shared_ptr).

Problem:

void            setItems(single_t Item){fItems.push_back(&Item);}

After exit from this function, local variable Item will be destroyed, so you have dangling pointer.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!