]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/libstdc++-v3/contrib/libstdc++-v3-4.1.0/docs/html/ext/pb_assoc/tutorial.html
update
[l4.git] / l4 / pkg / libstdc++-v3 / contrib / libstdc++-v3-4.1.0 / docs / html / ext / pb_assoc / tutorial.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2 <HTML>
3 <HEAD>
4 <TITLE>Short Tutorial</TITLE>
5 <META NAME="Generator" content="Microsoft Visual Studio .NET 7.1">
6 <base target = "content">
7 </HEAD>
8 <BODY>
9 <H1>Short Tutorial</H1>
10
11 <p>
12     Following is a short tutorial introducing the main points of <tt>pb_assoc</tt>. It
13 is organized as follows.</p>
14 <ol>
15     <li><a href = "#general_use">Basic Use of Maps</a></li>
16 </ol>
17
18
19
20
21
22
23
24 <h2><a name = "general_use">Basic Use of Maps</a></h2>
25
26 <p>
27     For the greater part, using <tt>pb_assoc</tt>'s maps is similar
28 to using those of the STL. For example, the following shows a collision-chaining container mapping integers to characters.
29
30 <pre>
31 <a href = "cc_hash_assoc_cntnr.html">cc_hash_assoc_cntnr</a>&lt;<b>int</b>, <b>char</b>&gt; c;
32
33 c[2] = 'b';
34
35 assert(c.find(1) == c.end());
36 </pre>
37
38 <p>
39         <a href="interface.html#containers">Inteface::Containers</a> describes the containers supported. <a href = "../example/basic_map_example.cpp"><tt>basic_map_example.cpp</tt></a>
40 shows an example.
41 </p>
42
43
44 <h2><a name = "ms">Other Mapping Semantics</a></h2>
45
46 <p>
47         <tt>pb_assoc</tt>       does not contain separate containers for different mapping semantics,
48 as the STL does (<i>e.g.</i>, <tt>std::map</tt> and <tt>std::multimap</tt>). Rather, containers are parameterized by a <tt>Data</tt> parameter, and this parameter is a policy for the mapping semantics.
49 </p>
50
51 <p>
52         Instantiating the <tt>Data</tt> parameter by
53 <a href = "null_data_type.html"><tt>null_data_type</tt></a>
54 makes a &quot;set&quot;. For example, the following shows a collision-chaining container storing integers.
55
56 <pre>
57 <a href = "cc_hash_assoc_cntnr.html">cc_hash_assoc_cntnr</a>&lt;<b>int</b>, <a href = "null_data_type.html">null_data_type</a>&gt; c;
58
59 c.insert(2);
60
61 assert(c.find(1) == c.end());
62 </pre>
63 </p>
64
65 </BODY>
66 </HTML>