• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2<html>
3<head>
4<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5<title>Property Tree as a Container</title>
6<link rel="stylesheet" href="../../../doc/src/boostbook.css" type="text/css">
7<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
8<link rel="home" href="../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
9<link rel="up" href="../property_tree.html" title="Chapter 31. Boost.PropertyTree">
10<link rel="prev" href="tutorial.html" title="Five Minute Tutorial">
11<link rel="next" href="synopsis.html" title="Property Tree Synopsis">
12</head>
13<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
14<table cellpadding="2" width="100%"><tr>
15<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
16<td align="center"><a href="../../../index.html">Home</a></td>
17<td align="center"><a href="../../../libs/libraries.htm">Libraries</a></td>
18<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
19<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
20<td align="center"><a href="../../../more/index.htm">More</a></td>
21</tr></table>
22<hr>
23<div class="spirit-nav">
24<a accesskey="p" href="tutorial.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../property_tree.html"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="synopsis.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
25</div>
26<div class="section">
27<div class="titlepage"><div><div><h2 class="title" style="clear: both">
28<a name="property_tree.container"></a><a class="link" href="container.html" title="Property Tree as a Container">Property Tree as a Container</a>
29</h2></div></div></div>
30<p>
31      Every property tree node models the ReversibleSequence concept, providing access
32      to its immediate children. This means that iterating over a <code class="computeroutput"><a class="link" href="../boost/property_tree/ptree.html" title="Type definition ptree">ptree</a></code>
33      (which is the same as its root node - every <code class="computeroutput"><a class="link" href="../boost/property_tree/ptree.html" title="Type definition ptree">ptree</a></code>
34      node is also the subtree it starts) iterates only a single level of the hierarchy.
35      There is no way to iterate over the entire tree.
36    </p>
37<p>
38      It is very important to remember that the property sequence is <span class="bold"><strong>not</strong></span>
39      ordered by the key. It preserves the order of insertion. It closely resembles
40      a std::list. Fast access to children by name is provided via a separate lookup
41      structure. Do not attempt to use algorithms that expect an ordered sequence
42      (like binary_search) on a node's children.
43    </p>
44<p>
45      The property tree exposes a second container-like interface, called the associative
46      view. Its iterator type is the nested type assoc_iterator (and its const counterpart
47      const_assoc_iterator). You can get an ordered view of all children by using
48      ordered_begin() and ordered_end().
49    </p>
50<p>
51      The associative view also provides find() and equal_range() members, which
52      return assoc_iterators, but otherwise have the same semantics as the members
53      of std::map of the same name.
54    </p>
55<p>
56      You can get a normal iterator from an assoc_iterator by using the to_iterator()
57      member function. Converting the other way is not possible.
58    </p>
59</div>
60<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
61<td align="left"></td>
62<td align="right"><div class="copyright-footer">Copyright © 2008-2010 Marcin Kalicinski<br>Copyright © 2010-2013 Sebastian
63      Redl<p>
64        Distributed under the Boost Software License, Version 1.0. (See accompanying
65        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
66      </p>
67</div></td>
68</tr></table>
69<hr>
70<div class="spirit-nav">
71<a accesskey="p" href="tutorial.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../property_tree.html"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="synopsis.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
72</div>
73</body>
74</html>
75