]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/multi_index/doc/tutorial/index.html
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / multi_index / doc / tutorial / index.html
CommitLineData
7c673cae
FG
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0.1 Transitional//EN">
2
3<html>
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
6<title>Boost.MultiIndex Documentation - Tutorial</title>
7<link rel="stylesheet" href="../style.css" type="text/css">
8<link rel="start" href="../index.html">
9<link rel="prev" href="../index.html">
10<link rel="up" href="../index.html">
11<link rel="next" href="basics.html">
12</head>
13
14<body>
15<h1><img src="../../../../boost.png" alt="boost.png (6897 bytes)" align=
16"middle" width="277" height="86">Boost.MultiIndex Tutorial</h1>
17
18<div class="prev_link"><a href="../index.html"><img src="../prev.gif" alt="index" border="0"><br>
19Index
20</a></div>
21<div class="up_link"><a href="../index.html"><img src="../up.gif" alt="index" border="0"><br>
22Index
23</a></div>
24<div class="next_link"><a href="basics.html"><img src="../next.gif" alt="basics" border="0"><br>
25Basics
26</a></div><br clear="all" style="clear: all;">
27
28<hr>
29
30<h2>Contents</h2>
31
32<ul>
33 <li><a href="#rationale">Rationale</a></li>
34 <li><a href="#namespace">Namespace</a></li>
35 <li><a href="basics.html">Basics</a></li>
36 <li><a href="indices.html">Index types</a></li>
37 <li><a href="key_extraction.html">Key extraction</a></li>
38 <li><a href="creation.html">Container creation</a></li>
39 <li><a href="debug.html">Debugging support</a></li>
40 <li><a href="techniques.html">Techniques</a></li>
41</ul>
42
43<h2><a name="rationale">Rationale</a></h2>
44
45<p>
46STL containers are designed around the concept that each container controls its
47own collection of elements, giving access to them in a manner specified by the
48container's type: so, an <code>std::set</code> maintains the elements ordered
49by a specified sorting criterion, <code>std::list</code> allows for free
50positioning of elements along a linear sequence, and so on.
51</p>
52
53<p>
54Sometimes, the necessity arises of having different access interfaces
55to the same underlying collection: for instance, some data might need to be
56sorted according to more than one comparison predicate, or a bidirectional list
57might benefit from a supplemental logarithmic lookup interface. In these
58situations, programmers typically resort to manual compositions of different
59containers, a solution that generally involves a fair amount of code
60devoted to preserve the synchronization of the different parts of
61the composition. Boost.MultiIndex allows for the specification of
62<code>multi_index_container</code>s comprised of one or more <i>indices</i> with
63different interfaces to the same collection of elements. The resulting constructs
64are conceptually cleaner than manual compositions, and often perform much better.
65An important design decision has been taken that the indices of a given
66<code>multi_index_container</code> instantiation be specified at compile time: this
67gives ample room for static type checking and code optimization.
68</p>
69
70<p>
71Boost.MultiIndex takes inspiration from basic concepts of indexing arising in the
72theory of relational databases, though it is not intended to provide a full-fledged
73relational database framework. <code>multi_index_container</code> integrates seamlessly
74into the STL container/algorithm design, and features some extra capabilities regarding
75lookup operations and element updating which are useful extensions even for
76single-indexed containers.
77</p>
78
79<p align="center">
80<img src="multi_index_cont_example.png"
81alt="diagram of a multi_index_container with three indices"
82width="600" height="304"><br>
83<b>Fig. 1: Diagram of a <code>multi_index_container</code> with three indices.</b>
84</p>
85
86<p>
87The figure above depicts a <code>multi_index_container</code> composed of three indices:
88the first two present a set-like interface to the elements sorted by
89shape and id, respectively, while the latter index provides the functionality
90of a bidirectional list in the spirit of <code>std::list</code>. These
91indices act as "views" to the internal collection of elements, but they do not only
92provide read access to the set: insertion/deletion methods are also implemented much
93as those of <code>std::set</code>s or <code>std::list</code>s. Insertion of an
94element through one given index will only succeed if the uniqueness constraints of all
95indices are met.
96</p>
97
98<h2>
99<a name="namespace">Namespace</a>
100</h2>
101
102<p>
103All the public types of Boost.MultiIndex reside in namespace <code>::boost::multi_index</code>.
104Additionaly, the main class template <code>multi_index_container</code> and global functions
105<code>get</code> and <code>project</code> are lifted to namespace <code>::boost</code>
106by means of <code>using</code> declarations. For brevity of exposition, the fragments
107of code in the documentation are written as if the following declarations were in effect:
108</p>
109
110<blockquote><pre>
111<span class=keyword>using</span> <span class=keyword>namespace</span> <span class=special>::</span><span class=identifier>boost</span><span class=special>;</span>
112<span class=keyword>using</span> <span class=keyword>namespace</span> <span class=special>::</span><span class=identifier>boost</span><span class=special>::</span><span class=identifier>multi_index</span><span class=special>;</span>
113</pre></blockquote>
114
115<hr>
116
117<div class="prev_link"><a href="../index.html"><img src="../prev.gif" alt="index" border="0"><br>
118Index
119</a></div>
120<div class="up_link"><a href="../index.html"><img src="../up.gif" alt="index" border="0"><br>
121Index
122</a></div>
123<div class="next_link"><a href="basics.html"><img src="../next.gif" alt="basics" border="0"><br>
124Basics
125</a></div><br clear="all" style="clear: all;">
126
127<br>
128
129<p>Revised February 21st 2006</p>
130
131<p>&copy; Copyright 2003-2006 Joaqu&iacute;n M L&oacute;pez Mu&ntilde;oz.
132Distributed under the Boost Software
133License, Version 1.0. (See accompanying file <a href="../../../../LICENSE_1_0.txt">
134LICENSE_1_0.txt</a> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">
135http://www.boost.org/LICENSE_1_0.txt</a>)
136</p>
137
138</body>
139</html>