<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><title>Concepts</title><meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1"><meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"></head><body bgcolor = "white"><h1>Concepts</h1><p>Following are some concepts used throughout the documentation.</p><ol><li><a href = "#concepts_null_policies">Null Policy Classes</a></li><li><a href = "#concepts_find_and_range_iterators">Find and Range Iterators</a></li><li><a href = "#concepts_mapping_levels">Mapping Levels</a></li></ol><h2><a name = "concepts_null_policies">Null Policy Classes</a></h2><p>Associative containers are typically parameterized by various policies.For example, a hash-based associativecontainer is parameterized by a hash-functor, transforming each key into an non-negative numerical type. Each such value is then further mapped into a position within the table.The mapping of a key into a position within the table is therefore a two-step process.</p><p>In somecases, instantiations are <i>redundant</i>. For example, when the keys are integers, it is possible to use a <i>redundant</i>hash policy, which transforms each key into its value.</p><p>In some other cases, these policies are <i>irrelevent</i>. For example,a hash-based associative container might transform keys into positions withina table by a different method than the two-step method described above. In such a case, the hash functor is simply irrelevent.</p><p><tt>pb_assoc</tt> uses special pre-defined "null policies" classesfor these cases. Some null policies in <tt>pb_assoc</tt>are:</p><ol><li <a href = "null_data_type.html"><tt>null_data_type</tt></a></li><li><a href = "null_node_updator.html"><tt>null_node_updator</tt></a></li><li><a href = "null_hash_fn.html"><tt>null_hash_fn</tt></a></li><li><a href = "null_probe_fn.html"><tt>null_probe_fn</tt></a></li></ol><p>A "set" in <tt>pb_assoc</tt> is an associative container with its <tt>Data_Parameter</tt> instantiated by<a href = "null_data_type.html"><tt>null_data_type</tt></a>.<a href = "tree_based_containers.html#node_invariants.html">Tree-Based Containers::Node Invariants</a>explains another case where a null policy is needed.</p><h2><a name = "concepts_find_and_range_iterators">Find and Range Methods and Iterators</a></h2><p>Associative containers allow access to their elements via iterators. <i>E.g.</i>,<tt>find</tt> returns an iterator to an element with a given key and<tt>begin</tt> returns an iterator to the first element in the container.</p><p>In general, there are two types of methods: <i>find types</i>, and <i>range types</i>.Find-typemethods return iterators corresponding to elements which have been found in some sense, asthe container searched for them in order to access them (<i>i.e.</i>, via the<tt>find</tt> method) or searched for their location in order to insert them(<i>i.e.</i>, via the <tt>insert</tt> method). Range-type methods return iteratorswhich can be used to traverse the range of all stored elements, (<i>i.e.</i>, via the<tt>begin</tt> and <tt>end</tt> methods).</p><p>Correspondingly, in <tt>pb_assoc</tt> there are two types of iterators: <i>find type</i>iterators are returned by find methods, and range iterators are returned by range methods. For example,if <tt>T</tt> is any associative container with integer keys, and <tt>t</tt>is a container of type <tt>T</tt>,then the following snippet is valid:</p><pre><b>typename</b> T::find_iterator it0 = t.find(3);<b>typename</b> T::const_find_iterator it0 = t.find(3);<b>typename</b> T::iterator it0 = t.begin();<b>typename</b> T::const_iterator it0 = t.begin();</pre><p>This is motivated and explained further in<a href = "ds_gen.html#find_range">Data-Structure Genericity::Find-Type and Range-Type Methods and Iterators</a>, which also explains the relationship between find-type and range-type iterators.</p><h2><a href = "#concepts_mapping_levels">Mapping Levels</a></h2><p>In <tt>pb_assoc</tt> "multimaps" are"maps" of "sets". While this design allows efficientoperations, it makes for cumbersome use at points. For example a"multimap" of integers to characters does notdirectly support <tt>inser(std::make_pair(2, 'b')</tt>, since 2 is mappedto a "set" of characters, and not to a character.</p><p>Consequently, <tt>pb_assoc</tt> contains a rebind-like mechanism so thatcontainers can support such operations. To dispel ambiguity, container types areassigned mapping levels. "Maps" and "sets" havea mapping level 1, since they use a single association level. The "multimap"above has a mapping level 2, since it uses two association levels: one for integers, and one for characters. The rebind mechanism can be used to alter the association level. This is described in<a href = "ms_gen.html">Mapping Semantics</a>.</p></body></html>