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>Struct template hash</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="../hash/reference.html#header.boost.container_hash.hash_hpp" title="Header <boost/container_hash/hash.hpp>"> 10<link rel="prev" href="../hash/reference.html" title="Reference"> 11<link rel="next" href="hash_bool_1_3_11_11_2_2_2.html" title="Struct hash<bool>"> 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="../hash/reference.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../hash/reference.html#header.boost.container_hash.hash_hpp"><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_bool_1_3_11_11_2_2_2.html"><img src="../../../doc/src/images/next.png" alt="Next"></a> 25</div> 26<div class="refentry"> 27<a name="boost.hash"></a><div class="titlepage"></div> 28<div class="refnamediv"> 29<h2><span class="refentrytitle">Struct template hash</span></h2> 30<p>boost::hash — A <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf" target="_top">TR1</a> compliant hash function object.</p> 31</div> 32<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2> 33<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="../hash/reference.html#header.boost.container_hash.hash_hpp" title="Header <boost/container_hash/hash.hpp>">boost/container_hash/hash.hpp</a>> 34 35</span><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> T<span class="special">></span> 36<span class="keyword">struct</span> <a class="link" href="hash.html" title="Struct template hash">hash</a> <span class="special">:</span> <span class="keyword">public</span> std::unary_function<T, std::size_t> <span class="special">{</span> 37 <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <a class="link" href="hash.html#id-1_3_11_11_2_2_1_4-bb"><span class="keyword">operator</span><span class="special">(</span><span class="special">)</span></a><span class="special">(</span><span class="identifier">T</span> <span class="keyword">const</span><span class="special">&</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> 38<span class="special">}</span><span class="special">;</span></pre></div> 39<div class="refsect1"> 40<a name="id-1.3.11.11.3.6.4"></a><h2>Description</h2> 41<pre class="literallayout"><span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <a name="id-1_3_11_11_2_2_1_4-bb"></a><span class="keyword">operator</span><span class="special">(</span><span class="special">)</span><span class="special">(</span><span class="identifier">T</span> <span class="keyword">const</span><span class="special">&</span> val<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre> 42<div class="variablelist"><table border="0" class="variablelist compact"> 43<colgroup> 44<col align="left" valign="top"> 45<col> 46</colgroup> 47<tbody> 48<tr> 49<td><p><span class="term">Returns:</span></p></td> 50<td> 51<p> 52 </p> 53<pre class="programlisting"><a class="link" href="../hash/reference.html#boost.hash_va_1_3_11_11_2_2_27_1">hash_value</a><span class="special">(</span><span class="identifier">val</span><span class="special">)</span></pre> 54<p> 55 </p> 56</td> 57</tr> 58<tr> 59<td><p><span class="term">Notes:</span></p></td> 60<td> 61<p> 62 The call to <code class="computeroutput"><a class="link" href="../hash/reference.html#boost.hash_va_1_3_11_11_2_2_27_1">hash_value</a></code> 63 is unqualified, so that custom overloads can be 64 found via argument dependent lookup. 65 </p> 66<p> 67 This is not defined when the macro <code class="computeroutput">BOOST_HASH_NO_EXTENSIONS</code> 68 is defined. The specializations are still defined, so only the specializations 69 required by TR1 are defined. 70 </p> 71<p> 72 Forward declared in 73 <code class="computeroutput"><boost/container_hash/hash_fwd.hpp></code> 74 </p> 75<p> 76 This hash function is not intended for general use, and isn't 77 guaranteed to be equal during separate runs of a program - so 78 please don't use it for any persistent storage or communication. 79 </p> 80</td> 81</tr> 82<tr> 83<td><p><span class="term">Throws:</span></p></td> 84<td><p> 85 Only throws if 86 <code class="computeroutput"><a class="link" href="../hash/reference.html#boost.hash_va_1_3_11_11_2_2_27_1">hash_value</a>(T)</code> throws. 87 </p></td> 88</tr> 89</tbody> 90</table></div> 91</div> 92</div> 93<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 94<td align="left"></td> 95<td align="right"><div class="copyright-footer">Copyright © 2005-2008 Daniel 96 James<p> 97 Distributed under the Boost Software License, Version 1.0. (See accompanying 98 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>) 99 </p> 100</div></td> 101</tr></table> 102<hr> 103<div class="spirit-nav"> 104<a accesskey="p" href="../hash/reference.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../hash/reference.html#header.boost.container_hash.hash_hpp"><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_bool_1_3_11_11_2_2_2.html"><img src="../../../doc/src/images/next.png" alt="Next"></a> 105</div> 106</body> 107</html> 108