【发布时间】:2010-08-29 05:23:21
【问题描述】:
我正在使用 boost::ptree 来解析文件。问题是我无法在堆中创建对象。所有样本仅用于堆栈。
#include <boost/property_tree/ptree.hpp>
ptree *tree_handle;
read_info("path", tree_handle);
我需要这个,因为代码在一个函数中,我必须从中返回 ptree 对象。
错误:
‘boost::property_tree::basic_ptree<std::basic_string<char>, std::basic_string<char> >*’ is not a class, struct, or union type
request for member ‘swap’ in ‘pt’, which is of non-class type ‘boost::property_tree::basic_ptree<std::basic_string<char>, std::basic_string<char> >*’
有什么想法吗?
【问题讨论】:
-
请提供minimal reproducible example,但猜测
read_info("path", *tree_handle);
标签: c++ boost heap-memory