[DEV] add v1.76.0

This commit is contained in:
2021-10-05 21:37:46 +02:00
parent a97e9ae7d4
commit d0115b733d
45133 changed files with 4744437 additions and 1026325 deletions

View File

@@ -0,0 +1,51 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Bibliography</title>
<link rel="stylesheet" href="../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../unordered.html" title="Chapter 45. Boost.Unordered">
<link rel="prev" href="../boost/unordered_multimap.html" title="Class template unordered_multimap">
<link rel="next" href="../variant.html" title="Chapter 46. Boost.Variant">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
<td align="center"><a href="../../../index.html">Home</a></td>
<td align="center"><a href="../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="../boost/unordered_multimap.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../unordered.html"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../variant.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="unordered.bibliography"></a>Bibliography</h2></div></div></div>
<div class="bibliography">
<div class="titlepage"><div><div><h3 class="title">
<a name="id-1.3.46.11.2"></a>Bibliography</h3></div></div></div>
<div class="biblioentry">
<a name="id-1.3.46.11.2.1"></a><p><span class="biblioset"><i>C/C++ Users Journal</i>. <span class="date">February, 2006. </span></span><span class="biblioset"><span class="authorgroup"><span class="firstname">Pete</span> <span class="surname">Becker</span>. </span><a href="http://www.ddj.com/cpp/184402066" target="_top">STL and TR1: Part III - Unordered containers</a>”. </span><p>An introducation to the standard unordered containers.</p></p>
</div>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2003, 2004 Jeremy B. Maitin-Shepard<br>Copyright © 2005-2008 Daniel
James<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="../boost/unordered_multimap.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../unordered.html"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../variant.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>

View File

