OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [libstdc++-v3/] [docs/] [html/] [ext/] [pb_assoc/] [tutorial.html] - Rev 20

Compare with Previous | Blame | View Log

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Short Tutorial</TITLE>
<META NAME="Generator" content="Microsoft Visual Studio .NET 7.1">
<base target = "content">
</HEAD>
<BODY>
<H1>Short Tutorial</H1>
 
<p>
    Following is a short tutorial introducing the main points of <tt>pb_assoc</tt>. It
is organized as follows.</p>
<ol>
    <li><a href = "#general_use">Basic Use of Maps</a></li>
</ol>
 
 
 
 
 
 
 
<h2><a name = "general_use">Basic Use of Maps</a></h2>
 
<p>
    For the greater part, using <tt>pb_assoc</tt>'s maps is similar
to using those of the STL. For example, the following shows a collision-chaining container mapping integers to characters.
 
<pre>
<a href = "cc_hash_assoc_cntnr.html">cc_hash_assoc_cntnr</a>&lt;<b>int</b>, <b>char</b>&gt; c;
 
c[2] = 'b';
 
assert(c.find(1) == c.end());
</pre>
 
<p>
	<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>
shows an example.
</p>
 
 
<h2><a name = "ms">Other Mapping Semantics</a></h2>
 
<p>
	<tt>pb_assoc</tt>	does not contain separate containers for different mapping semantics,
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.
</p>
 
<p>
	Instantiating the <tt>Data</tt> parameter by
<a href = "null_data_type.html"><tt>null_data_type</tt></a>
makes a &quot;set&quot;. For example, the following shows a collision-chaining container storing integers.
 
<pre>
<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;
 
c.insert(2);
 
assert(c.find(1) == c.end());
</pre>
</p>
 
</BODY>
</HTML>
 

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.