Boost 1.46.1, Property Tree: How to iterate through ptree receiving sub ptrees?

前端 未结 3 1383
情话喂你
情话喂你 2020-12-25 12:34

First of all I shall say that I think I got how it should be done but my code will not compile any way I try. I based my assumption on this official example of empty ptree t

3条回答
  •  借酒劲吻你
    2020-12-25 13:09

    The property tree iterators point to pairs of the form (key, tree) of type ptree::value_type. The standard loop for iterating through the children of the node at path therefore looks like:

    BOOST_FOREACH(const ptree::value_type &v, pt.get_child(path)) {
        // v.first is the name of the child.
        // v.second is the child tree.
    }
    

提交回复
热议问题