@@ -0,0 +1,317 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>The Data Structure</title>
<link rel="stylesheet" href="../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../unordered.html" title="Chapter 45. Boost.Unordered">
<link rel="prev" href="../unordered.html" title="Chapter 45. Boost.Unordered">
<link rel="next" href="hash_equality.html" title="Equality Predicates and Hash Functions">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
<td align="center"><a href="../../../index.html">Home</a></td>
<td align="center"><a href="../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="../unordered.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../unordered.html"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="hash_equality.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="unordered.buckets"></a><a class="link" href="buckets.html" title="The Data Structure">The Data Structure</a>
</h2></div></div></div>
<p>
The containers are made up of a number of 'buckets', each of which can contain
any number of elements. For example, the following diagram shows an <code class="computeroutput"><a class="link" href="../boost/unordered_set.html" title="Class template unordered_set">unordered_set</a></code> with 7 buckets containing
5 elements, <code class="computeroutput"><span class="identifier">A</span></code>, <code class="computeroutput"><span class="identifier">B</span></code>, <code class="computeroutput"><span class="identifier">C</span></code>,
<code class="computeroutput"><span class="identifier">D</span></code> and <code class="computeroutput"><span class="identifier">E</span></code>
(this is just for illustration, containers will typically have more buckets).
</p>
<p>
<span class="inlinemediaobject"><img src="../../../libs/unordered/doc/diagrams/buckets.png" align="middle"></span>
</p>
<p>
In order to decide which bucket to place an element in, the container applies
the hash function, <code class="computeroutput"><span class="identifier">Hash</span></code>, to
the element's key (for <code class="computeroutput"><span class="identifier">unordered_set</span></code>
and <code class="computeroutput"><span class="identifier">unordered_multiset</span></code> the
key is the whole element, but is referred to as the key so that the same terminology
can be used for sets and maps). This returns a value of type <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span></code>.
<code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span></code> has a much greater range of values
then the number of buckets, so the container applies another transformation
to that value to choose a bucket to place the element in.
</p>
<p>
Retrieving the elements for a given key is simple. The same process is applied
to the key to find the correct bucket. Then the key is compared with the elements
in the bucket to find any elements that match (using the equality predicate
<code class="computeroutput"><span class="identifier">Pred</span></code>). If the hash function
has worked well the elements will be evenly distributed amongst the buckets
so only a small number of elements will need to be examined.
</p>
<p>
There is <a class="link" href="hash_equality.html" title="Equality Predicates and Hash Functions">more information on hash functions
and equality predicates in the next section</a>.
</p>
<p>
You can see in the diagram that <code class="computeroutput"><span class="identifier">A</span></code>
&amp; <code class="computeroutput"><span class="identifier">D</span></code> have been placed in
the same bucket. When looking for elements in this bucket up to 2 comparisons
are made, making the search slower. This is known as a collision. To keep things
fast we try to keep collisions to a minimum.
</p>
<p>
</p>
<div class="table">
<a name="id-1.3.46.4.8.1"></a><p class="title"><b>Table 45.1. Methods for Accessing Buckets</b></p>
<div class="table-contents"><table class="table" summary="Methods for Accessing Buckets">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th><p>Method</p></th>
<th><p>Description</p></th>
</tr></thead>
<tbody>
<tr>
<td><code class="computeroutput"><span class="identifier">size_type</span> <span class="identifier">bucket_count</span><span class="special">()</span> <span class="keyword">const</span></code></td>
<td>The
number of buckets.</td>
</tr>
<tr>
<td><code class="computeroutput"><span class="identifier">size_type</span> <span class="identifier">max_bucket_count</span><span class="special">()</span>
<span class="keyword">const</span></code></td>
<td>An upper bound on the number of
buckets.</td>
</tr>
<tr>
<td><code class="computeroutput"><span class="identifier">size_type</span> <span class="identifier">bucket_size</span><span class="special">(</span><span class="identifier">size_type</span> <span class="identifier">n</span><span class="special">)</span> <span class="keyword">const</span></code></td>
<td>The
number of elements in bucket <code class="computeroutput"><span class="identifier">n</span></code>.</td>
</tr>
<tr>
<td><code class="computeroutput"><span class="identifier">size_type</span> <span class="identifier">bucket</span><span class="special">(</span><span class="identifier">key_type</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">k</span><span class="special">)</span> <span class="keyword">const</span></code></td>
<td>Returns
the index of the bucket which would contain <code class="computeroutput"><span class="identifier">k</span></code>.</td>
</tr>
<tr>
<td><code class="computeroutput"><span class="identifier">local_iterator</span> <span class="identifier">begin</span><span class="special">(</span><span class="identifier">size_type</span> <span class="identifier">n</span><span class="special">);</span></code></td>
<td rowspan="6">Return
begin and end iterators for bucket <code class="computeroutput"><span class="identifier">n</span></code>.</td>
</tr>
<tr><td><code class="computeroutput"><span class="identifier">local_iterator</span> <span class="identifier">end</span><span class="special">(</span><span class="identifier">size_type</span> <span class="identifier">n</span><span class="special">);</span></code></td></tr>
<tr><td><code class="computeroutput"><span class="identifier">const_local_iterator</span> <span class="identifier">begin</span><span class="special">(</span><span class="identifier">size_type</span> <span class="identifier">n</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></code></td></tr>
<tr><td><code class="computeroutput"><span class="identifier">const_local_iterator</span>
<span class="identifier">end</span><span class="special">(</span><span class="identifier">size_type</span> <span class="identifier">n</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></code></td></tr>
<tr><td><code class="computeroutput"><span class="identifier">const_local_iterator</span> <span class="identifier">cbegin</span><span class="special">(</span><span class="identifier">size_type</span> <span class="identifier">n</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></code></td></tr>
<tr><td><code class="computeroutput"><span class="identifier">const_local_iterator</span>
<span class="identifier">cend</span><span class="special">(</span><span class="identifier">size_type</span> <span class="identifier">n</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></code></td></tr>
</tbody>
</table></div>
</div>
<p><br class="table-break">
</p>
<h3>
<a name="unordered.buckets.h0"></a>
<span class="phrase"><a name="unordered.buckets.controlling_the_number_of_buckets"></a></span><a class="link" href="buckets.html#unordered.buckets.controlling_the_number_of_buckets">Controlling
the number of buckets</a>
</h3>
<p>
As more elements are added to an unordered associative container, the number
of elements in the buckets will increase causing performance to degrade. To
combat this the containers increase the bucket count as elements are inserted.
You can also tell the container to change the bucket count (if required) by
calling <code class="computeroutput"><span class="identifier">rehash</span></code>.
</p>
<p>
The standard leaves a lot of freedom to the implementer to decide how the number
of buckets is chosen, but it does make some requirements based on the container's
'load factor', the average number of elements per bucket. Containers also have
a 'maximum load factor' which they should try to keep the load factor below.
</p>
<p>
You can't control the bucket count directly but there are two ways to influence
it:
</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
Specify the minimum number of buckets when constructing a container or
when calling <code class="computeroutput"><span class="identifier">rehash</span></code>.
</li>
<li class="listitem">
Suggest a maximum load factor by calling <code class="computeroutput"><span class="identifier">max_load_factor</span></code>.
</li>
</ul></div>
<p>
<code class="computeroutput"><span class="identifier">max_load_factor</span></code> doesn't let
you set the maximum load factor yourself, it just lets you give a <span class="emphasis"><em>hint</em></span>.
And even then, the draft standard doesn't actually require the container to
pay much attention to this value. The only time the load factor is <span class="emphasis"><em>required</em></span>
to be less than the maximum is following a call to <code class="computeroutput"><span class="identifier">rehash</span></code>.
But most implementations will try to keep the number of elements below the
max load factor, and set the maximum load factor to be the same as or close
to the hint - unless your hint is unreasonably small or large.
</p>
<div class="table">
<a name="unordered.buckets.bucket_size"></a><p class="title"><b>Table 45.2. Methods for Controlling Bucket Size</b></p>
<div class="table-contents"><table class="table" summary="Methods for Controlling Bucket Size">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Method
</p>
</th>
<th>
<p>
Description
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">X</span><span class="special">(</span><span class="identifier">size_type</span> <span class="identifier">n</span><span class="special">)</span></code>
</p>
</td>
<td>
<p>
Construct an empty container with at least <code class="computeroutput"><span class="identifier">n</span></code>
buckets (<code class="computeroutput"><span class="identifier">X</span></code> is the
container type).
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">X</span><span class="special">(</span><span class="identifier">InputIterator</span> <span class="identifier">i</span><span class="special">,</span> <span class="identifier">InputIterator</span>
<span class="identifier">j</span><span class="special">,</span>
<span class="identifier">size_type</span> <span class="identifier">n</span><span class="special">)</span></code>
</p>
</td>
<td>
<p>
Construct an empty container with at least <code class="computeroutput"><span class="identifier">n</span></code>
buckets and insert elements from the range [<code class="computeroutput"><span class="identifier">i</span></code>,
<code class="computeroutput"><span class="identifier">j</span></code>) (<code class="computeroutput"><span class="identifier">X</span></code> is the container type).
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="keyword">float</span> <span class="identifier">load_factor</span><span class="special">()</span> <span class="keyword">const</span></code>
</p>
</td>
<td>
<p>
The average number of elements per bucket.
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="keyword">float</span> <span class="identifier">max_load_factor</span><span class="special">()</span> <span class="keyword">const</span></code>
</p>
</td>
<td>
<p>
Returns the current maximum load factor.
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="keyword">float</span> <span class="identifier">max_load_factor</span><span class="special">(</span><span class="keyword">float</span> <span class="identifier">z</span><span class="special">)</span></code>
</p>
</td>
<td>
<p>
Changes the container's maximum load factor, using <code class="computeroutput"><span class="identifier">z</span></code> as a hint.
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="keyword">void</span> <span class="identifier">rehash</span><span class="special">(</span><span class="identifier">size_type</span>
<span class="identifier">n</span><span class="special">)</span></code>
</p>
</td>
<td>
<p>
Changes the number of buckets so that there at least <code class="computeroutput"><span class="identifier">n</span></code> buckets, and so that the load
factor is less than the maximum load factor.
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><h3>
<a name="unordered.buckets.h1"></a>
<span class="phrase"><a name="unordered.buckets.iterator_invalidation"></a></span><a class="link" href="buckets.html#unordered.buckets.iterator_invalidation">Iterator
Invalidation</a>
</h3>
<p>
It is not specified how member functions other than <code class="computeroutput"><span class="identifier">rehash</span></code>
affect the bucket count, although <code class="computeroutput"><span class="identifier">insert</span></code>
is only allowed to invalidate iterators when the insertion causes the load
factor to be greater than or equal to the maximum load factor. For most implementations
this means that <code class="computeroutput"><span class="identifier">insert</span></code> will
only change the number of buckets when this happens. While iterators can be
invalidated by calls to <code class="computeroutput"><span class="identifier">insert</span></code>
and <code class="computeroutput"><span class="identifier">rehash</span></code>, pointers and references
to the container's elements are never invalidated.
</p>
<p>
In a similar manner to using <code class="computeroutput"><span class="identifier">reserve</span></code>
for <code class="computeroutput"><span class="identifier">vector</span></code>s, it can be a good
idea to call <code class="computeroutput"><span class="identifier">rehash</span></code> before
inserting a large number of elements. This will get the expensive rehashing
out of the way and let you store iterators, safe in the knowledge that they
won't be invalidated. If you are inserting <code class="computeroutput"><span class="identifier">n</span></code>
elements into container <code class="computeroutput"><span class="identifier">x</span></code>,
you could first call:
</p>
<pre class="programlisting"><span class="identifier">x</span><span class="special">.</span><span class="identifier">rehash</span><span class="special">((</span><span class="identifier">x</span><span class="special">.</span><span class="identifier">size</span><span class="special">()</span> <span class="special">+</span> <span class="identifier">n</span><span class="special">)</span> <span class="special">/</span> <span class="identifier">x</span><span class="special">.</span><span class="identifier">max_load_factor</span><span class="special">());</span>
</pre>
<div class="blurb">
<div class="titlepage"><div><div><p class="title"><b></b></p></div></div></div>
<p>
Note: <code class="computeroutput"><span class="identifier">rehash</span></code>'s argument is
the minimum number of buckets, not the number of elements, which is why the
new size is divided by the maximum load factor.
</p>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2003, 2004 Jeremy B. Maitin-Shepard<br>Copyright © 2005-2008 Daniel
James<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="../unordered.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../unordered.html"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="hash_equality.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>

View File

@@ -0,0 +1,775 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Change Log</title>
<link rel="stylesheet" href="../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../unordered.html" title="Chapter 45. Boost.Unordered">
<link rel="prev" href="rationale.html" title="Implementation Rationale">
<link rel="next" href="reference.html" title="Reference">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
<td align="center"><a href="../../../index.html">Home</a></td>
<td align="center"><a href="../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="rationale.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../unordered.html"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="reference.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="unordered.changes"></a><a class="link" href="changes.html" title="Change Log">Change Log</a>
</h2></div></div></div>
<h3>
<a name="unordered.changes.h0"></a>
<span class="phrase"><a name="unordered.changes.review_version"></a></span><a class="link" href="changes.html#unordered.changes.review_version">Review
Version</a>
</h3>
<p>
Initial review version, for the review conducted from 7th December 2007 to
16th December 2007.
</p>
<h3>
<a name="unordered.changes.h1"></a>
<span class="phrase"><a name="unordered.changes.1_35_0_add_on___31st_march_2008"></a></span><a class="link" href="changes.html#unordered.changes.1_35_0_add_on___31st_march_2008">1.35.0
Add-on - 31st March 2008</a>
</h3>
<p>
Unofficial release uploaded to vault, to be used with Boost 1.35.0. Incorporated
many of the suggestions from the review.
</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
Improved portability thanks to Boost regression testing.
</li>
<li class="listitem">
Fix lots of typos, and clearer text in the documentation.
</li>
<li class="listitem">
Fix floating point to <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span></code>
conversion when calculating sizes from the max load factor, and use <code class="computeroutput"><span class="keyword">double</span></code> in the calculation for greater accuracy.
</li>
<li class="listitem">
Fix some errors in the examples.
</li>
</ul></div>
<h3>
<a name="unordered.changes.h2"></a>
<span class="phrase"><a name="unordered.changes.boost_1_36_0"></a></span><a class="link" href="changes.html#unordered.changes.boost_1_36_0">Boost
1.36.0</a>
</h3>
<p>
First official release.
</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
Rearrange the internals.
</li>
<li class="listitem">
Move semantics - full support when rvalue references are available, emulated
using a cut down version of the Adobe move library when they are not.
</li>
<li class="listitem">
Emplace support when rvalue references and variadic template are available.
</li>
<li class="listitem">
More efficient node allocation when rvalue references and variadic template
are available.
</li>
<li class="listitem">
Added equality operators.
</li>
</ul></div>
<h3>
<a name="unordered.changes.h3"></a>
<span class="phrase"><a name="unordered.changes.boost_1_37_0"></a></span><a class="link" href="changes.html#unordered.changes.boost_1_37_0">Boost
1.37.0</a>
</h3>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
Rename overload of <code class="computeroutput"><span class="identifier">emplace</span></code>
with hint, to <code class="computeroutput"><span class="identifier">emplace_hint</span></code>
as specified in <a href="http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2008/n2691.pdf" target="_top">n2691</a>.
</li>
<li class="listitem">
Provide forwarding headers at <code class="computeroutput"><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">unordered</span><span class="special">/</span><span class="identifier">unordered_map_fwd</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>
and <code class="computeroutput"><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">unordered</span><span class="special">/</span><span class="identifier">unordered_set_fwd</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>.
</li>
<li class="listitem">
Move all the implementation inside <code class="computeroutput"><span class="identifier">boost</span><span class="special">/</span><span class="identifier">unordered</span></code>,
to assist modularization and hopefully make it easier to track changes
in subversion.
</li>
</ul></div>
<h3>
<a name="unordered.changes.h4"></a>
<span class="phrase"><a name="unordered.changes.boost_1_38_0"></a></span><a class="link" href="changes.html#unordered.changes.boost_1_38_0">Boost
1.38.0</a>
</h3>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
Use <a href="../../../libs/core/swap.html" target="_top"><code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">swap</span></code></a>.
</li>
<li class="listitem">
<a href="https://svn.boost.org/trac/boost/ticket/2237" target="_top">Ticket 2237</a>:
Document that the equality and inequality operators are undefined for two
objects if their equality predicates aren't equivalent. Thanks to Daniel
Krügler.
</li>
<li class="listitem">
<a href="https://svn.boost.org/trac/boost/ticket/1710" target="_top">Ticket 1710</a>:
Use a larger prime number list. Thanks to Thorsten Ottosen and Hervé Brönnimann.
</li>
<li class="listitem">
Use <a href="../../../libs/type_traits/doc/html/boost_typetraits/category/alignment.html" target="_top">aligned
storage</a> to store the types. This changes the way the allocator
is used to construct nodes. It used to construct the node with two calls
to the allocator's <code class="computeroutput"><span class="identifier">construct</span></code>
method - once for the pointers and once for the value. It now constructs
the node with a single call to construct and then constructs the value
using in place construction.
</li>
<li class="listitem">
Add support for C++0x initializer lists where they're available (currently
only g++ 4.4 in C++0x mode).
</li>
</ul></div>
<h3>
<a name="unordered.changes.h5"></a>
<span class="phrase"><a name="unordered.changes.boost_1_39_0"></a></span><a class="link" href="changes.html#unordered.changes.boost_1_39_0">Boost
1.39.0</a>
</h3>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<a href="https://svn.boost.org/trac/boost/ticket/2756" target="_top">Ticket 2756</a>:
Avoid a warning on Visual C++ 2009.
</li>
<li class="listitem">
Some other minor internal changes to the implementation, tests and documentation.
</li>
<li class="listitem">
Avoid an unnecessary copy in <code class="computeroutput"><span class="keyword">operator</span><span class="special">[]</span></code>.
</li>
<li class="listitem">
<a href="https://svn.boost.org/trac/boost/ticket/2975" target="_top">Ticket 2975</a>:
Fix length of prime number list.
</li>
</ul></div>
<h3>
<a name="unordered.changes.h6"></a>
<span class="phrase"><a name="unordered.changes.boost_1_40_0"></a></span><a class="link" href="changes.html#unordered.changes.boost_1_40_0">Boost
1.40.0</a>
</h3>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<a href="https://svn.boost.org/trac/boost/ticket/2975" target="_top">Ticket 2975</a>:
Store the prime list as a preprocessor sequence - so that it will always
get the length right if it changes again in the future.
</li>
<li class="listitem">
<a href="https://svn.boost.org/trac/boost/ticket/1978" target="_top">Ticket 1978</a>:
Implement <code class="computeroutput"><span class="identifier">emplace</span></code> for all
compilers.
</li>
<li class="listitem">
<a href="https://svn.boost.org/trac/boost/ticket/2908" target="_top">Ticket 2908</a>,
<a href="https://svn.boost.org/trac/boost/ticket/3096" target="_top">Ticket 3096</a>:
Some workarounds for old versions of borland, including adding explicit
destructors to all containers.
</li>
<li class="listitem">
<a href="https://svn.boost.org/trac/boost/ticket/3082" target="_top">Ticket 3082</a>:
Disable incorrect Visual C++ warnings.
</li>
<li class="listitem">
Better configuration for C++0x features when the headers aren't available.
</li>
<li class="listitem">
Create less buckets by default.
</li>
</ul></div>
<h3>
<a name="unordered.changes.h7"></a>
<span class="phrase"><a name="unordered.changes.boost_1_41_0___major_update"></a></span><a class="link" href="changes.html#unordered.changes.boost_1_41_0___major_update">Boost
1.41.0 - Major update</a>
</h3>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
The original version made heavy use of macros to sidestep some of the older
compilers' poor template support. But since I no longer support those compilers
and the macro use was starting to become a maintenance burden it has been
rewritten to use templates instead of macros for the implementation classes.
</li>
<li class="listitem">
The container object is now smaller thanks to using <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">compressed_pair</span></code>
for EBO and a slightly different function buffer - now using a bool instead
of a member pointer.
</li>
<li class="listitem">
Buckets are allocated lazily which means that constructing an empty container
will not allocate any memory.
</li>
</ul></div>
<h3>
<a name="unordered.changes.h8"></a>
<span class="phrase"><a name="unordered.changes.boost_1_42_0"></a></span><a class="link" href="changes.html#unordered.changes.boost_1_42_0">Boost
1.42.0</a>
</h3>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
Support instantiating the containers with incomplete value types.
</li>
<li class="listitem">
Reduced the number of warnings (mostly in tests).
</li>
<li class="listitem">
Improved codegear compatibility.
</li>
<li class="listitem">
<a href="http://svn.boost.org/trac/boost/ticket/3693" target="_top">Ticket 3693</a>:
Add <code class="computeroutput"><span class="identifier">erase_return_void</span></code> as
a temporary workaround for the current <code class="computeroutput"><span class="identifier">erase</span></code>
which can be inefficient because it has to find the next element to return
an iterator.
</li>
<li class="listitem">
Add templated find overload for compatible keys.
</li>
<li class="listitem">
<a href="http://svn.boost.org/trac/boost/ticket/3773" target="_top">Ticket 3773</a>:
Add missing <code class="computeroutput"><span class="identifier">std</span></code> qualifier
to <code class="computeroutput"><span class="identifier">ptrdiff_t</span></code>.
</li>
<li class="listitem">
Some code formatting changes to fit almost all lines into 80 characters.
</li>
</ul></div>
<h3>
<a name="unordered.changes.h9"></a>
<span class="phrase"><a name="unordered.changes.boost_1_43_0"></a></span><a class="link" href="changes.html#unordered.changes.boost_1_43_0">Boost
1.43.0</a>
</h3>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<a href="http://svn.boost.org/trac/boost/ticket/3966" target="_top">Ticket 3966</a>:
<code class="computeroutput"><span class="identifier">erase_return_void</span></code> is now
<code class="computeroutput"><span class="identifier">quick_erase</span></code>, which is the
<a href="http://home.roadrunner.com/~hinnant/issue_review/lwg-active.html#579" target="_top">current
forerunner for resolving the slow erase by iterator</a>, although there's
a strong possibility that this may change in the future. The old method
name remains for backwards compatibility but is considered deprecated and
will be removed in a future release.
</li>
<li class="listitem">
Use Boost.Exception.
</li>
<li class="listitem">
Stop using deprecated <code class="computeroutput"><span class="identifier">BOOST_HAS_</span><span class="special">*</span></code> macros.
</li>
</ul></div>
<h3>
<a name="unordered.changes.h10"></a>
<span class="phrase"><a name="unordered.changes.boost_1_45_0"></a></span><a class="link" href="changes.html#unordered.changes.boost_1_45_0">Boost
1.45.0</a>
</h3>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
Fix a bug when inserting into an <code class="computeroutput"><span class="identifier">unordered_map</span></code>
or <code class="computeroutput"><span class="identifier">unordered_set</span></code> using
iterators which returns <code class="computeroutput"><span class="identifier">value_type</span></code>
by copy.
</li></ul></div>
<h3>
<a name="unordered.changes.h11"></a>
<span class="phrase"><a name="unordered.changes.boost_1_48_0___major_update"></a></span><a class="link" href="changes.html#unordered.changes.boost_1_48_0___major_update">Boost
1.48.0 - Major update</a>
</h3>
<p>
This is major change which has been converted to use Boost.Move's move emulation,
and be more compliant with the C++11 standard. See the <a class="link" href="compliance.html" title="Standard Compliance">compliance
section</a> for details.
</p>
<p>
The container now meets C++11's complexity requirements, but to do so uses
a little more memory. This means that <code class="computeroutput"><span class="identifier">quick_erase</span></code>
and <code class="computeroutput"><span class="identifier">erase_return_void</span></code> are no
longer required, they'll be removed in a future version.
</p>
<p>
C++11 support has resulted in some breaking changes:
</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
Equality comparison has been changed to the C++11 specification. In a container
with equivalent keys, elements in a group with equal keys used to have
to be in the same order to be considered equal, now they can be a permutation
of each other. To use the old behavior define the macro <code class="computeroutput"><span class="identifier">BOOST_UNORDERED_DEPRECATED_EQUALITY</span></code>.
</li>
<li class="listitem">
The behaviour of swap is different when the two containers to be swapped
has unequal allocators. It used to allocate new nodes using the appropriate
allocators, it now swaps the allocators if the allocator has a member structure
<code class="computeroutput"><span class="identifier">propagate_on_container_swap</span></code>,
such that <code class="computeroutput"><span class="identifier">propagate_on_container_swap</span><span class="special">::</span><span class="identifier">value</span></code>
is true.
</li>
<li class="listitem">
Allocator's <code class="computeroutput"><span class="identifier">construct</span></code> and
<code class="computeroutput"><span class="identifier">destroy</span></code> functions are called
with raw pointers, rather than the allocator's <code class="computeroutput"><span class="identifier">pointer</span></code>
type.
</li>
<li class="listitem">
<code class="computeroutput"><span class="identifier">emplace</span></code> used to emulate
the variadic pair constructors that appeared in early C++0x drafts. Since
they were removed it no longer does so. It does emulate the new <code class="computeroutput"><span class="identifier">piecewise_construct</span></code> pair constructors
- only you need to use <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">piecewise_construct</span></code>.
To use the old emulation of the variadic constructors define <code class="computeroutput"><span class="identifier">BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT</span></code>.
</li>
</ul></div>
<h3>
<a name="unordered.changes.h12"></a>
<span class="phrase"><a name="unordered.changes.boost_1_49_0"></a></span><a class="link" href="changes.html#unordered.changes.boost_1_49_0">Boost
1.49.0</a>
</h3>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
Fix warning due to accidental odd assignment.
</li>
<li class="listitem">
Slightly better error messages.
</li>
</ul></div>
<h3>
<a name="unordered.changes.h13"></a>
<span class="phrase"><a name="unordered.changes.boost_1_50_0"></a></span><a class="link" href="changes.html#unordered.changes.boost_1_50_0">Boost
1.50.0</a>
</h3>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
Fix equality for <code class="computeroutput"><span class="identifier">unordered_multiset</span></code>
and <code class="computeroutput"><span class="identifier">unordered_multimap</span></code>.
</li>
<li class="listitem">
<a href="https://svn.boost.org/trac/boost/ticket/6857" target="_top">Ticket 6857</a>:
Implement <code class="computeroutput"><span class="identifier">reserve</span></code>.
</li>
<li class="listitem">
<a href="https://svn.boost.org/trac/boost/ticket/6771" target="_top">Ticket 6771</a>:
Avoid gcc's <code class="computeroutput"><span class="special">-</span><span class="identifier">Wfloat</span><span class="special">-</span><span class="identifier">equal</span></code>
warning.
</li>
<li class="listitem">
<a href="https://svn.boost.org/trac/boost/ticket/6784" target="_top">Ticket 6784</a>:
Fix some Sun specific code.
</li>
<li class="listitem">
<a href="https://svn.boost.org/trac/boost/ticket/6190" target="_top">Ticket 6190</a>:
Avoid gcc's <code class="computeroutput"><span class="special">-</span><span class="identifier">Wshadow</span></code>
warning.
</li>
<li class="listitem">
<a href="https://svn.boost.org/trac/boost/ticket/6905" target="_top">Ticket 6905</a>:
Make namespaces in macros compatible with <code class="computeroutput"><span class="identifier">bcp</span></code>
custom namespaces. Fixed by Luke Elliott.
</li>
<li class="listitem">
Remove some of the smaller prime number of buckets, as they may make collisions
quite probable (e.g. multiples of 5 are very common because we used base
10).
</li>
<li class="listitem">
On old versions of Visual C++, use the container library's implementation
of <code class="computeroutput"><span class="identifier">allocator_traits</span></code>, as
it's more likely to work.
</li>
<li class="listitem">
On machines with 64 bit std::size_t, use power of 2 buckets, with Thomas
Wang's hash function to pick which one to use. As modulus is very slow
for 64 bit values.
</li>
<li class="listitem">
Some internal changes.
</li>
</ul></div>
<h3>
<a name="unordered.changes.h14"></a>
<span class="phrase"><a name="unordered.changes.boost_1_51_0"></a></span><a class="link" href="changes.html#unordered.changes.boost_1_51_0">Boost
1.51.0</a>
</h3>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
Fix construction/destruction issue when using a C++11 compiler with a C++03
allocator (<a href="https://svn.boost.org/trac/boost/ticket/7100" target="_top">#7100</a>).
</li>
<li class="listitem">
Remove a <code class="computeroutput"><span class="keyword">try</span><span class="special">..</span><span class="keyword">catch</span></code> to support compiling without exceptions.
</li>
<li class="listitem">
Adjust SFINAE use to try to support g++ 3.4 (<a href="https://svn.boost.org/trac/boost/ticket/7175" target="_top">#7175</a>).
</li>
<li class="listitem">
Updated to use the new config macros.
</li>
</ul></div>
<h3>
<a name="unordered.changes.h15"></a>
<span class="phrase"><a name="unordered.changes.boost_1_52_0"></a></span><a class="link" href="changes.html#unordered.changes.boost_1_52_0">Boost
1.52.0</a>
</h3>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
Faster assign, which assigns to existing nodes where possible, rather than
creating entirely new nodes and copy constructing.
</li>
<li class="listitem">
Fixed bug in <code class="computeroutput"><span class="identifier">erase_range</span></code>
(<a href="https://svn.boost.org/trac/boost/ticket/7471" target="_top">#7471</a>).
</li>
<li class="listitem">
Reverted some of the internal changes to how nodes are created, especially
for C++11 compilers. 'construct' and 'destroy' should work a little better
for C++11 allocators.
</li>
<li class="listitem">
Simplified the implementation a bit. Hopefully more robust.
</li>
</ul></div>
<h3>
<a name="unordered.changes.h16"></a>
<span class="phrase"><a name="unordered.changes.boost_1_53_0"></a></span><a class="link" href="changes.html#unordered.changes.boost_1_53_0">Boost
1.53.0</a>
</h3>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
Remove support for the old pre-standard variadic pair constructors, and
equality implementation. Both have been deprecated since Boost 1.48.
</li>
<li class="listitem">
Remove use of deprecated config macros.
</li>
<li class="listitem">
More internal implementation changes, including a much simpler implementation
of <code class="computeroutput"><span class="identifier">erase</span></code>.
</li>
</ul></div>
<h3>
<a name="unordered.changes.h17"></a>
<span class="phrase"><a name="unordered.changes.boost_1_54_0"></a></span><a class="link" href="changes.html#unordered.changes.boost_1_54_0">Boost
1.54.0</a>
</h3>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
Mark methods specified in standard as <code class="computeroutput"><span class="identifier">noexpect</span></code>.
More to come in the next release.
</li>
<li class="listitem">
If the hash function and equality predicate are known to both have nothrow
move assignment or construction then use them.
</li>
</ul></div>
<h3>
<a name="unordered.changes.h18"></a>
<span class="phrase"><a name="unordered.changes.boost_1_55_0"></a></span><a class="link" href="changes.html#unordered.changes.boost_1_55_0">Boost
1.55.0</a>
</h3>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
Avoid some warnings (<a href="https://svn.boost.org/trac/boost/ticket/8851" target="_top">#8851</a>, <a href="https://svn.boost.org/trac/boost/ticket/8874" target="_top">#8874</a>).
</li>
<li class="listitem">
Avoid exposing some detail functions via. ADL on the iterators.
</li>
<li class="listitem">
Follow the standard by only using the allocators' construct and destroy
methods to construct and destroy stored elements. Don't use them for internal
data like pointers.
</li>
</ul></div>
<h3>
<a name="unordered.changes.h19"></a>
<span class="phrase"><a name="unordered.changes.boost_1_56_0"></a></span><a class="link" href="changes.html#unordered.changes.boost_1_56_0">Boost
1.56.0</a>
</h3>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
Fix some shadowed variable warnings (<a href="https://svn.boost.org/trac/boost/ticket/9377" target="_top">#9377</a>).
</li>
<li class="listitem">
Fix allocator use in documentation (<a href="https://svn.boost.org/trac/boost/ticket/9719" target="_top">#9719</a>).
</li>
<li class="listitem">
Always use prime number of buckets for integers. Fixes performance regression
when inserting consecutive integers, although makes other uses slower (<a href="https://svn.boost.org/trac/boost/ticket/9282" target="_top">#9282</a>).
</li>
<li class="listitem">
Only construct elements using allocators, as specified in C++11 standard.
</li>
</ul></div>
<h3>
<a name="unordered.changes.h20"></a>
<span class="phrase"><a name="unordered.changes.boost_1_57_0"></a></span><a class="link" href="changes.html#unordered.changes.boost_1_57_0">Boost
1.57.0</a>
</h3>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
Fix the <code class="computeroutput"><span class="identifier">pointer</span></code> typedef
in iterators (<a href="https://svn.boost.org/trac/boost/ticket/10672" target="_top">#10672</a>).
</li>
<li class="listitem">
Fix Coverity warning (<a href="https://github.com/boostorg/unordered/pull/2" target="_top">GitHub
#2</a>).
</li>
</ul></div>
<h3>
<a name="unordered.changes.h21"></a>
<span class="phrase"><a name="unordered.changes.boost_1_58_0"></a></span><a class="link" href="changes.html#unordered.changes.boost_1_58_0">Boost
1.58.0</a>
</h3>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
Remove unnecessary template parameter from const iterators.
</li>
<li class="listitem">
Rename private <code class="computeroutput"><span class="identifier">iterator</span></code>
typedef in some iterator classes, as it confuses some traits classes.
</li>
<li class="listitem">
Fix move assignment with stateful, propagate_on_container_move_assign allocators
(<a href="https://svn.boost.org/trac/boost/ticket/10777" target="_top">#10777</a>).
</li>
<li class="listitem">
Fix rare exception safety issue in move assignment.
</li>
<li class="listitem">
Fix potential overflow when calculating number of buckets to allocate (<a href="https://github.com/boostorg/unordered/pull/4" target="_top">GitHub #4</a>).
</li>
</ul></div>
<h3>
<a name="unordered.changes.h22"></a>
<span class="phrase"><a name="unordered.changes.boost_1_62_0"></a></span><a class="link" href="changes.html#unordered.changes.boost_1_62_0">Boost
1.62.0</a>
</h3>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
Remove use of deprecated <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">iterator</span></code>.
</li>
<li class="listitem">
Remove <code class="computeroutput"><span class="identifier">BOOST_NO_STD_DISTANCE</span></code>
workaround.
</li>
<li class="listitem">
Remove <code class="computeroutput"><span class="identifier">BOOST_UNORDERED_DEPRECATED_EQUALITY</span></code>
warning.
</li>
<li class="listitem">
Simpler implementation of assignment, fixes an exception safety issue for
<code class="computeroutput"><span class="identifier">unordered_multiset</span></code> and
<code class="computeroutput"><span class="identifier">unordered_multimap</span></code>. Might
be a little slower.
</li>
<li class="listitem">
Stop using return value SFINAE which some older compilers have issues with.
</li>
</ul></div>
<h3>
<a name="unordered.changes.h23"></a>
<span class="phrase"><a name="unordered.changes.boost_1_63_0"></a></span><a class="link" href="changes.html#unordered.changes.boost_1_63_0">Boost
1.63.0</a>
</h3>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
Check hint iterator in <code class="computeroutput"><span class="identifier">insert</span></code>/<code class="computeroutput"><span class="identifier">emplace_hint</span></code>.
</li>
<li class="listitem">
Fix some warnings, mostly in the tests.
</li>
<li class="listitem">
Manually write out <code class="computeroutput"><span class="identifier">emplace_args</span></code>
for small numbers of arguments - should make template error messages a
little more bearable.
</li>
<li class="listitem">
Remove superfluous use of <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">forward</span></code>
in emplace arguments, which fixes emplacing string literals in old versions
of Visual C++.
</li>
<li class="listitem">
Fix an exception safety issue in assignment. If bucket allocation throws
an exception, it can overwrite the hash and equality functions while leaving
the existing elements in place. This would mean that the function objects
wouldn't match the container elements, so elements might be in the wrong
bucket and equivalent elements would be incorrectly handled.
</li>
<li class="listitem">
Various reference documentation improvements.
</li>
<li class="listitem">
Better allocator support (<a href="https://svn.boost.org/trac/boost/ticket/12459" target="_top">#12459</a>).
</li>
<li class="listitem">
Make the no argument constructors implicit.
</li>
<li class="listitem">
Implement missing allocator aware constructors.
</li>
<li class="listitem">
Fix assigning the hash/key equality functions for empty containers.
</li>
<li class="listitem">
Remove unary/binary_function from the examples in the documentation. They
are removed in C++17.
</li>
<li class="listitem">
Support 10 constructor arguments in emplace. It was meant to support up
to 10 arguments, but an off by one error in the preprocessor code meant
it only supported up to 9.
</li>
</ul></div>
<h3>
<a name="unordered.changes.h24"></a>
<span class="phrase"><a name="unordered.changes.boost_1_64_0"></a></span><a class="link" href="changes.html#unordered.changes.boost_1_64_0">Boost
1.64.0</a>
</h3>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
Initial support for new C++17 member functions: <code class="computeroutput"><span class="identifier">insert_or_assign</span></code>
and <code class="computeroutput"><span class="identifier">try_emplace</span></code> in <code class="computeroutput"><span class="identifier">unordered_map</span></code>,
</li>
<li class="listitem">
Initial support for <code class="computeroutput"><span class="identifier">merge</span></code>
and <code class="computeroutput"><span class="identifier">extract</span></code>. Does not include
transferring nodes between <code class="computeroutput"><span class="identifier">unordered_map</span></code>
and <code class="computeroutput"><span class="identifier">unordered_multimap</span></code>
or between <code class="computeroutput"><span class="identifier">unordered_set</span></code>
and <code class="computeroutput"><span class="identifier">unordered_multiset</span></code>
yet. That will hopefully be in the next version of Boost.
</li>
</ul></div>
<h3>
<a name="unordered.changes.h25"></a>
<span class="phrase"><a name="unordered.changes.boost_1_65_0"></a></span><a class="link" href="changes.html#unordered.changes.boost_1_65_0">Boost
1.65.0</a>
</h3>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
Add deprecated attributes to <code class="computeroutput"><span class="identifier">quick_erase</span></code>
and <code class="computeroutput"><span class="identifier">erase_return_void</span></code>.
I really will remove them in a future version this time.
</li>
<li class="listitem">
Small standards compliance fixes:
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<code class="computeroutput"><span class="identifier">noexpect</span></code> specs for
<code class="computeroutput"><span class="identifier">swap</span></code> free functions.
</li>
<li class="listitem">
Add missing <code class="computeroutput"><span class="identifier">insert</span><span class="special">(</span><span class="identifier">P</span><span class="special">&amp;&amp;)</span></code> methods.
</li>
</ul></div>
</li>
</ul></div>
<h3>
<a name="unordered.changes.h26"></a>
<span class="phrase"><a name="unordered.changes.boost_1_66_0"></a></span><a class="link" href="changes.html#unordered.changes.boost_1_66_0">Boost
1.66.0</a>
</h3>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
Simpler move construction implementation.
</li>
<li class="listitem">
Documentation fixes (<a href="https://github.com/boostorg/unordered/pull/6" target="_top">GitHub
#6</a>).
</li>
</ul></div>
<h3>
<a name="unordered.changes.h27"></a>
<span class="phrase"><a name="unordered.changes.boost_1_67_0"></a></span><a class="link" href="changes.html#unordered.changes.boost_1_67_0">Boost
1.67.0</a>
</h3>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
Improved C++17 support:
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
Add template deduction guides from the standard.
</li>
<li class="listitem">
Use a simple implementation of <code class="computeroutput"><span class="identifier">optional</span></code>
in node handles, so that they're closer to the standard.
</li>
<li class="listitem">
Add missing <code class="computeroutput"><span class="keyword">noexcept</span></code>
specifications to <code class="computeroutput"><span class="identifier">swap</span></code>,
<code class="computeroutput"><span class="keyword">operator</span><span class="special">=</span></code>
and node handles, and change the implementation to match. Using
<code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">allocator_traits</span><span class="special">::</span><span class="identifier">is_always_equal</span></code>, or our own implementation
when not available, and <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">is_nothrow_swappable</span></code>
in the implementation.
</li>
</ul></div>
</li>
<li class="listitem">
Improved C++20 support:
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem">
Use <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">to_address</span></code>, which has the proposed
C++20 semantics, rather than the old custom implementation.
</li></ul></div>
</li>
<li class="listitem">
Add <code class="computeroutput"><span class="identifier">element_type</span></code> to iterators,
so that <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">pointer_traits</span></code> will work.
</li>
<li class="listitem">
Use <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">piecewise_construct</span></code> on recent versions
of Visual C++, and other uses of the Dinkumware standard library, now using
Boost.Predef to check compiler and library versions.
</li>
<li class="listitem">
Use <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">iterator_traits</span></code> rather than the boost
iterator traits in order to remove dependency on Boost.Iterator.
</li>
<li class="listitem">
Remove iterators' inheritance from <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">iterator</span></code>,
which is deprecated in C++17, thanks to Daniela Engert (<a href="https://github.com/boostorg/unordered/pull/7" target="_top">PR#7</a>).
</li>
<li class="listitem">
Stop using <code class="computeroutput"><span class="identifier">BOOST_DEDUCED_TYPENAME</span></code>.
</li>
<li class="listitem">
Update some Boost include paths.
</li>
<li class="listitem">
Rename some internal methods, and variables.
</li>
<li class="listitem">
Various testing improvements.
</li>
<li class="listitem">
Miscellaneous internal changes.
</li>
</ul></div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2003, 2004 Jeremy B. Maitin-Shepard<br>Copyright © 2005-2008 Daniel
James<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="rationale.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../unordered.html"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="reference.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>

View File

@@ -0,0 +1,520 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Comparison with Associative Containers</title>
<link rel="stylesheet" href="../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../unordered.html" title="Chapter 45. Boost.Unordered">
<link rel="prev" href="hash_equality.html" title="Equality Predicates and Hash Functions">
<link rel="next" href="compliance.html" title="Standard Compliance">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
<td align="center"><a href="../../../index.html">Home</a></td>
<td align="center"><a href="../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="hash_equality.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../unordered.html"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="compliance.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="unordered.comparison"></a><a class="link" href="comparison.html" title="Comparison with Associative Containers">Comparison with Associative Containers</a>
</h2></div></div></div>
<div class="table">
<a name="unordered.comparison.interface_differences"></a><p class="title"><b>Table 45.4. Interface differences.</b></p>
<div class="table-contents"><table class="table" summary="Interface differences.">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Associative Containers
</p>
</th>
<th>
<p>
Unordered Associative Containers
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
Parameterized by an ordering relation <code class="computeroutput"><span class="identifier">Compare</span></code>
</p>
</td>
<td>
<p>
Parameterized by a function object <code class="computeroutput"><span class="identifier">Hash</span></code>
and an equivalence relation <code class="computeroutput"><span class="identifier">Pred</span></code>
</p>
</td>
</tr>
<tr>
<td>
<p>
Keys can be compared using <code class="computeroutput"><span class="identifier">key_compare</span></code>
which is accessed by member function <code class="computeroutput"><span class="identifier">key_comp</span><span class="special">()</span></code>, values can be compared using
<code class="computeroutput"><span class="identifier">value_compare</span></code> which
is accessed by member function <code class="computeroutput"><span class="identifier">value_comp</span><span class="special">()</span></code>.
</p>
</td>
<td>
<p>
Keys can be hashed using <code class="computeroutput"><span class="identifier">hasher</span></code>
which is accessed by member function <code class="computeroutput"><span class="identifier">hash_function</span><span class="special">()</span></code>, and checked for equality using
<code class="computeroutput"><span class="identifier">key_equal</span></code> which is
accessed by member function <code class="computeroutput"><span class="identifier">key_eq</span><span class="special">()</span></code>. There is no function object for
compared or hashing values.
</p>
</td>
</tr>
<tr>
<td>
<p>
Constructors have optional extra parameters for the comparison object.
</p>
</td>
<td>
<p>
Constructors have optional extra parameters for the initial minimum
number of buckets, a hash function and an equality object.
</p>
</td>
</tr>
<tr>
<td>
<p>
Keys <code class="computeroutput"><span class="identifier">k1</span></code>, <code class="computeroutput"><span class="identifier">k2</span></code> are considered equivalent if
<code class="computeroutput"><span class="special">!</span><span class="identifier">Compare</span><span class="special">(</span><span class="identifier">k1</span><span class="special">,</span> <span class="identifier">k2</span><span class="special">)</span> <span class="special">&amp;&amp;</span>
<span class="special">!</span><span class="identifier">Compare</span><span class="special">(</span><span class="identifier">k2</span><span class="special">,</span> <span class="identifier">k1</span><span class="special">)</span></code>
</p>
</td>
<td>
<p>
Keys <code class="computeroutput"><span class="identifier">k1</span></code>, <code class="computeroutput"><span class="identifier">k2</span></code> are considered equivalent if
<code class="computeroutput"><span class="identifier">Pred</span><span class="special">(</span><span class="identifier">k1</span><span class="special">,</span> <span class="identifier">k2</span><span class="special">)</span></code>
</p>
</td>
</tr>
<tr>
<td>
<p>
Member function <code class="computeroutput"><span class="identifier">lower_bound</span><span class="special">(</span><span class="identifier">k</span><span class="special">)</span></code> and <code class="computeroutput"><span class="identifier">upper_bound</span><span class="special">(</span><span class="identifier">k</span><span class="special">)</span></code>
</p>
</td>
<td>
<p>
No equivalent. Since the elements aren't ordered <code class="computeroutput"><span class="identifier">lower_bound</span></code>
and <code class="computeroutput"><span class="identifier">upper_bound</span></code> would
be meaningless.
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">equal_range</span><span class="special">(</span><span class="identifier">k</span><span class="special">)</span></code>
returns an empty range at the position that k would be inserted if
k isn't present in the container.
</p>
</td>
<td>
<p>
<code class="computeroutput"><span class="identifier">equal_range</span><span class="special">(</span><span class="identifier">k</span><span class="special">)</span></code>
returns a range at the end of the container if k isn't present in
the container. It can't return a positioned range as k could be inserted
into multiple place. To find out the bucket that k would be inserted
into use <code class="computeroutput"><span class="identifier">bucket</span><span class="special">(</span><span class="identifier">k</span><span class="special">)</span></code>.
But remember that an insert can cause the container to rehash - meaning
that the element can be inserted into a different bucket.
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">iterator</span></code>, <code class="computeroutput"><span class="identifier">const_iterator</span></code> are of the bidirectional
category.
</p>
</td>
<td>
<p>
<code class="computeroutput"><span class="identifier">iterator</span></code>, <code class="computeroutput"><span class="identifier">const_iterator</span></code> are of at least
the forward category.
</p>
</td>
</tr>
<tr>
<td>
<p>
Iterators, pointers and references to the container's elements are
never invalidated.
</p>
</td>
<td>
<p>
<a class="link" href="buckets.html#unordered.buckets.iterator_invalidation">Iterators
can be invalidated by calls to insert or rehash</a>. Pointers
and references to the container's elements are never invalidated.
</p>
</td>
</tr>
<tr>
<td>
<p>
Iterators iterate through the container in the order defined by the
comparison object.
</p>
</td>
<td>
<p>
Iterators iterate through the container in an arbitrary order, that
can change as elements are inserted, although equivalent elements
are always adjacent.
</p>
</td>
</tr>
<tr>
<td>
<p>
No equivalent
</p>
</td>
<td>
<p>
Local iterators can be used to iterate through individual buckets.
(The order of local iterators and iterators aren't required to have
any correspondence.)
</p>
</td>
</tr>
<tr>
<td>
<p>
Can be compared using the <code class="computeroutput"><span class="special">==</span></code>,
<code class="computeroutput"><span class="special">!=</span></code>, <code class="computeroutput"><span class="special">&lt;</span></code>,
<code class="computeroutput"><span class="special">&lt;=</span></code>, <code class="computeroutput"><span class="special">&gt;</span></code>, <code class="computeroutput"><span class="special">&gt;=</span></code>
operators.
</p>
</td>
<td>
<p>
Can be compared using the <code class="computeroutput"><span class="special">==</span></code>
and <code class="computeroutput"><span class="special">!=</span></code> operators.
</p>
</td>
</tr>
<tr>
<td>
</td>
<td>
<p>
When inserting with a hint, implementations are permitted to ignore
the hint.
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">erase</span></code> never throws
an exception
</p>
</td>
<td>
<p>
The containers' hash or predicate function can throw exceptions from
<code class="computeroutput"><span class="identifier">erase</span></code>
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><div class="table">
<a name="unordered.comparison.complexity_guarantees"></a><p class="title"><b>Table 45.5. Complexity Guarantees</b></p>
<div class="table-contents"><table class="table" summary="Complexity Guarantees">
<colgroup>
<col>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Operation
</p>
</th>
<th>
<p>
Associative Containers
</p>
</th>
<th>
<p>
Unordered Associative Containers
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
Construction of empty container
</p>
</td>
<td>
<p>
constant
</p>
</td>
<td>
<p>
O(<span class="emphasis"><em>n</em></span>) where <span class="emphasis"><em>n</em></span> is the minimum
number of buckets.
</p>
</td>
</tr>
<tr>
<td>
<p>
Construction of container from a range of <span class="emphasis"><em>N</em></span>
elements
</p>
</td>
<td>
<p>
O(<span class="emphasis"><em>N</em></span> log <span class="emphasis"><em>N</em></span>), O(<span class="emphasis"><em>N</em></span>)
if the range is sorted with <code class="computeroutput"><span class="identifier">value_comp</span><span class="special">()</span></code>
</p>
</td>
<td>
<p>
Average case O(<span class="emphasis"><em>N</em></span>), worst case O(<span class="emphasis"><em>N</em></span><sup>2</sup>)
</p>
</td>
</tr>
<tr>
<td>
<p>
Insert a single element
</p>
</td>
<td>
<p>
logarithmic
</p>
</td>
<td>
<p>
Average case constant, worst case linear
</p>
</td>
</tr>
<tr>
<td>
<p>
Insert a single element with a hint
</p>
</td>
<td>
<p>
Amortized constant if t elements inserted right after hint, logarithmic
otherwise
</p>
</td>
<td>
<p>
Average case constant, worst case linear (ie. the same as a normal
insert).
</p>
</td>
</tr>
<tr>
<td>
<p>
Inserting a range of <span class="emphasis"><em>N</em></span> elements
</p>
</td>
<td>
<p>
<span class="emphasis"><em>N</em></span> log(<code class="computeroutput"><span class="identifier">size</span><span class="special">()</span></code>+<span class="emphasis"><em>N</em></span>)
</p>
</td>
<td>
<p>
Average case O(<span class="emphasis"><em>N</em></span>), worst case O(<span class="emphasis"><em>N</em></span>
* <code class="computeroutput"><span class="identifier">size</span><span class="special">()</span></code>)
</p>
</td>
</tr>
<tr>
<td>
<p>
Erase by key, <code class="computeroutput"><span class="identifier">k</span></code>
</p>
</td>
<td>
<p>
O(log(<code class="computeroutput"><span class="identifier">size</span><span class="special">()</span></code>)
+ <code class="computeroutput"><span class="identifier">count</span><span class="special">(</span><span class="identifier">k</span><span class="special">)</span></code>)
</p>
</td>
<td>
<p>
Average case: O(<code class="computeroutput"><span class="identifier">count</span><span class="special">(</span><span class="identifier">k</span><span class="special">)</span></code>), Worst case: O(<code class="computeroutput"><span class="identifier">size</span><span class="special">()</span></code>)
</p>
</td>
</tr>
<tr>
<td>
<p>
Erase a single element by iterator
</p>
</td>
<td>
<p>
Amortized constant
</p>
</td>
<td>
<p>
Average case: O(1), Worst case: O(<code class="computeroutput"><span class="identifier">size</span><span class="special">()</span></code>)
</p>
</td>
</tr>
<tr>
<td>
<p>
Erase a range of <span class="emphasis"><em>N</em></span> elements
</p>
</td>
<td>
<p>
O(log(<code class="computeroutput"><span class="identifier">size</span><span class="special">()</span></code>)
+ <span class="emphasis"><em>N</em></span>)
</p>
</td>
<td>
<p>
Average case: O(<span class="emphasis"><em>N</em></span>), Worst case: O(<code class="computeroutput"><span class="identifier">size</span><span class="special">()</span></code>)
</p>
</td>
</tr>
<tr>
<td>
<p>
Clearing the container
</p>
</td>
<td>
<p>
O(<code class="computeroutput"><span class="identifier">size</span><span class="special">()</span></code>)
</p>
</td>
<td>
<p>
O(<code class="computeroutput"><span class="identifier">size</span><span class="special">()</span></code>)
</p>
</td>
</tr>
<tr>
<td>
<p>
Find
</p>
</td>
<td>
<p>
logarithmic
</p>
</td>
<td>
<p>
Average case: O(1), Worst case: O(<code class="computeroutput"><span class="identifier">size</span><span class="special">()</span></code>)
</p>
</td>
</tr>
<tr>
<td>
<p>
Count
</p>
</td>
<td>
<p>
O(log(<code class="computeroutput"><span class="identifier">size</span><span class="special">()</span></code>)
+ <code class="computeroutput"><span class="identifier">count</span><span class="special">(</span><span class="identifier">k</span><span class="special">)</span></code>)
</p>
</td>
<td>
<p>
Average case: O(1), Worst case: O(<code class="computeroutput"><span class="identifier">size</span><span class="special">()</span></code>)
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">equal_range</span><span class="special">(</span><span class="identifier">k</span><span class="special">)</span></code>
</p>
</td>
<td>
<p>
logarithmic
</p>
</td>
<td>
<p>
Average case: O(<code class="computeroutput"><span class="identifier">count</span><span class="special">(</span><span class="identifier">k</span><span class="special">)</span></code>), Worst case: O(<code class="computeroutput"><span class="identifier">size</span><span class="special">()</span></code>)
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">lower_bound</span></code>,<code class="computeroutput"><span class="identifier">upper_bound</span></code>
</p>
</td>
<td>
<p>
logarithmic
</p>
</td>
<td>
<p>
n/a
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break">
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2003, 2004 Jeremy B. Maitin-Shepard<br>Copyright © 2005-2008 Daniel
James<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="hash_equality.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../unordered.html"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="compliance.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>

View File

@@ -0,0 +1,212 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Standard Compliance</title>
<link rel="stylesheet" href="../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../unordered.html" title="Chapter 45. Boost.Unordered">
<link rel="prev" href="comparison.html" title="Comparison with Associative Containers">
<link rel="next" href="rationale.html" title="Implementation Rationale">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
<td align="center"><a href="../../../index.html">Home</a></td>
<td align="center"><a href="../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="comparison.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../unordered.html"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="rationale.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="unordered.compliance"></a><a class="link" href="compliance.html" title="Standard Compliance">Standard Compliance</a>
</h2></div></div></div>
<div class="toc"><dl class="toc">
<dt><span class="section"><a href="compliance.html#unordered.compliance.move">Move emulation</a></span></dt>
<dt><span class="section"><a href="compliance.html#unordered.compliance.allocator_compliance">Use of allocators</a></span></dt>
<dt><span class="section"><a href="compliance.html#unordered.compliance.construction">Construction/Destruction
using allocators</a></span></dt>
<dt><span class="section"><a href="compliance.html#unordered.compliance.pointer_traits">Pointer Traits</a></span></dt>
<dt><span class="section"><a href="compliance.html#unordered.compliance.pairs0">Pairs</a></span></dt>
<dt><span class="section"><a href="compliance.html#unordered.compliance.misc">Miscellaneous</a></span></dt>
</dl></div>
<p>
The intent of Boost.Unordered is to implement a close (but imperfect) implementation
of the C++17 standard, that will work with C++98 upwards. The wide compatibility
does mean some comprimises have to be made. With a compiler and library that
fully support C++11, the differences should be minor.
</p>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="unordered.compliance.move"></a><a class="link" href="compliance.html#unordered.compliance.move" title="Move emulation">Move emulation</a>
</h3></div></div></div>
<p>
Support for move semantics is implemented using Boost.Move. If rvalue references
are available it will use them, but if not it uses a close, but imperfect
emulation. On such compilers:
</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
Non-copyable objects can be stored in the containers. They can be constructed
in place using <code class="computeroutput"><span class="identifier">emplace</span></code>,
or if they support Boost.Move, moved into place.
</li>
<li class="listitem">
The containers themselves are not movable.
</li>
<li class="listitem">
Argument forwarding is not perfect.
</li>
</ul></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="unordered.compliance.allocator_compliance"></a><a class="link" href="compliance.html#unordered.compliance.allocator_compliance" title="Use of allocators">Use of allocators</a>
</h3></div></div></div>
<p>
C++11 introduced a new allocator system. It's backwards compatible due to
the lax requirements for allocators in the old standard, but might need some
changes for allocators which worked with the old versions of the unordered
containers. It uses a traits class, <code class="computeroutput"><span class="identifier">allocator_traits</span></code>
to handle the allocator adding extra functionality, and making some methods
and types optional. During development a stable release of <code class="computeroutput"><span class="identifier">allocator_traits</span></code> wasn't available so an
internal partial implementation is always used in this version. Hopefully
a future version will use the standard implementation where available.
</p>
<p>
The member functions <code class="computeroutput"><span class="identifier">construct</span></code>,
<code class="computeroutput"><span class="identifier">destroy</span></code> and <code class="computeroutput"><span class="identifier">max_size</span></code> are now optional, if they're not
available a fallback is used. A full implementation of <code class="computeroutput"><span class="identifier">allocator_traits</span></code>
requires sophisticated member function detection so that the fallback is
used whenever the member function call is not well formed. This requires
support for SFINAE expressions, which are available on GCC from version 4.4
and Clang.
</p>
<p>
On other compilers, there's just a test to see if the allocator has a member,
but no check that it can be called. So rather than using a fallback there
will just be a compile error.
</p>
<p>
<code class="computeroutput"><span class="identifier">propagate_on_container_copy_assignment</span></code>,
<code class="computeroutput"><span class="identifier">propagate_on_container_move_assignment</span></code>,
<code class="computeroutput"><span class="identifier">propagate_on_container_swap</span></code>
and <code class="computeroutput"><span class="identifier">select_on_container_copy_construction</span></code>
are also supported. Due to imperfect move emulation, some assignments might
check <code class="computeroutput"><span class="identifier">propagate_on_container_copy_assignment</span></code>
on some compilers and <code class="computeroutput"><span class="identifier">propagate_on_container_move_assignment</span></code>
on others.
</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="unordered.compliance.construction"></a><a class="link" href="compliance.html#unordered.compliance.construction" title="Construction/Destruction using allocators">Construction/Destruction
using allocators</a>
</h3></div></div></div>
<p>
The following support is required for full use of C++11 style construction/destruction:
</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
Variadic templates.
</li>
<li class="listitem">
Piecewise construction of <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span></code>.
</li>
<li class="listitem">
Either <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">allocator_traits</span></code> or expression SFINAE.
</li>
</ul></div>
<p>
This is detected using Boost.Config. The macro <code class="computeroutput"><span class="identifier">BOOST_UNORDERED_CXX11_CONSTRUCTION</span></code>
will be set to 1 if it is found, or 0 otherwise.
</p>
<p>
When this is the case <code class="computeroutput"><span class="identifier">allocator_traits</span><span class="special">::</span><span class="identifier">construct</span></code>
and <code class="computeroutput"><span class="identifier">allocator_traits</span><span class="special">::</span><span class="identifier">destroy</span></code> will always be used, apart from
when piecewise constructing a <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span></code>
using <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">tuple</span></code> (see <a class="link" href="compliance.html#unordered.compliance.pairs">below</a>),
but that should be easily avoided.
</p>
<p>
When support is not available <code class="computeroutput"><span class="identifier">allocator_traits</span><span class="special">::</span><span class="identifier">construct</span></code>
and <code class="computeroutput"><span class="identifier">allocator_traits</span><span class="special">::</span><span class="identifier">destroy</span></code> are never called.
</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="unordered.compliance.pointer_traits"></a><a class="link" href="compliance.html#unordered.compliance.pointer_traits" title="Pointer Traits">Pointer Traits</a>
</h3></div></div></div>
<p>
<code class="computeroutput"><span class="identifier">pointer_traits</span></code> aren't used.
Instead, pointer types are obtained from rebound allocators, this can cause
problems if the allocator can't be used with incomplete types. If <code class="computeroutput"><span class="identifier">const_pointer</span></code> is not defined in the allocator,
<code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">pointer_to_other</span><span class="special">&lt;</span><span class="identifier">pointer</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">value_type</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
is used to obtain a const pointer.
</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="unordered.compliance.pairs0"></a><a name="unordered.compliance.pairs"></a><a class="link" href="compliance.html#unordered.compliance.pairs0" title="Pairs">Pairs</a>
</h3></div></div></div>
<p>
Since the containers use <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span></code>
they're limited to the version from the current standard library. But since
C++11 <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span></code>'s <code class="computeroutput"><span class="identifier">piecewise_construct</span></code>
based constructor is very useful, <code class="computeroutput"><span class="identifier">emplace</span></code>
emulates it with a <code class="computeroutput"><span class="identifier">piecewise_construct</span></code>
in the <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">unordered</span></code> namespace. So for example, the
following will work:
</p>
<pre class="programlisting"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">unordered_multimap</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">complex</span><span class="special">&gt;</span> <span class="identifier">x</span><span class="special">;</span>
<span class="identifier">x</span><span class="special">.</span><span class="identifier">emplace</span><span class="special">(</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">unordered</span><span class="special">::</span><span class="identifier">piecewise_construct</span><span class="special">,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">make_tuple</span><span class="special">(</span><span class="string">"key"</span><span class="special">),</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">make_tuple</span><span class="special">(</span><span class="number">1</span><span class="special">,</span> <span class="number">2</span><span class="special">));</span>
</pre>
<p>
Older drafts of the standard also supported variadic constructors for <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span></code>,
where the first argument would be used for the first part of the pair, and
the remaining for the second part.
</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="unordered.compliance.misc"></a><a class="link" href="compliance.html#unordered.compliance.misc" title="Miscellaneous">Miscellaneous</a>
</h3></div></div></div>
<p>
When swapping, <code class="computeroutput"><span class="identifier">Pred</span></code> and
<code class="computeroutput"><span class="identifier">Hash</span></code> are not currently swapped
by calling <code class="computeroutput"><span class="identifier">swap</span></code>, their copy
constructors are used. As a consequence when swapping an exception may be
thrown from their copy constructor.
</p>
<p>
Variadic constructor arguments for <code class="computeroutput"><span class="identifier">emplace</span></code>
are only used when both rvalue references and variadic template parameters
are available. Otherwise <code class="computeroutput"><span class="identifier">emplace</span></code>
can only take up to 10 constructors arguments.
</p>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2003, 2004 Jeremy B. Maitin-Shepard<br>Copyright © 2005-2008 Daniel
James<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="comparison.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../unordered.html"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="rationale.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>

View File

@@ -0,0 +1,237 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Equality Predicates and Hash Functions</title>
<link rel="stylesheet" href="../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../unordered.html" title="Chapter 45. Boost.Unordered">
<link rel="prev" href="buckets.html" title="The Data Structure">
<link rel="next" href="comparison.html" title="Comparison with Associative Containers">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
<td align="center"><a href="../../../index.html">Home</a></td>
<td align="center"><a href="../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="buckets.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../unordered.html"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="comparison.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="unordered.hash_equality"></a><a class="link" href="hash_equality.html" title="Equality Predicates and Hash Functions">Equality Predicates and Hash Functions</a>
</h2></div></div></div>
<p>
While the associative containers use an ordering relation to specify how the
elements are stored, the unordered associative containers use an equality predicate
and a hash function. For example, <code class="computeroutput"><a class="link" href="../boost/unordered_map.html" title="Class template unordered_map">boost::unordered_map</a></code>
is declared as:
</p>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span>
<span class="keyword">class</span> <span class="identifier">Key</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Mapped</span><span class="special">,</span>
<span class="keyword">class</span> <span class="identifier">Hash</span> <span class="special">=</span> <code class="computeroutput"><a class="link" href="../boost/hash.html" title="Struct template hash">boost::hash</a></code><span class="special">&lt;</span><span class="identifier">Key</span><span class="special">&gt;,</span>
<span class="keyword">class</span> <span class="identifier">Pred</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">equal_to</span><span class="special">&lt;</span><span class="identifier">Key</span><span class="special">&gt;,</span>
<span class="keyword">class</span> <span class="identifier">Alloc</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">allocator</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special">&lt;</span><span class="identifier">Key</span> <span class="keyword">const</span><span class="special">,</span> <span class="identifier">Mapped</span><span class="special">&gt;</span> <span class="special">&gt;</span> <span class="special">&gt;</span>
<span class="keyword">class</span> <code class="computeroutput"><a class="link" href="../boost/unordered_map.html" title="Class template unordered_map">unordered_map</a></code><span class="special">;</span>
</pre>
<p>
The hash function comes first as you might want to change the hash function
but not the equality predicate. For example, if you wanted to use the <a href="http://www.isthe.com/chongo/tech/comp/fnv/" target="_top">FNV-1 hash</a> you could
write:
</p>
<pre class="programlisting"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">unordered_map</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">,</span> <span class="keyword">int</span><span class="special">,</span> <span class="identifier">hash</span><span class="special">::</span><span class="identifier">fnv_1</span><span class="special">&gt;</span>
<span class="identifier">dictionary</span><span class="special">;</span>
</pre>
<p>
There is an <a href="../../../libs/unordered/examples/fnv1.hpp" target="_top">implementation
of FNV-1</a> in the examples directory.
</p>
<p>
If you wish to use a different equality function, you will also need to use
a matching hash function. For example, to implement a case insensitive dictionary
you need to define a case insensitive equality predicate and hash function:
</p>
<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">iequal_to</span>
<span class="special">{</span>
<span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">()(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">x</span><span class="special">,</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">y</span><span class="special">)</span> <span class="keyword">const</span>
<span class="special">{</span>
<span class="keyword">return</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">algorithm</span><span class="special">::</span><span class="identifier">iequals</span><span class="special">(</span><span class="identifier">x</span><span class="special">,</span> <span class="identifier">y</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">locale</span><span class="special">());</span>
<span class="special">}</span>
<span class="special">};</span>
<span class="keyword">struct</span> <span class="identifier">ihash</span>
<span class="special">{</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="keyword">operator</span><span class="special">()(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">x</span><span class="special">)</span> <span class="keyword">const</span>
<span class="special">{</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">seed</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">locale</span> <span class="identifier">locale</span><span class="special">;</span>
<span class="keyword">for</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">::</span><span class="identifier">const_iterator</span> <span class="identifier">it</span> <span class="special">=</span> <span class="identifier">x</span><span class="special">.</span><span class="identifier">begin</span><span class="special">();</span>
<span class="identifier">it</span> <span class="special">!=</span> <span class="identifier">x</span><span class="special">.</span><span class="identifier">end</span><span class="special">();</span> <span class="special">++</span><span class="identifier">it</span><span class="special">)</span>
<span class="special">{</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">hash_combine</span><span class="special">(</span><span class="identifier">seed</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">toupper</span><span class="special">(*</span><span class="identifier">it</span><span class="special">,</span> <span class="identifier">locale</span><span class="special">));</span>
<span class="special">}</span>
<span class="keyword">return</span> <span class="identifier">seed</span><span class="special">;</span>
<span class="special">}</span>
<span class="special">};</span>
</pre>
<p>
Which you can then use in a case insensitive dictionary:
</p>
<pre class="programlisting"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">unordered_map</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">,</span> <span class="keyword">int</span><span class="special">,</span> <span class="identifier">ihash</span><span class="special">,</span> <span class="identifier">iequal_to</span><span class="special">&gt;</span>
<span class="identifier">idictionary</span><span class="special">;</span>
</pre>
<p>
This is a simplified version of the example at <a href="../../../libs/unordered/examples/case_insensitive.hpp" target="_top">/libs/unordered/examples/case_insensitive.hpp</a>
which supports other locales and string types.
</p>
<div class="caution"><table border="0" summary="Caution">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="../../../doc/src/images/caution.png"></td>
<th align="left">Caution</th>
</tr>
<tr><td align="left" valign="top"><p>
Be careful when using the equality (<code class="computeroutput"><span class="special">==</span></code>)
operator with custom equality predicates, especially if you're using a function
pointer. If you compare two containers with different equality predicates
then the result is undefined. For most stateless function objects this is
impossible - since you can only compare objects with the same equality predicate
you know the equality predicates must be equal. But if you're using function
pointers or a stateful equality predicate (e.g. boost::function) then you
can get into trouble.
</p></td></tr>
</table></div>
<h3>
<a name="unordered.hash_equality.h0"></a>
<span class="phrase"><a name="unordered.hash_equality.custom_types"></a></span><a class="link" href="hash_equality.html#unordered.hash_equality.custom_types">Custom
Types</a>
</h3>
<p>
Similarly, a custom hash function can be used for custom types:
</p>
<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">point</span> <span class="special">{</span>
<span class="keyword">int</span> <span class="identifier">x</span><span class="special">;</span>
<span class="keyword">int</span> <span class="identifier">y</span><span class="special">;</span>
<span class="special">};</span>
<span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">==(</span><span class="identifier">point</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">p1</span><span class="special">,</span> <span class="identifier">point</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">p2</span><span class="special">)</span>
<span class="special">{</span>
<span class="keyword">return</span> <span class="identifier">p1</span><span class="special">.</span><span class="identifier">x</span> <span class="special">==</span> <span class="identifier">p2</span><span class="special">.</span><span class="identifier">x</span> <span class="special">&amp;&amp;</span> <span class="identifier">p1</span><span class="special">.</span><span class="identifier">y</span> <span class="special">==</span> <span class="identifier">p2</span><span class="special">.</span><span class="identifier">y</span><span class="special">;</span>
<span class="special">}</span>
<span class="keyword">struct</span> <span class="identifier">point_hash</span>
<span class="special">{</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="keyword">operator</span><span class="special">()(</span><span class="identifier">point</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">p</span><span class="special">)</span> <span class="keyword">const</span>
<span class="special">{</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">seed</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">hash_combine</span><span class="special">(</span><span class="identifier">seed</span><span class="special">,</span> <span class="identifier">p</span><span class="special">.</span><span class="identifier">x</span><span class="special">);</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">hash_combine</span><span class="special">(</span><span class="identifier">seed</span><span class="special">,</span> <span class="identifier">p</span><span class="special">.</span><span class="identifier">y</span><span class="special">);</span>
<span class="keyword">return</span> <span class="identifier">seed</span><span class="special">;</span>
<span class="special">}</span>
<span class="special">};</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">unordered_multiset</span><span class="special">&lt;</span><span class="identifier">point</span><span class="special">,</span> <span class="identifier">point_hash</span><span class="special">&gt;</span> <span class="identifier">points</span><span class="special">;</span>
</pre>
<p>
Since the default hash function is <a class="link" href="../hash.html" title="Chapter 10. Boost.ContainerHash">Boost.Hash</a>,
we can <a class="link" href="../hash/custom.html" title="Extending boost::hash for a custom data type">extend it to support the type</a> so
that the hash function doesn't need to be explicitly given:
</p>
<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">point</span> <span class="special">{</span>
<span class="keyword">int</span> <span class="identifier">x</span><span class="special">;</span>
<span class="keyword">int</span> <span class="identifier">y</span><span class="special">;</span>
<span class="special">};</span>
<span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">==(</span><span class="identifier">point</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">p1</span><span class="special">,</span> <span class="identifier">point</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">p2</span><span class="special">)</span>
<span class="special">{</span>
<span class="keyword">return</span> <span class="identifier">p1</span><span class="special">.</span><span class="identifier">x</span> <span class="special">==</span> <span class="identifier">p2</span><span class="special">.</span><span class="identifier">x</span> <span class="special">&amp;&amp;</span> <span class="identifier">p1</span><span class="special">.</span><span class="identifier">y</span> <span class="special">==</span> <span class="identifier">p2</span><span class="special">.</span><span class="identifier">y</span><span class="special">;</span>
<span class="special">}</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">hash_value</span><span class="special">(</span><span class="identifier">point</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">p</span><span class="special">)</span> <span class="special">{</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">seed</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">hash_combine</span><span class="special">(</span><span class="identifier">seed</span><span class="special">,</span> <span class="identifier">p</span><span class="special">.</span><span class="identifier">x</span><span class="special">);</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">hash_combine</span><span class="special">(</span><span class="identifier">seed</span><span class="special">,</span> <span class="identifier">p</span><span class="special">.</span><span class="identifier">y</span><span class="special">);</span>
<span class="keyword">return</span> <span class="identifier">seed</span><span class="special">;</span>
<span class="special">}</span>
<span class="comment">// Now the default function objects work.</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">unordered_multiset</span><span class="special">&lt;</span><span class="identifier">point</span><span class="special">&gt;</span> <span class="identifier">points</span><span class="special">;</span>
</pre>
<p>
See the <a class="link" href="../hash/custom.html" title="Extending boost::hash for a custom data type">Boost.Hash documentation</a> for more
detail on how to do this. Remember that it relies on extensions to the draft
standard - so it won't work for other implementations of the unordered associative
containers, you'll need to explicitly use Boost.Hash.
</p>
<div class="table">
<a name="unordered.hash_equality.access_methods"></a><p class="title"><b>Table 45.3. Methods for accessing the hash and equality functions.</b></p>
<div class="table-contents"><table class="table" summary="Methods for accessing the hash and equality functions.">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Method
</p>
</th>
<th>
<p>
Description
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">hasher</span> <span class="identifier">hash_function</span><span class="special">()</span> <span class="keyword">const</span></code>
</p>
</td>
<td>
<p>
Returns the container's hash function.
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">key_equal</span> <span class="identifier">key_eq</span><span class="special">()</span> <span class="keyword">const</span></code>
</p>
</td>
<td>
<p>
Returns the container's key equality function.
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break">
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2003, 2004 Jeremy B. Maitin-Shepard<br>Copyright © 2005-2008 Daniel
James<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="buckets.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../unordered.html"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="comparison.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>

View File

@@ -0,0 +1,137 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Implementation Rationale</title>
<link rel="stylesheet" href="../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../unordered.html" title="Chapter 45. Boost.Unordered">
<link rel="prev" href="compliance.html" title="Standard Compliance">
<link rel="next" href="changes.html" title="Change Log">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
<td align="center"><a href="../../../index.html">Home</a></td>
<td align="center"><a href="../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="compliance.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../unordered.html"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="changes.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="unordered.rationale"></a><a class="link" href="rationale.html" title="Implementation Rationale">Implementation Rationale</a>
</h2></div></div></div>
<p>
The intent of this library is to implement the unordered containers in the
draft standard, so the interface was fixed. But there are still some implementation
decisions to make. The priorities are conformance to the standard and portability.
</p>
<p>
The <a href="http://en.wikipedia.org/wiki/Hash_table" target="_top">Wikipedia article
on hash tables</a> has a good summary of the implementation issues for
hash tables in general.
</p>
<h3>
<a name="unordered.rationale.h0"></a>
<span class="phrase"><a name="unordered.rationale.data_structure"></a></span><a class="link" href="rationale.html#unordered.rationale.data_structure">Data
Structure</a>
</h3>
<p>
By specifying an interface for accessing the buckets of the container the standard
pretty much requires that the hash table uses chained addressing.
</p>
<p>
It would be conceivable to write a hash table that uses another method. For
example, it could use open addressing, and use the lookup chain to act as a
bucket but there are some serious problems with this:
</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
The draft standard requires that pointers to elements aren't invalidated,
so the elements can't be stored in one array, but will need a layer of
indirection instead - losing the efficiency and most of the memory gain,
the main advantages of open addressing.
</li>
<li class="listitem">
Local iterators would be very inefficient and may not be able to meet the
complexity requirements.
</li>
<li class="listitem">
There are also the restrictions on when iterators can be invalidated. Since
open addressing degrades badly when there are a high number of collisions
the restrictions could prevent a rehash when it's really needed. The maximum
load factor could be set to a fairly low value to work around this - but
the standard requires that it is initially set to 1.0.
</li>
<li class="listitem">
And since the standard is written with a eye towards chained addressing,
users will be surprised if the performance doesn't reflect that.
</li>
</ul></div>
<p>
So chained addressing is used.
</p>
<h3>
<a name="unordered.rationale.h1"></a>
<span class="phrase"><a name="unordered.rationale.number_of_buckets"></a></span><a class="link" href="rationale.html#unordered.rationale.number_of_buckets">Number
of Buckets</a>
</h3>
<p>
There are two popular methods for choosing the number of buckets in a hash
table. One is to have a prime number of buckets, another is to use a power
of 2.
</p>
<p>
Using a prime number of buckets, and choosing a bucket by using the modulus
of the hash function's result will usually give a good result. The downside
is that the required modulus operation is fairly expensive. This is what the
containers do in most cases.
</p>
<p>
Using a power of 2 allows for much quicker selection of the bucket to use,
but at the expense of losing the upper bits of the hash value. For some specially
designed hash functions it is possible to do this and still get a good result
but as the containers can take arbitrary hash functions this can't be relied
on.
</p>
<p>
To avoid this a transformation could be applied to the hash function, for an
example see <a href="http://web.archive.org/web/20121102023700/http://www.concentric.net/~Ttwang/tech/inthash.htm" target="_top">Thomas
Wang's article on integer hash functions</a>. Unfortunately, a transformation
like Wang's requires knowledge of the number of bits in the hash value, so
it isn't portable enough to use as a default. It can applicable in certain
cases so the containers have a policy based implementation that can use this
alternative technique.
</p>
<p>
Currently this is only done on 64 bit architectures, where prime number modulus
can be expensive. Although this varies depending on the architecture, so I
probably should revisit it.
</p>
<p>
I'm also thinking of introducing a mechanism whereby a hash function can indicate
that it's safe to be used directly with power of 2 buckets, in which case a
faster plain power of 2 implementation can be used.
</p>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2003, 2004 Jeremy B. Maitin-Shepard<br>Copyright © 2005-2008 Daniel
James<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="compliance.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../unordered.html"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="changes.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>

View File

@@ -0,0 +1,130 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Reference</title>
<link rel="stylesheet" href="../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../unordered.html" title="Chapter 45. Boost.Unordered">
<link rel="prev" href="changes.html" title="Change Log">
<link rel="next" href="../boost/unordered/node_handle_set.html" title="Class template node_handle_set">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
<td align="center"><a href="../../../index.html">Home</a></td>
<td align="center"><a href="../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="changes.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../unordered.html"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../boost/unordered/node_handle_set.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="unordered.reference"></a>Reference</h2></div></div></div>
<div class="toc"><dl class="toc">
<dt><span class="section"><a href="reference.html#header.boost.unordered_set_hpp">Header &lt;boost/unordered_set.hpp&gt;</a></span></dt>
<dt><span class="section"><a href="reference.html#header.boost.unordered_map_hpp">Header &lt;boost/unordered_map.hpp&gt;</a></span></dt>
</dl></div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="header.boost.unordered_set_hpp"></a>Header &lt;<a href="../../../boost/unordered_set.hpp" target="_top">boost/unordered_set.hpp</a>&gt;</h3></div></div></div>
<pre class="synopsis"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Value<span class="special">,</span> <span class="keyword">typename</span> Hash <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">hash</span><span class="special">&lt;</span><span class="identifier">Value</span><span class="special">&gt;</span><span class="special">,</span>
<span class="keyword">typename</span> Pred <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">equal_to</span><span class="special">&lt;</span><span class="identifier">Value</span><span class="special">&gt;</span><span class="special">,</span>
<span class="keyword">typename</span> Alloc <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">allocator</span><span class="special">&lt;</span><span class="identifier">Value</span><span class="special">&gt;</span> <span class="special">&gt;</span>
<span class="keyword">class</span> <a class="link" href="../boost/unordered_set.html" title="Class template unordered_set">unordered_set</a><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Value<span class="special">,</span> <span class="keyword">typename</span> Hash<span class="special">,</span> <span class="keyword">typename</span> Pred<span class="special">,</span> <span class="keyword">typename</span> Alloc<span class="special">&gt;</span>
<span class="keyword">bool</span> <a class="link" href="../boost/unordered_set.html#boost.unordered_set.operator=="><span class="keyword">operator</span><span class="special">==</span></a><span class="special">(</span><span class="identifier">unordered_set</span><span class="special">&lt;</span><span class="identifier">Value</span><span class="special">,</span> <span class="identifier">Hash</span><span class="special">,</span> <span class="identifier">Pred</span><span class="special">,</span> <span class="identifier">Alloc</span><span class="special">&gt;</span> <span class="keyword">const</span><span class="special">&amp;</span><span class="special">,</span>
<span class="identifier">unordered_set</span><span class="special">&lt;</span><span class="identifier">Value</span><span class="special">,</span> <span class="identifier">Hash</span><span class="special">,</span> <span class="identifier">Pred</span><span class="special">,</span> <span class="identifier">Alloc</span><span class="special">&gt;</span> <span class="keyword">const</span><span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Value<span class="special">,</span> <span class="keyword">typename</span> Hash<span class="special">,</span> <span class="keyword">typename</span> Pred<span class="special">,</span> <span class="keyword">typename</span> Alloc<span class="special">&gt;</span>
<span class="keyword">bool</span> <a class="link" href="../boost/unordered_set.html#boost.unordered_set.operator!="><span class="keyword">operator</span><span class="special">!=</span></a><span class="special">(</span><span class="identifier">unordered_set</span><span class="special">&lt;</span><span class="identifier">Value</span><span class="special">,</span> <span class="identifier">Hash</span><span class="special">,</span> <span class="identifier">Pred</span><span class="special">,</span> <span class="identifier">Alloc</span><span class="special">&gt;</span> <span class="keyword">const</span><span class="special">&amp;</span><span class="special">,</span>
<span class="identifier">unordered_set</span><span class="special">&lt;</span><span class="identifier">Value</span><span class="special">,</span> <span class="identifier">Hash</span><span class="special">,</span> <span class="identifier">Pred</span><span class="special">,</span> <span class="identifier">Alloc</span><span class="special">&gt;</span> <span class="keyword">const</span><span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Value<span class="special">,</span> <span class="keyword">typename</span> Hash<span class="special">,</span> <span class="keyword">typename</span> Pred<span class="special">,</span> <span class="keyword">typename</span> Alloc<span class="special">&gt;</span>
<span class="keyword">void</span> <a class="link" href="../boost/unordered_set.html#boost.unordered_set.swap"><span class="identifier">swap</span></a><span class="special">(</span><span class="identifier">unordered_set</span><span class="special">&lt;</span><span class="identifier">Value</span><span class="special">,</span> <span class="identifier">Hash</span><span class="special">,</span> <span class="identifier">Pred</span><span class="special">,</span> <span class="identifier">Alloc</span><span class="special">&gt;</span><span class="special">&amp;</span><span class="special">,</span>
<span class="identifier">unordered_set</span><span class="special">&lt;</span><span class="identifier">Value</span><span class="special">,</span> <span class="identifier">Hash</span><span class="special">,</span> <span class="identifier">Pred</span><span class="special">,</span> <span class="identifier">Alloc</span><span class="special">&gt;</span><span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Value<span class="special">,</span> <span class="keyword">typename</span> Hash <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">hash</span><span class="special">&lt;</span><span class="identifier">Value</span><span class="special">&gt;</span><span class="special">,</span>
<span class="keyword">typename</span> Pred <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">equal_to</span><span class="special">&lt;</span><span class="identifier">Value</span><span class="special">&gt;</span><span class="special">,</span>
<span class="keyword">typename</span> Alloc <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">allocator</span><span class="special">&lt;</span><span class="identifier">Value</span><span class="special">&gt;</span> <span class="special">&gt;</span>
<span class="keyword">class</span> <a class="link" href="../boost/unordered_multiset.html" title="Class template unordered_multiset">unordered_multiset</a><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Value<span class="special">,</span> <span class="keyword">typename</span> Hash<span class="special">,</span> <span class="keyword">typename</span> Pred<span class="special">,</span> <span class="keyword">typename</span> Alloc<span class="special">&gt;</span>
<span class="keyword">bool</span> <a class="link" href="../boost/unordered_multiset.html#boost.unordered_multiset.operator=="><span class="keyword">operator</span><span class="special">==</span></a><span class="special">(</span><span class="identifier">unordered_multiset</span><span class="special">&lt;</span><span class="identifier">Value</span><span class="special">,</span> <span class="identifier">Hash</span><span class="special">,</span> <span class="identifier">Pred</span><span class="special">,</span> <span class="identifier">Alloc</span><span class="special">&gt;</span> <span class="keyword">const</span><span class="special">&amp;</span><span class="special">,</span>
<span class="identifier">unordered_multiset</span><span class="special">&lt;</span><span class="identifier">Value</span><span class="special">,</span> <span class="identifier">Hash</span><span class="special">,</span> <span class="identifier">Pred</span><span class="special">,</span> <span class="identifier">Alloc</span><span class="special">&gt;</span> <span class="keyword">const</span><span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Value<span class="special">,</span> <span class="keyword">typename</span> Hash<span class="special">,</span> <span class="keyword">typename</span> Pred<span class="special">,</span> <span class="keyword">typename</span> Alloc<span class="special">&gt;</span>
<span class="keyword">bool</span> <a class="link" href="../boost/unordered_multiset.html#boost.unordered_multiset.operator!="><span class="keyword">operator</span><span class="special">!=</span></a><span class="special">(</span><span class="identifier">unordered_multiset</span><span class="special">&lt;</span><span class="identifier">Value</span><span class="special">,</span> <span class="identifier">Hash</span><span class="special">,</span> <span class="identifier">Pred</span><span class="special">,</span> <span class="identifier">Alloc</span><span class="special">&gt;</span> <span class="keyword">const</span><span class="special">&amp;</span><span class="special">,</span>
<span class="identifier">unordered_multiset</span><span class="special">&lt;</span><span class="identifier">Value</span><span class="special">,</span> <span class="identifier">Hash</span><span class="special">,</span> <span class="identifier">Pred</span><span class="special">,</span> <span class="identifier">Alloc</span><span class="special">&gt;</span> <span class="keyword">const</span><span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Value<span class="special">,</span> <span class="keyword">typename</span> Hash<span class="special">,</span> <span class="keyword">typename</span> Pred<span class="special">,</span> <span class="keyword">typename</span> Alloc<span class="special">&gt;</span>
<span class="keyword">void</span> <a class="link" href="../boost/unordered_multiset.html#boost.unordered_multiset.swap"><span class="identifier">swap</span></a><span class="special">(</span><span class="identifier">unordered_multiset</span><span class="special">&lt;</span><span class="identifier">Value</span><span class="special">,</span> <span class="identifier">Hash</span><span class="special">,</span> <span class="identifier">Pred</span><span class="special">,</span> <span class="identifier">Alloc</span><span class="special">&gt;</span><span class="special">&amp;</span><span class="special">,</span>
<span class="identifier">unordered_multiset</span><span class="special">&lt;</span><span class="identifier">Value</span><span class="special">,</span> <span class="identifier">Hash</span><span class="special">,</span> <span class="identifier">Pred</span><span class="special">,</span> <span class="identifier">Alloc</span><span class="special">&gt;</span><span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
<span class="keyword">namespace</span> <span class="identifier">unordered</span> <span class="special">{</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> ImplementationDefined<span class="special">&gt;</span> <span class="keyword">class</span> <a class="link" href="../boost/unordered/node_handle_set.html" title="Class template node_handle_set">node_handle_set</a><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> ImplementationDefined<span class="special">&gt;</span>
<span class="keyword">void</span> <a class="link" href="../boost/unordered/node_handle_set.html#boost.unordered.node_handle_set.swap"><span class="identifier">swap</span></a><span class="special">(</span><span class="identifier">node_handle_set</span><span class="special">&lt;</span><span class="identifier">ImplementationDefined</span><span class="special">&gt;</span><span class="special">&amp;</span><span class="special">,</span>
<span class="identifier">node_handle_set</span><span class="special">&lt;</span><span class="identifier">ImplementationDefined</span><span class="special">&gt;</span><span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
<span class="special">}</span>
<span class="special">}</span></pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="header.boost.unordered_map_hpp"></a>Header &lt;<a href="../../../boost/unordered_map.hpp" target="_top">boost/unordered_map.hpp</a>&gt;</h3></div></div></div>
<pre class="synopsis"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Key<span class="special">,</span> <span class="keyword">typename</span> Mapped<span class="special">,</span> <span class="keyword">typename</span> Hash <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">hash</span><span class="special">&lt;</span><span class="identifier">Key</span><span class="special">&gt;</span><span class="special">,</span>
<span class="keyword">typename</span> Pred <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">equal_to</span><span class="special">&lt;</span><span class="identifier">Key</span><span class="special">&gt;</span><span class="special">,</span>
<span class="keyword">typename</span> Alloc <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">allocator</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special">&lt;</span><span class="identifier">Key</span> <span class="keyword">const</span><span class="special">,</span> <span class="identifier">Mapped</span><span class="special">&gt;&gt;</span> <span class="special">&gt;</span>
<span class="keyword">class</span> <a class="link" href="../boost/unordered_map.html" title="Class template unordered_map">unordered_map</a><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Key<span class="special">,</span> <span class="keyword">typename</span> Mapped<span class="special">,</span> <span class="keyword">typename</span> Hash<span class="special">,</span> <span class="keyword">typename</span> Pred<span class="special">,</span>
<span class="keyword">typename</span> Alloc<span class="special">&gt;</span>
<span class="keyword">bool</span> <a class="link" href="../boost/unordered_map.html#boost.unordered_map.operator=="><span class="keyword">operator</span><span class="special">==</span></a><span class="special">(</span><span class="identifier">unordered_map</span><span class="special">&lt;</span><span class="identifier">Key</span><span class="special">,</span> <span class="identifier">Mapped</span><span class="special">,</span> <span class="identifier">Hash</span><span class="special">,</span> <span class="identifier">Pred</span><span class="special">,</span> <span class="identifier">Alloc</span><span class="special">&gt;</span> <span class="keyword">const</span><span class="special">&amp;</span><span class="special">,</span>
<span class="identifier">unordered_map</span><span class="special">&lt;</span><span class="identifier">Key</span><span class="special">,</span> <span class="identifier">Mapped</span><span class="special">,</span> <span class="identifier">Hash</span><span class="special">,</span> <span class="identifier">Pred</span><span class="special">,</span> <span class="identifier">Alloc</span><span class="special">&gt;</span> <span class="keyword">const</span><span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Key<span class="special">,</span> <span class="keyword">typename</span> Mapped<span class="special">,</span> <span class="keyword">typename</span> Hash<span class="special">,</span> <span class="keyword">typename</span> Pred<span class="special">,</span>
<span class="keyword">typename</span> Alloc<span class="special">&gt;</span>
<span class="keyword">bool</span> <a class="link" href="../boost/unordered_map.html#boost.unordered_map.operator!="><span class="keyword">operator</span><span class="special">!=</span></a><span class="special">(</span><span class="identifier">unordered_map</span><span class="special">&lt;</span><span class="identifier">Key</span><span class="special">,</span> <span class="identifier">Mapped</span><span class="special">,</span> <span class="identifier">Hash</span><span class="special">,</span> <span class="identifier">Pred</span><span class="special">,</span> <span class="identifier">Alloc</span><span class="special">&gt;</span> <span class="keyword">const</span><span class="special">&amp;</span><span class="special">,</span>
<span class="identifier">unordered_map</span><span class="special">&lt;</span><span class="identifier">Key</span><span class="special">,</span> <span class="identifier">Mapped</span><span class="special">,</span> <span class="identifier">Hash</span><span class="special">,</span> <span class="identifier">Pred</span><span class="special">,</span> <span class="identifier">Alloc</span><span class="special">&gt;</span> <span class="keyword">const</span><span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Key<span class="special">,</span> <span class="keyword">typename</span> Mapped<span class="special">,</span> <span class="keyword">typename</span> Hash<span class="special">,</span> <span class="keyword">typename</span> Pred<span class="special">,</span>
<span class="keyword">typename</span> Alloc<span class="special">&gt;</span>
<span class="keyword">void</span> <a class="link" href="../boost/unordered_map.html#boost.unordered_map.swap"><span class="identifier">swap</span></a><span class="special">(</span><span class="identifier">unordered_map</span><span class="special">&lt;</span><span class="identifier">Key</span><span class="special">,</span> <span class="identifier">Mapped</span><span class="special">,</span> <span class="identifier">Hash</span><span class="special">,</span> <span class="identifier">Pred</span><span class="special">,</span> <span class="identifier">Alloc</span><span class="special">&gt;</span><span class="special">&amp;</span><span class="special">,</span>
<span class="identifier">unordered_map</span><span class="special">&lt;</span><span class="identifier">Key</span><span class="special">,</span> <span class="identifier">Mapped</span><span class="special">,</span> <span class="identifier">Hash</span><span class="special">,</span> <span class="identifier">Pred</span><span class="special">,</span> <span class="identifier">Alloc</span><span class="special">&gt;</span><span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Key<span class="special">,</span> <span class="keyword">typename</span> Mapped<span class="special">,</span> <span class="keyword">typename</span> Hash <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">hash</span><span class="special">&lt;</span><span class="identifier">Key</span><span class="special">&gt;</span><span class="special">,</span>
<span class="keyword">typename</span> Pred <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">equal_to</span><span class="special">&lt;</span><span class="identifier">Key</span><span class="special">&gt;</span><span class="special">,</span>
<span class="keyword">typename</span> Alloc <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">allocator</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special">&lt;</span><span class="identifier">Key</span> <span class="keyword">const</span><span class="special">,</span> <span class="identifier">Mapped</span><span class="special">&gt;&gt;</span> <span class="special">&gt;</span>
<span class="keyword">class</span> <a class="link" href="../boost/unordered_multimap.html" title="Class template unordered_multimap">unordered_multimap</a><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Key<span class="special">,</span> <span class="keyword">typename</span> Mapped<span class="special">,</span> <span class="keyword">typename</span> Hash<span class="special">,</span> <span class="keyword">typename</span> Pred<span class="special">,</span>
<span class="keyword">typename</span> Alloc<span class="special">&gt;</span>
<span class="keyword">bool</span> <a class="link" href="../boost/unordered_multimap.html#boost.unordered_multimap.operator=="><span class="keyword">operator</span><span class="special">==</span></a><span class="special">(</span><span class="identifier">unordered_multimap</span><span class="special">&lt;</span><span class="identifier">Key</span><span class="special">,</span> <span class="identifier">Mapped</span><span class="special">,</span> <span class="identifier">Hash</span><span class="special">,</span> <span class="identifier">Pred</span><span class="special">,</span> <span class="identifier">Alloc</span><span class="special">&gt;</span> <span class="keyword">const</span><span class="special">&amp;</span><span class="special">,</span>
<span class="identifier">unordered_multimap</span><span class="special">&lt;</span><span class="identifier">Key</span><span class="special">,</span> <span class="identifier">Mapped</span><span class="special">,</span> <span class="identifier">Hash</span><span class="special">,</span> <span class="identifier">Pred</span><span class="special">,</span> <span class="identifier">Alloc</span><span class="special">&gt;</span> <span class="keyword">const</span><span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Key<span class="special">,</span> <span class="keyword">typename</span> Mapped<span class="special">,</span> <span class="keyword">typename</span> Hash<span class="special">,</span> <span class="keyword">typename</span> Pred<span class="special">,</span>
<span class="keyword">typename</span> Alloc<span class="special">&gt;</span>
<span class="keyword">bool</span> <a class="link" href="../boost/unordered_multimap.html#boost.unordered_multimap.operator!="><span class="keyword">operator</span><span class="special">!=</span></a><span class="special">(</span><span class="identifier">unordered_multimap</span><span class="special">&lt;</span><span class="identifier">Key</span><span class="special">,</span> <span class="identifier">Mapped</span><span class="special">,</span> <span class="identifier">Hash</span><span class="special">,</span> <span class="identifier">Pred</span><span class="special">,</span> <span class="identifier">Alloc</span><span class="special">&gt;</span> <span class="keyword">const</span><span class="special">&amp;</span><span class="special">,</span>
<span class="identifier">unordered_multimap</span><span class="special">&lt;</span><span class="identifier">Key</span><span class="special">,</span> <span class="identifier">Mapped</span><span class="special">,</span> <span class="identifier">Hash</span><span class="special">,</span> <span class="identifier">Pred</span><span class="special">,</span> <span class="identifier">Alloc</span><span class="special">&gt;</span> <span class="keyword">const</span><span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Key<span class="special">,</span> <span class="keyword">typename</span> Mapped<span class="special">,</span> <span class="keyword">typename</span> Hash<span class="special">,</span> <span class="keyword">typename</span> Pred<span class="special">,</span>
<span class="keyword">typename</span> Alloc<span class="special">&gt;</span>
<span class="keyword">void</span> <a class="link" href="../boost/unordered_multimap.html#boost.unordered_multimap.swap"><span class="identifier">swap</span></a><span class="special">(</span><span class="identifier">unordered_multimap</span><span class="special">&lt;</span><span class="identifier">Key</span><span class="special">,</span> <span class="identifier">Mapped</span><span class="special">,</span> <span class="identifier">Hash</span><span class="special">,</span> <span class="identifier">Pred</span><span class="special">,</span> <span class="identifier">Alloc</span><span class="special">&gt;</span><span class="special">&amp;</span><span class="special">,</span>
<span class="identifier">unordered_multimap</span><span class="special">&lt;</span><span class="identifier">Key</span><span class="special">,</span> <span class="identifier">Mapped</span><span class="special">,</span> <span class="identifier">Hash</span><span class="special">,</span> <span class="identifier">Pred</span><span class="special">,</span> <span class="identifier">Alloc</span><span class="special">&gt;</span><span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
<span class="keyword">namespace</span> <span class="identifier">unordered</span> <span class="special">{</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> ImplementationDefined<span class="special">&gt;</span> <span class="keyword">class</span> <a class="link" href="../boost/unordered/node_handle_map.html" title="Class template node_handle_map">node_handle_map</a><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> ImplementationDefined<span class="special">&gt;</span>
<span class="keyword">void</span> <a class="link" href="../boost/unordered/node_handle_map.html#boost.unordered.node_handle_map.swap"><span class="identifier">swap</span></a><span class="special">(</span><span class="identifier">node_handle_map</span><span class="special">&lt;</span><span class="identifier">ImplementationDefined</span><span class="special">&gt;</span><span class="special">&amp;</span><span class="special">,</span>
<span class="identifier">node_handle_map</span><span class="special">&lt;</span><span class="identifier">ImplementationDefined</span><span class="special">&gt;</span><span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
<span class="special">}</span>
<span class="special">}</span></pre>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2003, 2004 Jeremy B. Maitin-Shepard<br>Copyright © 2005-2008 Daniel
James<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="changes.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../unordered.html"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../boost/unordered/node_handle_set.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>