How to iterate a boost property tree?

前端 未结 5 718
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-24 03:27

I am know approaching to boost property tree and saw that it is a good feature of boost libs for c++ programming.

Well, I have one doubt? how to iterate a property t

5条回答
  •  我在风中等你
    2020-12-24 03:52

    BOOST_FOREACH is just a convenient way for iterating that can be done by iterator, begin() and end()

    Your_tree_type::const_iterator end = tree.end();
    for (your_tree_type::const_iterator it = tree.begin(); it != end; ++it)
        ...
    

    And since C++11 it's:

    for (auto& it: tree)
        ...
    

提交回复
热议问题