Boost Property_Tree iterators, how to handle them?

前端 未结 3 1202
野的像风
野的像风 2021-02-07 10:00

I am sorry, I asked a question about the same topic before, but my problem concerns another aspect of the one described there (How to iterate a boost...).

Take a look at

3条回答
  •  鱼传尺愫
    2021-02-07 10:36

    print complete tree:

    void print(boost::property_tree::ptree const& pt)
    {
        using boost::property_tree::ptree;
        ptree::const_iterator end = pt.end();
        for (ptree::const_iterator it = pt.begin(); it != end; ++it) {
            std::cout << it->first << ": " << it->second.get_value() << std::endl;
            print(it->second);
        }
    }
    

提交回复
热议问题