https://www.boost.org/doc/libs/1_74_0/doc/html/property_tree.html
Друзья! Boost установил, но этот код не работает:
Код: Выделить всё
//foo.cpp
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/xml_parser.hpp>
int main ()
{
assoc_iterator ite;
return 0;
}
Shell
$ g++ foo.cpp
foo.cpp: In function ‘int main()’:
foo.cpp:6:5: error: ‘assoc_iterator’ was not declared in this scope
assoc_iterator ite;
^~~~~~~~~~~~~~
$
Shell
$ grep assoc_iterator /usr/include/boost/property_tree/*.hpp | head -n 2 | tail -n 1
/usr/include/boost/property_tree/ptree.hpp: class assoc_iterator;
$
property_tree примитивненько, но работает, например, можно создать дерево и вывести его:
тут код
Код: Выделить всё
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/xml_parser.hpp>
using namespace std;
namespace pt = boost::property_tree;
int main ()
{
boost::property_tree::ptree step;
step.put("x", "");
step.put("x.e", "");
step.put("x.e.k", "");
step.put("x.r", "");
step.put("x.r.d", "");
step.put("x.y.z.a.b", "");
step.put("x.y.z.k.n.b", "");
step.put("x.y.z.k.h.p", "");
step.put("x.m.q.w.t", "");
pt::write_xml ("dst.xml", step);
return 0;
}