| [12] | 1 | <html> |
|---|
| 2 | <head> |
|---|
| 3 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
|---|
| 4 | <title>Function hash_range</title> |
|---|
| 5 | <link rel="stylesheet" href="boostbook.css" type="text/css"> |
|---|
| 6 | <meta name="generator" content="DocBook XSL Stylesheets V1.69.1"> |
|---|
| 7 | <link rel="start" href="index.html" title="The Boost C++ Libraries"> |
|---|
| 8 | <link rel="up" href="hash/reference_.html#id2350414" title="Header <boost/functional/hash/hash.hpp>"> |
|---|
| 9 | <link rel="prev" href="hash_combine.html" title="Function template hash_combine"> |
|---|
| 10 | <link rel="next" href="id2510242.html" title="Function hash_value"> |
|---|
| 11 | </head> |
|---|
| 12 | <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> |
|---|
| 13 | <table cellpadding="2" width="100%"> |
|---|
| 14 | <td valign="top"><img alt="boost.png (6897 bytes)" width="277" height="86" src="../../boost.png"></td> |
|---|
| 15 | <td align="center"><a href="../../index.htm">Home</a></td> |
|---|
| 16 | <td align="center"><a href="../../libs/libraries.htm">Libraries</a></td> |
|---|
| 17 | <td align="center"><a href="../../people/people.htm">People</a></td> |
|---|
| 18 | <td align="center"><a href="../../more/faq.htm">FAQ</a></td> |
|---|
| 19 | <td align="center"><a href="../../more/index.htm">More</a></td> |
|---|
| 20 | </table> |
|---|
| 21 | <hr> |
|---|
| 22 | <div class="spirit-nav"> |
|---|
| 23 | <a accesskey="p" href="hash_combine.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="hash/reference_.html#id2350414"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="id2510242.html"><img src="images/next.png" alt="Next"></a> |
|---|
| 24 | </div> |
|---|
| 25 | <div class="refentry" lang="en"> |
|---|
| 26 | <a name="hash_range"></a><div class="titlepage"></div> |
|---|
| 27 | <div class="refnamediv"> |
|---|
| 28 | <h2><span class="refentrytitle">Function hash_range</span></h2> |
|---|
| 29 | <p>boost::hash_range — |
|---|
| 30 | Calculate the combined hash value of the elements of an iterator |
|---|
| 31 | range. |
|---|
| 32 | </p> |
|---|
| 33 | </div> |
|---|
| 34 | <h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2> |
|---|
| 35 | <div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"> |
|---|
| 36 | <span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> It> <span class="type">std::size_t</span> hash_range(It first, It last); |
|---|
| 37 | <span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> It> <span class="type"><span class="bold"><strong>void</strong></span></span> hash_range(std::size_t& seed, It first, It last);</pre></div> |
|---|
| 38 | <div class="refsect1" lang="en"> |
|---|
| 39 | <a name="id2704839"></a><h2>Description</h2> |
|---|
| 40 | <p><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Effects</span></b>: |
|---|
| 41 | |
|---|
| 42 | For the two argument overload: |
|---|
| 43 | <pre class="programlisting"> |
|---|
| 44 | size_t seed = 0; |
|---|
| 45 | |
|---|
| 46 | for(; first != last; ++first) |
|---|
| 47 | { |
|---|
| 48 | <a href="hash_combine.html" title="Function template hash_combine">hash_combine</a>(seed, *first); |
|---|
| 49 | } |
|---|
| 50 | |
|---|
| 51 | return seed; |
|---|
| 52 | </pre>For the three arguments overload: |
|---|
| 53 | <pre class="programlisting"> |
|---|
| 54 | for(; first != last; ++first) |
|---|
| 55 | { |
|---|
| 56 | <a href="hash_combine.html" title="Function template hash_combine">hash_combine</a>(seed, *first); |
|---|
| 57 | } |
|---|
| 58 | </pre><p></p><br><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Notes</span></b>: |
|---|
| 59 | |
|---|
| 60 | <code class="computeroutput">hash_range</code> is sensitive to the order of the elements |
|---|
| 61 | so it wouldn't be appropriate to use this with an unordered |
|---|
| 62 | container. |
|---|
| 63 | <p>This is an extension to TR1</p><br><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Throws</span></b>: |
|---|
| 64 | |
|---|
| 65 | |
|---|
| 66 | Only throws if <code class="computeroutput"><a href="id2510242.html" title="Function hash_value">hash_value</a>(std::iterator_traits<It>::value_type)</code> |
|---|
| 67 | throws. <code class="computeroutput">hash_range(std::size_t&, It, It)</code> has basic exception safety as long as |
|---|
| 68 | <code class="computeroutput"><a href="id2510242.html" title="Function hash_value">hash_value</a>(std::iterator_traits<It>::value_type)</code> |
|---|
| 69 | has basic exception safety. |
|---|
| 70 | </p> |
|---|
| 71 | </div> |
|---|
| 72 | </div> |
|---|
| 73 | <table width="100%"><tr> |
|---|
| 74 | <td align="left"></td> |
|---|
| 75 | <td align="right"><small>Copyright © 2005 Daniel James</small></td> |
|---|
| 76 | </tr></table> |
|---|
| 77 | <hr> |
|---|
| 78 | <div class="spirit-nav"> |
|---|
| 79 | <a accesskey="p" href="hash_combine.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="hash/reference_.html#id2350414"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="id2510242.html"><img src="images/next.png" alt="Next"></a> |
|---|
| 80 | </div> |
|---|
| 81 | </body> |
|---|
| 82 | </html> |
|---|