Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/mpl/doc/refmanual/associative-sequence.html @ 29

Last change on this file since 29 was 29, checked in by landauf, 17 years ago

updated boost from 1_33_1 to 1_34_1

File size: 12.2 KB
Line 
1<?xml version="1.0" encoding="utf-8" ?>
2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4<!-- Copyright Aleksey Gurtovoy 2006. Distributed under the Boost -->
5<!-- 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<head>
8<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
9<meta name="generator" content="Docutils 0.3.6: http://docutils.sourceforge.net/" />
10<title>The MPL Reference Manual: Associative Sequence</title>
11<link rel="stylesheet" href="../style.css" type="text/css" />
12</head>
13<body class="docframe refmanual">
14<table class="header"><tr class="header"><td class="header-group navigation-bar"><span class="navigation-group"><a href="./back-extensible-sequence.html" class="navigation-link">Prev</a>&nbsp;<a href="./extensible-associative.html" class="navigation-link">Next</a></span><span class="navigation-group-separator">&nbsp;|&nbsp;</span><span class="navigation-group"><a href="./back-extensible-sequence.html" class="navigation-link">Back</a>&nbsp;<a href="./extensible-associative.html" class="navigation-link">Along</a></span><span class="navigation-group-separator">&nbsp;|&nbsp;</span><span class="navigation-group"><a href="./concepts.html" class="navigation-link">Up</a>&nbsp;<a href="../refmanual.html" class="navigation-link">Home</a></span><span class="navigation-group-separator">&nbsp;|&nbsp;</span><span class="navigation-group"><a href="./refmanual_toc.html" class="navigation-link">Full TOC</a></span></td>
15<td class="header-group page-location"><a href="../refmanual.html" class="navigation-link">Front Page</a> / <a href="./sequences.html" class="navigation-link">Sequences</a> / <a href="./concepts.html" class="navigation-link">Concepts</a> / <a href="./associative-sequence.html" class="navigation-link">Associative Sequence</a></td>
16</tr></table><div class="header-separator"></div>
17<div class="section" id="associative-sequence">
18<h1><a class="toc-backref" href="./concepts.html#id330" name="associative-sequence">Associative Sequence</a></h1>
19<div class="section" id="associative-description">
20<h3><a class="subsection-title" href="#description" name="description">Description</a></h3>
21<p>An <a class="reference" href="./associative-sequence.html">Associative Sequence</a> is a <a class="reference" href="./forward-sequence.html">Forward Sequence</a> that allows efficient retrieval of
22elements based on keys. Unlike associative containers in the C++ Standard Library,
23MPL associative sequences have no associated ordering relation. Instead,
24<em>type identity</em> is used to impose an equivalence relation on keys, and the
25order in which sequence elements are traversed during iteration is left
26unspecified.</p>
27</div>
28<div class="section" id="associative-definitions">
29<h3><a class="subsection-title" href="#definitions" name="definitions">Definitions</a></h3>
30<a class="target" id="key-part" name="key-part"></a><a class="target" id="value-part" name="value-part"></a><ul class="simple">
31<li>A <em>key</em> is a part of the element type used to identify and retrieve
32the element within the sequence.</li>
33<li>A <em>value</em> is a part of the element type retrievied from the sequence
34by its key.</li>
35</ul>
36</div>
37<div class="section" id="associative-expression-requirements">
38<h3><a class="subsection-title" href="#expression-requirements" name="expression-requirements">Expression requirements</a></h3>
39<p>In the following table and subsequent specifications, <tt class="literal"><span class="pre">s</span></tt> is an <a class="reference" href="./associative-sequence.html">Associative Sequence</a>,
40<tt class="literal"><span class="pre">x</span></tt> is a sequence element, and <tt class="literal"><span class="pre">k</span></tt> and <tt class="literal"><span class="pre">def</span></tt> are arbitrary types.</p>
41<p>In addition to the requirements defined in <a class="reference" href="./forward-sequence.html">Forward Sequence</a>,
42the following must be met:</p>
43<table border="1" class="table">
44<colgroup>
45<col width="33%" />
46<col width="38%" />
47<col width="29%" />
48</colgroup>
49<thead valign="bottom">
50<tr><th>Expression</th>
51<th>Type</th>
52<th>Complexity</th>
53</tr>
54</thead>
55<tbody valign="top">
56<tr><td><tt class="literal"><span class="pre"><a href="./has-key.html" class="identifier">has_key</a>&lt;s,k&gt;::type</span></tt></td>
57<td>Boolean <a class="reference" href="./integral-constant.html">Integral Constant</a></td>
58<td>Amortized constant time</td>
59</tr>
60<tr><td><tt class="literal"><span class="pre"><a href="./count.html" class="identifier">count</a>&lt;s,k&gt;::type</span></tt></td>
61<td><a class="reference" href="./integral-constant.html">Integral Constant</a></td>
62<td>Amortized constant time</td>
63</tr>
64<tr><td><tt class="literal"><span class="pre"><a href="./order.html" class="identifier">order</a>&lt;s,k&gt;::type</span></tt></td>
65<td><a class="reference" href="./integral-constant.html">Integral Constant</a> or <tt class="literal"><span class="pre"><a href="./void.html" class="identifier">void_</a></span></tt></td>
66<td>Amortized constant time</td>
67</tr>
68<tr><td><tt class="literal"><span class="pre"><a href="./at.html" class="identifier">at</a>&lt;s,k&gt;::type</span></tt></td>
69<td>Any type</td>
70<td>Amortized constant time</td>
71</tr>
72<tr><td><tt class="literal"><span class="pre"><a href="./at.html" class="identifier">at</a>&lt;s,k,def&gt;::type</span></tt></td>
73<td>Any type</td>
74<td>Amortized constant time</td>
75</tr>
76<tr><td><tt class="literal"><span class="pre"><a href="./key-type.html" class="identifier">key_type</a>&lt;s,x&gt;::type</span></tt></td>
77<td>Any type</td>
78<td>Amortized constant time</td>
79</tr>
80<tr><td><tt class="literal"><span class="pre"><a href="./value-type.html" class="identifier">value_type</a>&lt;s,x&gt;::type</span></tt></td>
81<td>Any type</td>
82<td>Amortized constant time</td>
83</tr>
84</tbody>
85</table>
86</div>
87<div class="section" id="associative-expression-semantics">
88<h3><a class="subsection-title" href="#expression-semantics" name="expression-semantics">Expression semantics</a></h3>
89<p>The semantics of an expression are defined only
90where they differ from, or are not defined in <a class="reference" href="./forward-sequence.html">Forward Sequence</a>.</p>
91<table border="1" class="table">
92<colgroup>
93<col width="33%" />
94<col width="67%" />
95</colgroup>
96<thead valign="bottom">
97<tr><th>Expression</th>
98<th>Semantics</th>
99</tr>
100</thead>
101<tbody valign="top">
102<tr><td><tt class="literal"><span class="pre"><a href="./has-key.html" class="identifier">has_key</a>&lt;s,k&gt;::type</span></tt></td>
103<td>A boolean <a class="reference" href="./integral-constant.html">Integral Constant</a> <tt class="literal"><span class="pre">c</span></tt> such that
104<tt class="literal"><span class="pre">c::value</span> <span class="pre">==</span> <span class="pre">true</span></tt> if and only if there is one or more
105elements with the key <tt class="literal"><span class="pre">k</span></tt> in <tt class="literal"><span class="pre">s</span></tt>; see <a class="refentry reference" href="./has-key.html"><tt class="refentry literal"><span class="pre">has_key</span></tt></a>.</td>
106</tr>
107<tr><td><tt class="literal"><span class="pre"><a href="./count.html" class="identifier">count</a>&lt;s,k&gt;::type</span></tt></td>
108<td>The number of elements with the key <tt class="literal"><span class="pre">k</span></tt> in <tt class="literal"><span class="pre">s</span></tt>;
109see <a class="refentry reference" href="./count.html"><tt class="refentry literal"><span class="pre">count</span></tt></a>.</td>
110</tr>
111<tr><td><tt class="literal"><span class="pre"><a href="./order.html" class="identifier">order</a>&lt;s,k&gt;::type</span></tt></td>
112<td>A unique unsigned <a class="reference" href="./integral-constant.html">Integral Constant</a> associated
113with the key <tt class="literal"><span class="pre">k</span></tt> in the sequence <tt class="literal"><span class="pre">s</span></tt>; see <a class="refentry reference" href="./order.html"><tt class="refentry literal"><span class="pre">order</span></tt></a>.</td>
114</tr>
115<tr><td><pre class="first last literal-block">
116<a href="./at.html" class="identifier">at</a>&lt;s,k&gt;::type
117<a href="./at.html" class="identifier">at</a>&lt;s,k,def&gt;::type
118</pre>
119</td>
120<td>The first element associated with the key <tt class="literal"><span class="pre">k</span></tt>
121in the sequence <tt class="literal"><span class="pre">s</span></tt>; see <a class="refentry reference" href="./at.html"><tt class="refentry literal"><span class="pre">at</span></tt></a>.</td>
122</tr>
123<tr><td><tt class="literal"><span class="pre"><a href="./key-type.html" class="identifier">key_type</a>&lt;s,x&gt;::type</span></tt></td>
124<td>The key part of the element <tt class="literal"><span class="pre">x</span></tt> that would be
125used to identify <tt class="literal"><span class="pre">x</span></tt> in <tt class="literal"><span class="pre">s</span></tt>; see <a class="refentry reference" href="./key-type.html"><tt class="refentry literal"><span class="pre">key_type</span></tt></a>.</td>
126</tr>
127<tr><td><tt class="literal"><span class="pre"><a href="./value-type.html" class="identifier">value_type</a>&lt;s,x&gt;::type</span></tt></td>
128<td>The value part of the element <tt class="literal"><span class="pre">x</span></tt> that would be
129used for <tt class="literal"><span class="pre">x</span></tt> in <tt class="literal"><span class="pre">s</span></tt>; see <a class="refentry reference" href="./value-type.html"><tt class="refentry literal"><span class="pre">value_type</span></tt></a>.</td>
130</tr>
131</tbody>
132</table>
133<!-- Invariants
134- - - - - - - - - -
135
136For any associative sequence ``s`` the following invariants always hold:
137
138 * ??? -->
139</div>
140<div class="section" id="associative-models">
141<h3><a class="subsection-title" href="#models" name="models">Models</a></h3>
142<ul class="simple">
143<li><a class="refentry reference" href="./set.html"><tt class="refentry literal"><span class="pre">set</span></tt></a></li>
144<li><a class="refentry reference" href="./map.html"><tt class="refentry literal"><span class="pre">map</span></tt></a></li>
145</ul>
146<!-- * |multiset| -->
147</div>
148<div class="section" id="associative-see-also">
149<h3><a class="subsection-title" href="#see-also" name="see-also">See also</a></h3>
150<p><a class="reference" href="./sequences.html">Sequences</a>, <a class="reference" href="./extensible-associative.html">Extensible Associative Sequence</a>, <a class="refentry reference" href="./has-key.html"><tt class="refentry literal"><span class="pre">has_key</span></tt></a>, <a class="refentry reference" href="./count.html"><tt class="refentry literal"><span class="pre">count</span></tt></a>, <a class="refentry reference" href="./order.html"><tt class="refentry literal"><span class="pre">order</span></tt></a>, <a class="refentry reference" href="./at.html"><tt class="refentry literal"><span class="pre">at</span></tt></a>, <a class="refentry reference" href="./key-type.html"><tt class="refentry literal"><span class="pre">key_type</span></tt></a>, <a class="refentry reference" href="./value-type.html"><tt class="refentry literal"><span class="pre">value_type</span></tt></a></p>
151<!-- modtime: November 13, 2004 00:51:14 +0000 -->
152<!-- Sequences/Concepts//Extensible Associative Sequence |80 -->
153</div>
154</div>
155
156<div class="footer-separator"></div>
157<table class="footer"><tr class="footer"><td class="header-group navigation-bar"><span class="navigation-group"><a href="./back-extensible-sequence.html" class="navigation-link">Prev</a>&nbsp;<a href="./extensible-associative.html" class="navigation-link">Next</a></span><span class="navigation-group-separator">&nbsp;|&nbsp;</span><span class="navigation-group"><a href="./back-extensible-sequence.html" class="navigation-link">Back</a>&nbsp;<a href="./extensible-associative.html" class="navigation-link">Along</a></span><span class="navigation-group-separator">&nbsp;|&nbsp;</span><span class="navigation-group"><a href="./concepts.html" class="navigation-link">Up</a>&nbsp;<a href="../refmanual.html" class="navigation-link">Home</a></span><span class="navigation-group-separator">&nbsp;|&nbsp;</span><span class="navigation-group"><a href="./refmanual_toc.html" class="navigation-link">Full TOC</a></span></td>
158</tr></table></body>
159</html>
Note: See TracBrowser for help on using the repository browser.