Compare commits

...

26 Commits

Author SHA1 Message Date
nobody
b391e79cf7 This commit was manufactured by cvs2svn to create tag
'Version_1_34_1_RC2'.

[SVN r38193]
2007-07-12 01:07:47 +00:00
Thomas Witt
244c6802b0 Hash warning patch 2 see Trac #952
[SVN r37737]
2007-05-22 03:55:10 +00:00
Thomas Witt
be0cd834a1 Hash warning patch see Trac #952
[SVN r37705]
2007-05-17 23:07:38 +00:00
Daniel James
e0c13b595d Rolling back changes I shouldn't have checked in.
[SVN r37699]
2007-05-15 22:05:41 +00:00
Daniel James
5831163a21 Fix a couple of typos in the hash documentation.
[SVN r37697]
2007-05-15 19:54:42 +00:00
Daniel James
8f08a63793 Update the date in the hash documentation copyright block.
[SVN r37696]
2007-05-15 19:47:52 +00:00
Daniel James
8e0e4dbb6e Add a missing bracket to the hash copyright documentation.
[SVN r37695]
2007-05-15 19:45:49 +00:00
Daniel James
8241c0a087 Clean up the 64-bit std::size_t workaround and hopefully suppress the warning
on 32-bit Visual C++.


[SVN r37694]
2007-05-15 19:44:46 +00:00
Daniel James
524335a091 Document boost::hash<T*>.
[SVN r37554]
2007-05-01 21:28:45 +00:00
Daniel James
4c24efeadf Reverting the last change as it's not a main function so returning
'boost::report_errors' would be wrong. The main function is in
link_no_ext_test.cpp and does return 'boost::report_errors'.


