1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 2<html> 3<head> 4<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 5<title>Chapter 10. Boost.ContainerHash</title> 6<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css"> 7<meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> 8<link rel="home" href="index.html" title="The Boost C++ Libraries BoostBook Documentation Subset"> 9<link rel="up" href="libraries.html" title="Part I. The Boost C++ Libraries (BoostBook Subset)"> 10<link rel="prev" href="container/release_notes.html" title="Release Notes"> 11<link rel="next" href="hash/tutorial.html" title="Tutorial"> 12</head> 13<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> 14<table cellpadding="2" width="100%"><tr> 15<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../boost.png"></td> 16<td align="center"><a href="../../index.html">Home</a></td> 17<td align="center"><a href="../../libs/libraries.htm">Libraries</a></td> 18<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> 19<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> 20<td align="center"><a href="../../more/index.htm">More</a></td> 21</tr></table> 22<hr> 23<div class="spirit-nav"> 24<a accesskey="p" href="container/release_notes.html"><img src="../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="libraries.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/tutorial.html"><img src="../../doc/src/images/next.png" alt="Next"></a> 25</div> 26<div class="chapter"> 27<div class="titlepage"><div> 28<div><h2 class="title"> 29<a name="hash"></a>Chapter 10. Boost.ContainerHash</h2></div> 30<div><div class="author"><h3 class="author"> 31<span class="firstname">Daniel</span> <span class="surname">James</span> 32</h3></div></div> 33<div><p class="copyright">Copyright © 2005-2008 Daniel 34 James</p></div> 35<div><div class="legalnotice"> 36<a name="hash.legal"></a><p> 37 Distributed under the Boost Software License, Version 1.0. (See accompanying 38 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>) 39 </p> 40</div></div> 41</div></div> 42<div class="toc"> 43<p><b>Table of Contents</b></p> 44<dl class="toc"> 45<dt><span class="section"><a href="hash.html#hash.intro">Introduction</a></span></dt> 46<dt><span class="section"><a href="hash/tutorial.html">Tutorial</a></span></dt> 47<dt><span class="section"><a href="hash/custom.html">Extending boost::hash for a custom data type</a></span></dt> 48<dt><span class="section"><a href="hash/combine.html">Combining hash values</a></span></dt> 49<dt><span class="section"><a href="hash/portability.html">Portability</a></span></dt> 50<dt><span class="section"><a href="hash/disable.html">Disabling The Extensions</a></span></dt> 51<dt><span class="section"><a href="hash/changes.html">Change Log</a></span></dt> 52<dt><span class="section"><a href="hash/rationale.html">Rationale</a></span></dt> 53<dt><span class="section"><a href="hash/reference.html">Reference</a></span></dt> 54<dd><dl> 55<dt><span class="section"><a href="hash/reference.html#hash.reference.specification"></a></span></dt> 56<dt><span class="section"><a href="hash/reference.html#header.boost.container_hash.hash_hpp">Header <boost/container_hash/hash.hpp></a></span></dt> 57</dl></dd> 58<dt><span class="section"><a href="hash/links.html">Links</a></span></dt> 59<dt><span class="section"><a href="hash/acknowledgements.html">Acknowledgements</a></span></dt> 60</dl> 61</div> 62<div class="section"> 63<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 64<a name="hash.intro"></a><a class="link" href="hash.html#hash.intro" title="Introduction">Introduction</a> 65</h2></div></div></div> 66<p> 67 <code class="computeroutput"><a class="link" href="boost/hash.html" title="Struct template hash">boost::hash</a></code> is an implementation of 68 the <a href="http://en.wikipedia.org/wiki/Hash_function" target="_top">hash function</a> 69 object specified by the <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf" target="_top">Draft 70 Technical Report on C++ Library Extensions</a> (TR1). It is the default 71 hash function for <a class="link" href="unordered.html" title="Chapter 44. Boost.Unordered">Boost.Unordered</a>, <a class="link" href="intrusive/unordered_set_unordered_multiset.html" title="Semi-Intrusive unordered associative containers: unordered_set, unordered_multiset">Boost.Intrusive</a>'s 72 unordered associative containers, and <a href="../../libs/multi_index/doc/index.html" target="_top">Boost.MultiIndex</a>'s 73 hash indicies and <a href="../../libs/bimap/index.html" target="_top">Boost.Bimap</a>'s 74 <code class="computeroutput"><span class="identifier">unordered_set_of</span></code>. 75 </p> 76<p> 77 As it is compliant with <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf" target="_top">TR1</a>, 78 it will work with: 79 </p> 80<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 81<li class="listitem"> 82 integers 83 </li> 84<li class="listitem"> 85 floats 86 </li> 87<li class="listitem"> 88 pointers 89 </li> 90<li class="listitem"> 91 strings 92 </li> 93</ul></div> 94<p> 95 It also implements the extension proposed by Peter Dimov in issue 6.18 of the 96 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1837.pdf" target="_top">Library 97 Extension Technical Report Issues List</a> (page 63), this adds support 98 for: 99 </p> 100<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 101<li class="listitem"> 102 arrays 103 </li> 104<li class="listitem"> 105 <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span></code> 106 </li> 107<li class="listitem"> 108 the standard containers. 109 </li> 110<li class="listitem"> 111 extending <code class="computeroutput"><a class="link" href="boost/hash.html" title="Struct template hash">boost::hash</a></code> for custom 112 types. 113 </li> 114</ul></div> 115<div class="note"><table border="0" summary="Note"> 116<tr> 117<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../doc/src/images/note.png"></td> 118<th align="left">Note</th> 119</tr> 120<tr><td align="left" valign="top"><p> 121 This hash function is designed to be used in containers based on the STL 122 and is not suitable as a general purpose hash function. For more details 123 see the <a class="link" href="hash/rationale.html" title="Rationale">rationale</a>. 124 </p></td></tr> 125</table></div> 126</div> 127</div> 128<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 129<td align="left"><p><small>Last revised: August 11, 2020 at 15:03:47 GMT</small></p></td> 130<td align="right"><div class="copyright-footer"></div></td> 131</tr></table> 132<hr> 133<div class="spirit-nav"> 134<a accesskey="p" href="container/release_notes.html"><img src="../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="libraries.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/tutorial.html"><img src="../../doc/src/images/next.png" alt="Next"></a> 135</div> 136</body> 137</html> 138