1[/ 2 / Copyright (c) 2008 Marcin Kalicinski (kalita <at> poczta dot onet dot pl) 3 / Copyright (c) 2009 Sebastian Redl (sebastian dot redl <at> getdesigned dot at) 4 / 5 / Distributed under the Boost Software License, Version 1.0. (See accompanying 6 / file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 /] 8[section:container Property Tree as a Container] 9[/ __ptree_*__ macros expected from property_tree.qbk] 10Every property tree node models the ReversibleSequence concept, providing 11access to its immediate children. This means that iterating over a __ptree__ 12(which is the same as its root node - every __ptree__ node is also the 13subtree it starts) iterates only a single level of the hierarchy. There is no 14way to iterate over the entire tree. 15 16It is very important to remember that the property sequence is *not* ordered by 17the key. It preserves the order of insertion. It closely resembles a std::list. 18Fast access to children by name is provided via a separate lookup structure. Do 19not attempt to use algorithms that expect an ordered sequence (like 20binary_search) on a node's children. 21 22The property tree exposes a second container-like interface, called the 23associative view. Its iterator type is the nested type assoc_iterator (and its 24const counterpart const_assoc_iterator). You can get an ordered view of all 25children by using ordered_begin() and ordered_end(). 26 27The associative view also provides find() and equal_range() members, which 28return assoc_iterators, but otherwise have the same semantics as the members 29of std::map of the same name. 30 31You can get a normal iterator from an assoc_iterator by using the to_iterator() 32member function. Converting the other way is not possible. 33[endsect] [/container] 34