[SVN r37064]
2007-02-25 15:59:08 +00:00
Dave Abrahams
bf7e1328c4 Correct testing bugs:
either changing assert(...) or BOOST_ASSERT(...) to BOOST_TEST
    (in my code only)

    or adding "return boost::report_errors();" where it was clearly
    missing (and a pure bug, in anyone's code).

    or changing BOOST_TEST to BOOST_CHECK where the integer library
    was clearly using Boost.Test and not returning report_errors().


[SVN r37063]
2007-02-25 15:28:02 +00:00
Daniel James
946d693768 Intel 9.1 with the gcc stdlib seems to segfault on call to std::asin and
std::acos. So for them I'm disabling that test - it isn't vital.


[SVN r37062]
2007-02-25 12:15:52 +00:00
Rene Rivera
aa9670ad2f Remove obsolete Boost.Build v1 files.
[SVN r35880]
2006-11-06 17:10:46 +00:00
Daniel James
c8845a10fb Merge from head to RC_1_34_0.
[SVN r35289]
2006-09-23 14:53:07 +00:00
Daniel James
b81d239dbb Add a copyright comment to the hash reference documenation.
[SVN r34786]
2006-07-30 20:42:11 +00:00
Daniel James
f0176013b7 Add copyright to the hash redirection page.
[SVN r34549]
2006-07-16 07:13:50 +00:00
Daniel James
292d7a7ae5 Update the Digital Mars workarounds for the latest version.
[SVN r34526]
2006-07-13 07:54:41 +00:00
Daniel James
8eb8ad993a Add support for long long on win64 as that's the only 64-bit type on that platform (and std::size_t is 64 bit).
[SVN r34287]
2006-06-12 17:58:12 +00:00
Daniel James
3b947c29de Update the hash library acknowledgements.
[SVN r34271]
2006-06-11 14:31:51 +00:00
Daniel James
fb20d59aa8 Get hashing std::size_t working on 64-bit Visual C++.
[SVN r34253]
2006-06-08 22:12:16 +00:00
Daniel James
9dd1099e28 Merge VC7 workaround from HEAD.
[SVN r34197]
2006-06-06 17:38:38 +00:00
Daniel James
81e3119c51 Merge hash workarounds for Digital Mars to the release branch.
[SVN r34036]
2006-05-20 07:34:48 +00:00
Daniel James
86eae42d6f Merge OS X hash float fix from head to rc_1_34_0.
[SVN r33917]
2006-05-03 18:34:43 +00:00
Daniel James
58033a375f Merge hash documentation changes to release branch.
[SVN r33612]
2006-04-09 12:14:23 +00:00
Daniel James
77ac0f4198 Rearrange the results table in the hash_value docs. Hopefully this will be clearer.
[SVN r33568]
2006-04-06 19:55:06 +00:00
Daniel James
e1c1fc681d Merge hash documentation changes to release branch.
[SVN r33509]
2006-03-28 17:05:43 +00:00
21 changed files with 302 additions and 456 deletions

View File

@@ -1,3 +1,8 @@
[/ Copyright 2005-2006 Daniel James.
/ Distributed under the Boost Software License, Version 1.0. (See accompanying
/ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ]
[section:changes Change Log]
[h2 Boost 1.33.0]

View File

@@ -1,3 +1,8 @@
[/ Copyright 2005-2006 Daniel James.
/ Distributed under the Boost Software License, Version 1.0. (See accompanying
/ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ]
[section:disable Disabling The Extensions]
While [classref boost::hash]'s extensions are generally useful, you might want

View File

@@ -1,23 +1,31 @@
[/ Copyright 2005-2006 Daniel James.
/ Distributed under the Boost Software License, Version 1.0. (See accompanying
/ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ]
[section:intro Introduction]
[def __tr1__ [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1745.pdf
C++ Standard Library Technical Report]]
[def __tr1-short__ [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1745.pdf
Technical Report]]
[def __tr1-full__
[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf
Draft Technical Report on C++ Library Extensions]]
[def __tr1__
[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf
TR1]]
[def __multi-index__ [@../../libs/multi_index/doc/index.html
Boost Multi-Index Containers Library]]
[def __multi-index-short__ [@../../libs/multi_index/doc/index.html
Boost.MultiIndex]]
[def __issues__ [@http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf
[def __issues__
[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1837.pdf
Library Extension Technical Report Issues List]]
[def __hash-function__ [@http://en.wikipedia.org/wiki/Hash_function hash function]]
[def __hash-table__ [@http://en.wikipedia.org/wiki/Hash_table hash table]]
[classref boost::hash] is an implementation of the __hash-function__ object
specified by the __tr1-short__. It is intended for use as the default hash function
specified by the __tr1-full__ (TR1). It is intended for use as the default hash function
for unordered associative containers, and the __multi-index__'s hash indexes.
As it is compliant with the __tr1-short__, it will work with:
As it is compliant with __tr1__, it will work with:
* integers
* floats
@@ -25,7 +33,7 @@ As it is compliant with the __tr1-short__, it will work with:
* strings
It also implements the extension proposed by Peter Dimov in issue 6.18 of the
__issues__, this adds support for:
__issues__ (page 63), this adds support for:
* arrays
* `std::pair`

View File

@@ -1,3 +1,8 @@
[/ Copyright 2005-2006 Daniel James.
/ Distributed under the Boost Software License, Version 1.0. (See accompanying
/ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ]
[section:links Links]
[*A Proposal to Add Hash Tables to the Standard Library]\n

View File

@@ -1,3 +1,8 @@
[/ Copyright 2005-2006 Daniel James.
/ Distributed under the Boost Software License, Version 1.0. (See accompanying
/ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ]
[section:portability Portability]
[def __boost_hash__ [classref boost::hash]]

View File

@@ -1,9 +1,15 @@
<!--
Copyright 2005-2006 Daniel James.
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-->
<library-reference>
<section id="hash.reference.specification">
<para>For the full specification, see section 6.3 of the
<ulink url="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1745.pdf">C++ Standard Library Technical Report</ulink>
<ulink url="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf">C++ Standard Library Technical Report</ulink>
and issue 6.18 of the
<ulink url="http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf">Library Extension Technical Report Issues List</ulink>.
<ulink url="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1837.pdf">Library Extension Technical Report Issues List</ulink> (page 63).
</para>
</section>
<header name="boost/functional/hash.hpp">
@@ -27,7 +33,7 @@
<classname>std::unary_function&lt;T, std::size_t&gt;</classname>
</inherit>
<purpose>An STL compliant hash function object.</purpose>
<purpose>A <ulink url="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf">TR1</ulink> compliant hash function object.</purpose>
<method name="operator()" cv="const">
<type>std::size_t</type>
@@ -68,7 +74,7 @@
</parameter>
<returns>
<para>Unspecified in TR1, except that equal arguments yield the same result.</para>
<para><functionname alt="boost::hash_value(bool)">hash_value</functionname>(val) in Boost.</para>
<para><functionname>hash_value</functionname>(val) in Boost.</para>
</returns>
<throws><para>Doesn't throw</para></throws>
</method>
@@ -266,7 +272,7 @@
</parameter>
<returns>
<para>Unspecified in TR1, except that equal arguments yield the same result.</para>
<para><functionname alt="boost::hash_value(float)">hash_value</functionname>(val) in Boost.</para>
<para><functionname>hash_value</functionname>(val) in Boost.</para>
</returns>
<throws><para>Doesn't throw</para></throws>
</method>
@@ -344,6 +350,25 @@
</method>
</struct-specialization>
<struct-specialization name="hash">
<template>
<template-type-parameter name="T"/>
</template>
<specialization>
<template-arg>T*</template-arg>
</specialization>
<method name="operator()" cv="const">
<type>std::size_t</type>
<parameter name="val">
<paramtype>T*</paramtype>
</parameter>
<returns>
<para>Unspecified in TR1, except that equal arguments yield the same result.</para>
</returns>
<throws><para>Doesn't throw</para></throws>
</method>
</struct-specialization>
<!--
boost::hash_combine
-->
@@ -354,7 +379,7 @@
</template>
<type>void</type>
<parameter name="seed"><paramtype>size_t &amp;</paramtype></parameter>
<parameter name="v"><paramtype>T const &amp;</paramtype></parameter>
<parameter name="v"><paramtype>T const&amp;</paramtype></parameter>
<purpose>
Called repeatedly to incrementally create a hash value from
several variables.
@@ -444,21 +469,9 @@ for(; first != last; ++first)
<overloaded-function name="hash_value">
<purpose>
Implementation of a hash function for integers.
Implementation of the hash function.
</purpose>
<description><para>
Generally shouldn't be called directly by users, instead they should use
<classname>boost::hash</classname>, <functionname>boost::hash_range</functionname>
or <functionname>boost::hash_combine</functionname> which
call hash_value without namespace qualification so that overloads
for custom types are found via ADL.
</para></description>
<notes>
<para>Overloads for other types supplied in other headers.</para>
<para>This is an extension to TR1</para>
</notes>
<signature>
<type>std::size_t</type>
<parameter name="val"><paramtype>int</paramtype></parameter>
@@ -479,32 +492,6 @@ for(; first != last; ++first)
<parameter name="val"><paramtype>unsigned long</paramtype></parameter>
</signature>
<returns>
<code>val</code>
</returns>
</overloaded-function>
<!--
boost::hash_value - floating point
-->
<overloaded-function name="hash_value">
<purpose>
Implementation of a hash function for floating point values.
</purpose>
<description><para>
Generally shouldn't be called directly by users, instead they should use
<classname>boost::hash</classname>, <functionname>boost::hash_range</functionname>
or <functionname>boost::hash_combine</functionname> which
call hash_value without namespace qualification so that overloads
for custom types are found via ADL.
</para></description>
<notes>
<para>Overloads for other types supplied in other headers.</para>
<para>This is an extension to TR1</para>
</notes>
<signature>
<type>std::size_t</type>
<parameter name="val"><paramtype>float</paramtype></parameter>
@@ -520,70 +507,12 @@ for(; first != last; ++first)
<parameter name="val"><paramtype>long double</paramtype></parameter>
</signature>
<returns>
<para>
An unspecified value, except that equal arguments shall yield the same
result
</para>
</returns>
</overloaded-function>
<!--
boost::hash_value - pointers
-->
<overloaded-function name="hash_value">
<purpose>
Implementation of a hash function for pointers.
</purpose>
<description><para>
Generally shouldn't be called directly by users, instead they should use
<classname>boost::hash</classname>, <functionname>boost::hash_range</functionname>
or <functionname>boost::hash_combine</functionname> which
call hash_value without namespace qualification so that overloads
for custom types are found via ADL.
</para></description>
<notes>
<para>Overloads for other types supplied in other headers.</para>
<para>This is an extension to TR1</para>
</notes>
<signature>
<template><template-type-parameter name="T"/></template>
<type>std::size_t</type>
<parameter name="val"><paramtype>T* const&amp;</paramtype></parameter>
</signature>
<returns>
<para>
An unspecified value, except that equal arguments shall yield the same
result
</para>
</returns>
</overloaded-function>
<!--
boost::hash_value - arrays
-->
<overloaded-function name="hash_value">
<purpose>
Implementation of a hash function for built in arrays.
</purpose>
<description><para>
Generally shouldn't be called directly by users, instead they should use
<classname>boost::hash</classname>, <functionname>boost::hash_range</functionname>
or <functionname>boost::hash_combine</functionname> which
call hash_value without namespace qualification so that overloads
for custom types are found via ADL.
</para></description>
<notes>
<para>Overloads for other types supplied in other headers.</para>
<para>This is an extension to TR1</para>
</notes>
<signature>
<template>
<template-type-parameter name="T"/>
@@ -602,30 +531,6 @@ for(; first != last; ++first)
<parameter><paramtype>const T (&amp;val)[N]</paramtype></parameter>
</signature>
<returns><code>hash_range(val, val+N)</code></returns>
</overloaded-function>
<!--
boost::hash_value - string
-->
<overloaded-function name="hash_value">
<purpose>
Implementation of a hash function for <code>std::basic_string</code>.
</purpose>
<description><para>
Generally shouldn't be called directly by users, instead they should use
<classname>boost::hash</classname>, <functionname>boost::hash_range</functionname>
or <functionname>boost::hash_combine</functionname> which
call hash_value without namespace qualification so that overloads
for custom types are found via ADL.
</para></description>
<notes>
<para>Overloads for other types supplied in other headers.</para>
<para>This is an extension to TR1</para>
</notes>
<signature>
<template>
<template-type-parameter name="Ch"/>
@@ -636,118 +541,158 @@ for(; first != last; ++first)
<paramtype>std::basic_string&lt;Ch, std::char_traits&lt;Ch&gt;, A&gt; const&amp;</paramtype>
</parameter>
</signature>
<returns><code>hash_range(val.begin(), val.end())</code></returns>
</overloaded-function>
<!--
boost::hash_value - pairs
-->
<overloaded-function name="hash_value">
<signature>
<signature>
<template>
<template-type-parameter name="A"/>
<template-type-parameter name="B"/>
</template>
<type>std::size_t</type>
<parameter name="val"><paramtype>std::pair&lt;A, B&gt; const &amp;</paramtype></parameter>
<parameter name="val"><paramtype>std::pair&lt;A, B&gt; const&amp;</paramtype></parameter>
</signature>
<effects><programlisting>
size_t seed = 0;
<functionname>hash_combine</functionname>(seed, val.first);
<functionname>hash_combine</functionname>(seed, val.second);
return seed;
</programlisting></effects>
<signature>
<template>
<template-type-parameter name="T"/>
<template-type-parameter name="A"/>
</template>
<type>std::size_t</type>
<parameter name="val"><paramtype>std::vector&lt;T, A&gt; const&amp;</paramtype></parameter>
</signature>
<signature>
<template>
<template-type-parameter name="T"/>
<template-type-parameter name="A"/>
</template>
<type>std::size_t</type>
<parameter name="val"><paramtype>std::list&lt;T, A&gt; const&amp;</paramtype></parameter>
</signature>
<signature>
<template>
<template-type-parameter name="T"/>
<template-type-parameter name="A"/>
</template>
<type>std::size_t</type>
<parameter name="val"><paramtype>std::deque&lt;T, A&gt; const&amp;</paramtype></parameter>
</signature>
<signature>
<template>
<template-type-parameter name="K"/>
<template-type-parameter name="C"/>
<template-type-parameter name="A"/>
</template>
<type>std::size_t</type>
<parameter name="val"><paramtype>std::set&lt;K, C, A&gt; const&amp;</paramtype></parameter>
</signature>
<signature>
<template>
<template-type-parameter name="K"/>
<template-type-parameter name="C"/>
<template-type-parameter name="A"/>
</template>
<type>std::size_t</type>
<parameter name="val"><paramtype>std::multiset&lt;K, C, A&gt; const&amp;</paramtype></parameter>
</signature>
<signature>
<template>
<template-type-parameter name="K"/>
<template-type-parameter name="T"/>
<template-type-parameter name="C"/>
<template-type-parameter name="A"/>
</template>
<type>std::size_t</type>
<parameter name="val"><paramtype>std::map&lt;K, T, C, A&gt; const&amp;</paramtype></parameter>
</signature>
<signature>
<template>
<template-type-parameter name="K"/>
<template-type-parameter name="T"/>
<template-type-parameter name="C"/>
<template-type-parameter name="A"/>
</template>
<type>std::size_t</type>
<parameter name="val"><paramtype>std::multimap&lt;K, T, C, A&gt; const&amp;</paramtype></parameter>
</signature>
<description><para>
Generally shouldn't be called directly by users, instead they should use
<classname>boost::hash</classname>, <functionname>boost::hash_range</functionname>
or <functionname>boost::hash_combine</functionname> which
call <code>hash_value</code> without namespace qualification so that overloads
for custom types are found via ADL.
</para></description>
<notes>
<para>This is an extension to TR1</para>
</notes>
<throws>
Only throws if <code><functionname>hash_value</functionname>(A)</code>
or <code><functionname>hash_value</functionname>(B)</code> throws.
Only throws if a user supplied version of
<code><functionname>hash_value</functionname></code>
throws for an element of a container, or
one of the types stored in a pair.
</throws>
<notes><para>This is an extension to TR1</para></notes>
</overloaded-function>
<!--
boost::hash_value - containers
-->
<overloaded-function name="hash_value">
<signature>
<template>
<template-type-parameter name="T"/>
<template-type-parameter name="A"/>
</template>
<type>std::size_t</type>
<parameter name="val"><paramtype>std::vector&lt;T, A&gt; const &amp;</paramtype></parameter>
</signature>
<signature>
<template>
<template-type-parameter name="T"/>
<template-type-parameter name="A"/>
</template>
<type>std::size_t</type>
<parameter name="val"><paramtype>std::list&lt;T, A&gt; const &amp;</paramtype></parameter>
</signature>
<signature>
<template>
<template-type-parameter name="T"/>
<template-type-parameter name="A"/>
</template>
<type>std::size_t</type>
<parameter name="val"><paramtype>std::deque&lt;T, A&gt; const &amp;</paramtype></parameter>
</signature>
<signature>
<template>
<template-type-parameter name="K"/>
<template-type-parameter name="C"/>
<template-type-parameter name="A"/>
</template>
<type>std::size_t</type>
<parameter name="val"><paramtype>std::set&lt;K, C, A&gt; const &amp;</paramtype></parameter>
</signature>
<signature>
<template>
<template-type-parameter name="K"/>
<template-type-parameter name="C"/>
<template-type-parameter name="A"/>
</template>
<type>std::size_t</type>
<parameter name="val"><paramtype>std::multiset&lt;K, C, A&gt; const &amp;</paramtype></parameter>
</signature>
<signature>
<template>
<template-type-parameter name="K"/>
<template-type-parameter name="T"/>
<template-type-parameter name="C"/>
<template-type-parameter name="A"/>
</template>
<type>std::size_t</type>
<parameter name="val"><paramtype>std::map&lt;K, T, C, A&gt; const &amp;</paramtype></parameter>
</signature>
<signature>
<template>
<template-type-parameter name="K"/>
<template-type-parameter name="T"/>
<template-type-parameter name="C"/>
<template-type-parameter name="A"/>
</template>
<type>std::size_t</type>
<parameter name="val"><paramtype>std::multimap&lt;K, T, C, A&gt; const &amp;</paramtype></parameter>
</signature>
<returns>
<code><functionname>hash_range</functionname>(val.begin(), val.end());</code>
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>Types</entry>
<entry>Returns</entry>
</row>
</thead>
<tbody>
<row>
<entry><code>int</code>, <code>unsigned int</code>, <code>long</code>, <code>unsigned long</code></entry>
<entry><code>val</code></entry>
</row>
<row>
<entry><code>float</code>, <code>double</code>, <code>long double</code></entry>
<entry>An unspecified value, except that equal arguments shall yield the same result.</entry>
</row>
<row>
<entry><code>T*</code></entry>
<entry>An unspecified value, except that equal arguments shall yield the same result.</entry>
</row>
<row>
<entry>
<code>T&#160;val[N]</code>,
<code>const&#160;T&#160;val[N]</code>
</entry>
<entry><code>hash_range(val, val+N)</code></entry>
</row>
<row>
<entry>
<code>std:basic_string&lt;Ch,&#160;std::char_traits&lt;Ch&gt;,&#160;A&gt;</code>,
<code>std::vector&lt;T,&#160;A&gt;</code>,
<code>std::list&lt;T,&#160;A&gt;</code>,
<code>std::deque&lt;T,&#160;A&gt;</code>,
<code>std::set&lt;K,&#160;C,&#160;A&gt;</code>,
<code>std::multiset&lt;K,&#160;C,&#160;A&gt;</code>,
<code>std::map&lt;K,&#160;T,&#160;C,&#160;A&gt;</code>,
<code>std::multimap&lt;K,&#160;T,&#160;C,&#160;A&gt;</code>
</entry>
<entry><code>hash_range(val.begin(), val.end())</code></entry>
</row>
<row>
<entry><code>std::pair&lt;A, B&gt;</code></entry>
<entry><programlisting>size_t seed = 0;
<functionname>hash_combine</functionname>(seed, val.first);
<functionname>hash_combine</functionname>(seed, val.second);
return seed;</programlisting></entry>
</row>
</tbody>
</tgroup>
</informaltable>
</returns>
<throws>
Only throws if <code><functionname>hash_value</functionname>(T)</code> throws.
</throws>
<notes><para>This is an extension to TR1</para></notes>
</overloaded-function>
</overloaded-function>
</namespace>
</header>
</library-reference>

View File

@@ -1,14 +1,20 @@
[/ Copyright 2005-2006 Daniel James.
/ Distributed under the Boost Software License, Version 1.0. (See accompanying
/ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ]
[section:acknowledgements Acknowledgements]
This library is based on the design by Peter Dimov. During the initial
development
Joaquín M López Muñoz made many useful suggestions and contributed fixes.
This library is based on the design by Peter Dimov's original design.
During the initial development Joaquín M López Muñoz made many useful
suggestions, contributed fixes.
The formal review was managed by Thorsten Ottosen, and the library reviewed by:
David Abrahams, Alberto Barbati, Topher Cooper, Caleb Epstein, Dave Harris,
Chris Jefferson, Bronek Kozicki, John Maddock, Tobias Swinger, Jaap Suter,
Rob Stewart and Pavel Vozenilek. Since then, further constructive criticism has
been made by Daniel Krügler, Alexander Nasonov and 沈慧峰.
Chris Jefferson, Bronek Kozicki, John Maddock, Tobias Swinger, Jaap Suter, Rob
Stewart and Pavel Vozenilek. Since then, there have been further contributions
from Daniel Krügler, Alexander Nasonov, 沈慧峰 and John Maddock.
The implementation of the hash function for pointers is based on suggestions
made by Alberto Barbati and Dave Harris. Dave Harris also suggested an

View File

@@ -1,3 +1,8 @@
[/ Copyright 2005-2006 Daniel James.
/ Distributed under the Boost Software License, Version 1.0. (See accompanying
/ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ]
[def __multi-index-short__ [@../../libs/multi_index/doc/index.html
Boost.MultiIndex]]
@@ -12,7 +17,7 @@ If your standard library supplies its own implementation of the unordered
associative containers and you wish to use
[classref boost::hash], just use an extra template parameter:
std::unordered_multiset<std::vector<int>, ``[classref boost::hash]``<int> >
std::unordered_multiset<int, ``[classref boost::hash]``<int> >
set_of_ints;
std::unordered_set<std::pair<int, int>, ``[classref boost::hash]``<std::pair<int, int> >

View File

@@ -1,28 +0,0 @@
# (C) Copyright Daniel James 2005.
# Use, modification and distribution are subject to the
# Boost Software License, Version 1.0. (See accompanying file
# LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
subproject libs/functional/hash/examples ;
import testing ;
DEPENDS all : test ;
rule hash-example ( name )
{
return [
run $(name).cpp
: : : <include>$(BOOST_ROOT)
] ;
}
{
test-suite functional/examples
:
[ hash-example books ]
[ hash-example point ]
[ hash-example portable ]
;
}

View File

@@ -25,7 +25,7 @@
// STLport:
#if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
# if defined(__GNUC__) && __GNUC__ < 3 && (defined(linux) || defined(__linux) || defined(__linux__))
# if (defined(__GNUC__) && __GNUC__ < 3 && (defined(linux) || defined(__linux) || defined(__linux__))) || defined(__DMC__)
# define BOOST_HASH_USE_C99_FLOAT_FUNCS
# elif defined(BOOST_MSVC) && BOOST_MSVC < 1300
# define BOOST_HASH_USE_C99_FLOAT_FUNCS

View File

@@ -23,7 +23,8 @@
#if !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)
# if defined(__GLIBCPP__) || defined(__GLIBCXX__)
// GNU libstdc++ 3
# if defined(__USE_ISOC99) || defined(_GLIBCXX_USE_C99_MATH)
# if (defined(__USE_ISOC99) || defined(_GLIBCXX_USE_C99_MATH)) && \
!(defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__))
# define BOOST_HASH_USE_FPCLASSIFY
# endif
# elif (defined(_YVALS) && !defined(__IBMCPP__)) || defined(_CPPLIB_VER)

View File

@@ -1,21 +0,0 @@
// Copyright Daniel James 2005-2006. Use, modification, and distribution are
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// Based on Peter Dimov's proposal
// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf
// issue 6.18.
#if !defined(BOOST_FUNCTIONAL_HASH_DEQUE_HPP)
#define BOOST_FUNCTIONAL_HASH_DEQUE_HPP
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
#warning "boost/functional/hash/deque.hpp is deprecated, use boost/functional/hash.hpp instead."
#include <boost/functional/hash.hpp>
#endif

View File

@@ -1,5 +1,5 @@
// Copyright Daniel James 2005-2006. Use, modification, and distribution are
// Copyright Daniel James 2005-2007. Use, modification, and distribution are
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -28,6 +28,11 @@
#include <boost/type_traits/is_const.hpp>
#endif
#if defined(BOOST_MSVC)
# pragma warning(push)
# pragma warning(disable:4267)
#endif
namespace boost
{
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
@@ -41,7 +46,20 @@ namespace boost
std::size_t hash_value(long);
std::size_t hash_value(unsigned long);
#if defined(BOOST_HAS_LONG_LONG) && defined(_M_X64) && defined(_WIN64)
// On 64-bit windows std::size_t is a typedef for unsigned long long, which
// isn't due to be supported until Boost 1.35. So add support here.
// (Technically, Boost.Hash isn't actually documented as supporting
// std::size_t. But it would be pretty silly not to).
std::size_t hash_value(long long);
std::size_t hash_value(unsigned long long);
#endif
#if !BOOST_WORKAROUND(__DMC__, <= 0x848)
template <class T> std::size_t hash_value(T* const&);
#else
template <class T> std::size_t hash_value(T*);
#endif
#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
template< class T, unsigned N >
@@ -104,8 +122,24 @@ namespace boost
return static_cast<std::size_t>(v);
}
#if defined(BOOST_HAS_LONG_LONG) && defined(_M_X64) && defined(_WIN64)
inline std::size_t hash_value(long long v)
{
return v;
}
inline std::size_t hash_value(unsigned long long v)
{
return v;
}
#endif
// Implementation by Alberto Barbati and Dave Harris.
#if !BOOST_WORKAROUND(__DMC__, <= 0x848)
template <class T> std::size_t hash_value(T* const& v)
#else
template <class T> std::size_t hash_value(T* v)
#endif
{
std::size_t x = static_cast<std::size_t>(
reinterpret_cast<std::ptrdiff_t>(v));
@@ -380,7 +414,7 @@ namespace boost
}
template <class T> struct hash
: public hash_detail::hash_impl<boost::is_pointer<T>::value>
: public boost::hash_detail::hash_impl<boost::is_pointer<T>::value>
::BOOST_NESTED_TEMPLATE inner<T>
{
};
@@ -460,7 +494,18 @@ namespace boost
#endif
};
#elif !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
#if BOOST_WORKAROUND(__DMC__, <= 0x848)
template <class T, unsigned int n> struct hash<T[n]>
: std::unary_function<T[n], std::size_t>
{
std::size_t operator()(const T* val) const
{
return boost::hash_range(val, val+n);
}
};
#endif
#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
// On compilers without partial specialization, boost::hash<T>
// has already been declared to deal with pointers, so just
@@ -468,6 +513,11 @@ namespace boost
namespace hash_detail
{
template <bool IsPointer>
struct hash_impl;
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
template <>
struct hash_impl<false>
{
@@ -488,15 +538,12 @@ namespace boost
#endif
};
};
}
#else // Visual C++ 6.5
// There's probably a more elegant way to Visual C++ 6.5 to work
// but I don't know what it is.
namespace hash_detail
{
template <bool IsConst>
struct hash_impl_msvc
{
@@ -541,9 +588,15 @@ namespace boost
template <class T>
struct inner : public hash_impl_msvc2<T> {};
};
#endif // Visual C++ 6.5
}
#endif
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
}
#if defined(BOOST_MSVC)
# pragma warning(pop)
#endif
#endif

View File

@@ -1,21 +0,0 @@
// Copyright Daniel James 2005-2006. Use, modification, and distribution are
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// Based on Peter Dimov's proposal
// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf
// issue 6.18.
#if !defined(BOOST_FUNCTIONAL_HASH_LIST_HPP)
#define BOOST_FUNCTIONAL_HASH_LIST_HPP
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
#warning "boost/functional/hash/list.hpp is deprecated, use boost/functional/hash.hpp instead."
#include <boost/functional/hash.hpp>
#endif

View File

@@ -1,22 +0,0 @@
// Copyright Daniel James 2005-2006. Use, modification, and distribution are
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// Based on Peter Dimov's proposal
// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf
// issue 6.18.
#if !defined(BOOST_FUNCTIONAL_HASH_MAP_HPP)
#define BOOST_FUNCTIONAL_HASH_MAP_HPP
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
#warning "boost/functional/hash/map.hpp is deprecated, use boost/functional/hash.hpp instead."
#include <boost/functional/hash.hpp>
#endif

View File

@@ -1,20 +0,0 @@
// Copyright Daniel James 2005-2006. Use, modification, and distribution are
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// Based on Peter Dimov's proposal
// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf
// issue 6.18.
#if !defined(BOOST_FUNCTIONAL_HASH_PAIR_HPP)
#define BOOST_FUNCTIONAL_HASH_PAIR_HPP
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
#warning "boost/functional/hash/pair.hpp is deprecated, use boost/functional/hash.hpp instead."
#include <boost/functional/hash.hpp>
#endif

View File

@@ -1,21 +0,0 @@
// Copyright Daniel James 2005-2006. Use, modification, and distribution are
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// Based on Peter Dimov's proposal
// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf
// issue 6.18.
#if !defined(BOOST_FUNCTIONAL_HASH_SET_HPP)
#define BOOST_FUNCTIONAL_HASH_SET_HPP
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
#warning "boost/functional/hash/set.hpp is deprecated, use boost/functional/hash.hpp instead."
#include <boost/functional/hash.hpp>
#endif

View File

@@ -1,20 +0,0 @@
// Copyright Daniel James 2005-2006. Use, modification, and distribution are
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// Based on Peter Dimov's proposal
// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf
// issue 6.18.
#if !defined(BOOST_FUNCTIONAL_HASH_VECTOR_HPP)
#define BOOST_FUNCTIONAL_HASH_VECTOR_HPP
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
#warning "boost/functional/hash/vector.hpp is deprecated, use boost/functional/hash.hpp instead."
#include <boost/functional/hash.hpp>
#endif

View File

@@ -1,3 +1,10 @@
<!--
Copyright 2005-2006 Daniel James.
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-->
<html>
<head>
<meta http-equiv="refresh" content="0; URL=../../doc/html/hash.html">

View File

@@ -1,51 +0,0 @@
# Copyright Daniel James 2005-2006. Use, modification, and distribution are
# subject to the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
subproject libs/functional/hash/test ;
import testing ;
DEPENDS all : test ;
rule hash-test ( names + : extras * )
{
return [
run $(names).cpp
: : : <include>$(BOOST_ROOT) $(extras)
: $(names[1])
] ;
}
{
test-suite functional/hash
:
[ hash-test hash_fwd_test_1 ]
[ hash-test hash_fwd_test_2 ]
[ hash-test hash_number_test ]
[ hash-test hash_pointer_test ]
[ hash-test hash_function_pointer_test ]
[ hash-test hash_float_test : <test-info>always_show_run_output ]
[ hash-test hash_string_test ]
[ hash-test hash_range_test ]
[ hash-test hash_custom_test ]
[ hash-test hash_global_namespace_test ]
[ hash-test hash_friend_test ]
[ hash-test hash_built_in_array_test ]
[ hash-test hash_value_array_test ]
[ hash-test hash_vector_test ]
[ hash-test hash_list_test ]
[ hash-test hash_deque_test ]
[ hash-test hash_set_test ]
[ hash-test hash_map_test ]
[ hash-test link_test link_test_2 ]
[ hash-test link_ext_test link_no_ext_test ]
[ run container_fwd_test.cpp : : : <include>$(BOOST_ROOT) ]
[ compile-fail hash_no_ext_fail_test.cpp ]
[ run hash_no_ext_macro_1.cpp ]
[ run hash_no_ext_macro_2.cpp ]
;
}
subinclude libs/functional/hash/examples ;

View File

@@ -125,12 +125,17 @@ void float_tests(char const* name, T* = 0)
BOOST_TEST(x1(half_max) != x1(three_quarter_max));
BOOST_TEST(x1(three_quarter_max) == x1(three_quarter_max));
// Intel with gcc stdlib sometimes segfaults on calls to asin and acos.
#if !((defined(__INTEL_COMPILER) || defined(__ICL) || \
defined(__ICC) || defined(__ECC)) && \
(defined(__GLIBCPP__) || defined(__GLIBCXX__)))
T v1 = asin((T) 1);
T v2 = acos((T) 0);
if(v1 == v2)
BOOST_TEST(x1(v1) == x1(v2));
BOOST_TEST(x1(v1) == HASH_NAMESPACE::hash_value(v1));
BOOST_TEST(x1(v2) == HASH_NAMESPACE::hash_value(v2));
#endif
BOOST_TEST(x1(std::numeric_limits<T>::epsilon()) ==
HASH_NAMESPACE::hash_value(std::numeric_limits<T>::epsilon()));