我正在使用boost属性树来存储我的应用程序的配置数据。
在配置文件中,我有一个名为this的项目。 我想知道如何迭代ServerList。
ServerList
{
server1 127.0.0.1:5000
server2 example.com
}
顺便说一句,这里提供的解决方案对我来说似乎不起作用: Boost Property Tree and Xml parsing Problems 所以不要去重新引用它。当我尝试它时,我收到了这个错误:
config.cpp:47: error: invalid initialization of reference of type ‘boost::property_tree::wiptree&’ from expression of type ‘boost::property_tree::basic_ptree<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >’
make: *** [config.o] Error 1
答案 0 :(得分:1)
回答我自己的问题。线索出现错误。
我在这里使用了一个wiptree 'boost :: property_tree :: wiptree&amp;类型的引用的无效初始化...
但这是一个基本的问题 输入'boost :: property_tree :: basic_ptree ...
从wiptree更改为ptree,它可以正常工作。