container.qbk 1.7 KB

123456789101112131415161718192021222324252627282930313233
  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]
  10. Every property tree node models the ReversibleSequence concept, providing
  11. access 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
  13. subtree it starts) iterates only a single level of the hierarchy. There is no
  14. way to iterate over the entire tree.
  15. It is very important to remember that the property sequence is *not* ordered by
  16. the key. It preserves the order of insertion. It closely resembles a std::list.
  17. Fast access to children by name is provided via a separate lookup structure. Do
  18. not attempt to use algorithms that expect an ordered sequence (like
  19. binary_search) on a node's children.
  20. The property tree exposes a second container-like interface, called the
  21. associative view. Its iterator type is the nested type assoc_iterator (and its
  22. const counterpart const_assoc_iterator). You can get an ordered view of all
  23. children by using ordered_begin() and ordered_end().
  24. The associative view also provides find() and equal_range() members, which
  25. return assoc_iterators, but otherwise have the same semantics as the members
  26. of std::map of the same name.
  27. You can get a normal iterator from an assoc_iterator by using the to_iterator()
  28. member function. Converting the other way is not possible.
  29. [endsect] [/container]