4

I am trying to iterate over a boost property tree. The docs state that

You can get an ordered view of all children by using ordered_begin() and ordered_end().

However, when I write

for ( boost::property_tree::ptree::const_assoc_iterator it =
            myPropTree.ordered_begin();
    it != myPropTree.ordered_end();
    it++ )

The compiler complains

error: 'boost::property_tree::ptree' has no member named 'ordered_end'
boost v1.55
mingw
code::blocks
ravenspoint
  • 19,093
  • 6
  • 57
  • 103
  • Looking at the [header](http://www.boost.org/doc/libs/1_55_0/boost/property_tree/ptree.hpp), I do not see an `ordered_end()`, but there is `/** Returns the not-found iterator. Equivalent to end() in a real associative container. */ assoc_iterator not_found();` – clcto Mar 04 '15 at 18:07

1 Answers1

3

The ptree documentation says:

assoc_iterator ordered_begin();

Returns an iterator to the first child, in key order.

const_assoc_iterator ordered_begin() const;

Returns an iterator to the first child, in key order.

assoc_iterator not_found();

Returns the not-found iterator. Equivalent to end() in a real associative container.

const_assoc_iterator not_found() const;

Returns the not-found iterator. Equivalent to end() in a real associative container.

So basically theordered_end function is called not_found

ravenspoint
  • 19,093
  • 6
  • 57
  • 103
Drax
  • 12,682
  • 7
  • 45
  • 85