2007-11-25 18:38:02 +00:00
2006-07-30 20:42:11 +00:00
<!--
2009-03-11 22:51:09 +00:00
Copyright Daniel James 2005-2009
2006-07-30 20:42:11 +00:00
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)
-->
2006-02-16 23:10:26 +00:00
<library-reference>
<section id= "hash.reference.specification" >
<para> For the full specification, see section 6.3 of the
2006-04-09 12:14:23 +00:00
<ulink url= "http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf" > C++ Standard Library Technical Report</ulink>
2006-02-16 23:10:26 +00:00
and issue 6.18 of the
2006-04-09 12:14:23 +00:00
<ulink url= "http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1837.pdf" > Library Extension Technical Report Issues List</ulink> (page 63).
2006-02-16 23:10:26 +00:00
</para>
</section>
<header name= "boost/functional/hash.hpp" >
<para>
Defines <code><classname> boost::hash</classname></code> ,
and helper functions.
</para>
<namespace name= "boost" >
<!--
boost::hash
-->
<struct name= "hash" >
<template>
<template-type-parameter name= "T" />
</template>
<inherit access= "public" >
<classname> std::unary_function< T, std::size_t> </classname>
</inherit>
2009-03-22 10:42:48 +00:00
<purpose><simpara> A <ulink url= "http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf" > TR1</ulink> compliant hash function object.</simpara></purpose>
2006-02-16 23:10:26 +00:00
<method name= "operator()" cv= "const" >
<type> std::size_t</type>
<parameter name= "val" >
<paramtype> T const& </paramtype>
</parameter>
<returns><para>
<programlisting><functionname> hash_value</functionname> (val)</programlisting>
</para></returns>
2006-03-07 22:49:27 +00:00
<notes>
<para>
The call to <code><functionname> hash_value</functionname></code>
is unqualified, so that custom overloads can be
found via argument dependent lookup.
</para>
<para>
This is not defined when the macro <code> BOOST_HASH_NO_EXTENSIONS</code>
is defined. The specializations are still defined, so only the specializations
required by TR1 are defined.
</para>
2012-05-27 21:13:49 +00:00
<para>
Forward declared in
<code> < boost/functional/hash_fwd.hpp> </code>
</para>
2006-03-07 22:49:27 +00:00
</notes>
2006-02-16 23:10:26 +00:00
<throws><para>
Only throws if
<code><functionname> hash_value</functionname> (T)</code> throws.
</para></throws>
</method>
</struct>
2006-03-07 22:49:27 +00:00
<struct-specialization name= "hash" >
<template></template>
<specialization>
<template-arg> bool</template-arg>
</specialization>
<method name= "operator()" cv= "const" >
<type> std::size_t</type>
<parameter name= "val" >
<paramtype> bool</paramtype>
</parameter>
<returns>
<para> Unspecified in TR1, except that equal arguments yield the same result.</para>
2006-03-28 17:05:43 +00:00
<para><functionname> hash_value</functionname> (val) in Boost.</para>
2006-03-07 22:49:27 +00:00
</returns>
<throws><para> Doesn't throw</para></throws>
</method>
</struct-specialization>
<struct-specialization name= "hash" >
<template></template>
<specialization>
<template-arg> char</template-arg>
</specialization>
<method name= "operator()" cv= "const" >
<type> std::size_t</type>
<parameter name= "val" >
<paramtype> char</paramtype>
</parameter>
<returns>
<para> Unspecified in TR1, except that equal arguments yield the same result.</para>
<para><functionname> hash_value</functionname> (val) in Boost.</para>
</returns>
<throws><para> Doesn't throw</para></throws>
</method>
</struct-specialization>
<struct-specialization name= "hash" >
<template></template>
<specialization>
<template-arg> signed char</template-arg>
</specialization>
<method name= "operator()" cv= "const" >
<type> std::size_t</type>
<parameter name= "val" >
<paramtype> signed char</paramtype>
</parameter>
<returns>
<para> Unspecified in TR1, except that equal arguments yield the same result.</para>
<para><functionname> hash_value</functionname> (val) in Boost.</para>
</returns>
<throws><para> Doesn't throw</para></throws>
</method>
</struct-specialization>
<struct-specialization name= "hash" >
<template></template>
<specialization>
<template-arg> unsigned char</template-arg>
</specialization>
<method name= "operator()" cv= "const" >
<type> std::size_t</type>
<parameter name= "val" >
<paramtype> unsigned char</paramtype>
</parameter>
<returns>
<para> Unspecified in TR1, except that equal arguments yield the same result.</para>
<para><functionname> hash_value</functionname> (val) in Boost.</para>
</returns>
<throws><para> Doesn't throw</para></throws>
</method>
</struct-specialization>
<struct-specialization name= "hash" >
<template></template>
<specialization>
<template-arg> wchar_t</template-arg>
</specialization>
<method name= "operator()" cv= "const" >
<type> std::size_t</type>
<parameter name= "val" >
<paramtype> wchar_t</paramtype>
</parameter>
<returns>
<para> Unspecified in TR1, except that equal arguments yield the same result.</para>
<para><functionname> hash_value</functionname> (val) in Boost.</para>
</returns>
<throws><para> Doesn't throw</para></throws>
</method>
</struct-specialization>
<struct-specialization name= "hash" >
<template></template>
<specialization>
<template-arg> short</template-arg>
</specialization>
<method name= "operator()" cv= "const" >
<type> std::size_t</type>
<parameter name= "val" >
<paramtype> short</paramtype>
</parameter>
<returns>
<para> Unspecified in TR1, except that equal arguments yield the same result.</para>
<para><functionname> hash_value</functionname> (val) in Boost.</para>
</returns>
<throws><para> Doesn't throw</para></throws>
</method>
</struct-specialization>
<struct-specialization name= "hash" >
<template></template>
<specialization>
<template-arg> unsigned short</template-arg>
</specialization>
<method name= "operator()" cv= "const" >
<type> std::size_t</type>
<parameter name= "val" >
<paramtype> unsigned short</paramtype>
</parameter>
<returns>
<para> Unspecified in TR1, except that equal arguments yield the same result.</para>
<para><functionname> hash_value</functionname> (val) in Boost.</para>
</returns>
<throws><para> Doesn't throw</para></throws>
</method>
</struct-specialization>
<struct-specialization name= "hash" >
<template></template>
<specialization>
<template-arg> int</template-arg>
</specialization>
<method name= "operator()" cv= "const" >
<type> std::size_t</type>
<parameter name= "val" >
<paramtype> int</paramtype>
</parameter>
<returns>
<para> Unspecified in TR1, except that equal arguments yield the same result.</para>
<para><functionname> hash_value</functionname> (val) in Boost.</para>
</returns>
<throws><para> Doesn't throw</para></throws>
</method>
</struct-specialization>
<struct-specialization name= "hash" >
<template></template>
<specialization>
<template-arg> unsigned int</template-arg>
</specialization>
<method name= "operator()" cv= "const" >
<type> std::size_t</type>
<parameter name= "val" >
<paramtype> unsigned int</paramtype>
</parameter>
<returns>
<para> Unspecified in TR1, except that equal arguments yield the same result.</para>
<para><functionname> hash_value</functionname> (val) in Boost.</para>
</returns>
<throws><para> Doesn't throw</para></throws>
</method>
</struct-specialization>
<struct-specialization name= "hash" >
<template></template>
<specialization>
<template-arg> long</template-arg>
</specialization>
<method name= "operator()" cv= "const" >
<type> std::size_t</type>
<parameter name= "val" >
<paramtype> long</paramtype>
</parameter>
<returns>
<para> Unspecified in TR1, except that equal arguments yield the same result.</para>
<para><functionname> hash_value</functionname> (val) in Boost.</para>
</returns>
<throws><para> Doesn't throw</para></throws>
</method>
</struct-specialization>
<struct-specialization name= "hash" >
<template></template>
<specialization>
<template-arg> unsigned long</template-arg>
</specialization>
<method name= "operator()" cv= "const" >
<type> std::size_t</type>
<parameter name= "val" >
<paramtype> unsigned long</paramtype>
</parameter>
<returns>
<para> Unspecified in TR1, except that equal arguments yield the same result.</para>
<para><functionname> hash_value</functionname> (val) in Boost.</para>
</returns>
<throws><para> Doesn't throw</para></throws>
</method>
</struct-specialization>
2007-11-25 18:38:02 +00:00
<struct-specialization name= "hash" >
<template></template>
<specialization>
<template-arg> long long</template-arg>
</specialization>
<method name= "operator()" cv= "const" >
<type> std::size_t</type>
<parameter name= "val" >
<paramtype> long long</paramtype>
</parameter>
<returns>
<para> Unspecified in TR1, except that equal arguments yield the same result.</para>
<para><functionname> hash_value</functionname> (val) in Boost.</para>
</returns>
<throws><para> Doesn't throw</para></throws>
</method>
</struct-specialization>
<struct-specialization name= "hash" >
<template></template>
<specialization>
<template-arg> unsigned long long</template-arg>
</specialization>
<method name= "operator()" cv= "const" >
<type> std::size_t</type>
<parameter name= "val" >
<paramtype> unsigned long long</paramtype>
</parameter>
<returns>
<para> Unspecified in TR1, except that equal arguments yield the same result.</para>
<para><functionname> hash_value</functionname> (val) in Boost.</para>
</returns>
<throws><para> Doesn't throw</para></throws>
</method>
</struct-specialization>
2006-03-07 22:49:27 +00:00
<struct-specialization name= "hash" >
<template></template>
<specialization>
<template-arg> float</template-arg>
</specialization>
<method name= "operator()" cv= "const" >
<type> std::size_t</type>
<parameter name= "val" >
<paramtype> float</paramtype>
</parameter>
<returns>
<para> Unspecified in TR1, except that equal arguments yield the same result.</para>
2006-03-28 17:05:43 +00:00
<para><functionname> hash_value</functionname> (val) in Boost.</para>
2006-03-07 22:49:27 +00:00
</returns>
<throws><para> Doesn't throw</para></throws>
</method>
</struct-specialization>
<struct-specialization name= "hash" >
<template></template>
<specialization>
<template-arg> double</template-arg>
</specialization>
<method name= "operator()" cv= "const" >
<type> std::size_t</type>
<parameter name= "val" >
<paramtype> double</paramtype>
</parameter>
<returns>
<para> Unspecified in TR1, except that equal arguments yield the same result.</para>
<para><functionname> hash_value</functionname> (val) in Boost.</para>
</returns>
<throws><para> Doesn't throw</para></throws>
</method>
</struct-specialization>
<struct-specialization name= "hash" >
<template></template>
<specialization>
<template-arg> long double</template-arg>
</specialization>
<method name= "operator()" cv= "const" >
<type> std::size_t</type>
<parameter name= "val" >
<paramtype> long double</paramtype>
</parameter>
<returns>
<para> Unspecified in TR1, except that equal arguments yield the same result.</para>
<para><functionname> hash_value</functionname> (val) in Boost.</para>
</returns>
<throws><para> Doesn't throw</para></throws>
</method>
</struct-specialization>
<struct-specialization name= "hash" >
<template></template>
<specialization>
<template-arg> std::string</template-arg>
</specialization>
<method name= "operator()" cv= "const" >
<type> std::size_t</type>
<parameter name= "val" >
<paramtype> std::string const& </paramtype>
</parameter>
<returns>
<para> Unspecified in TR1, except that equal arguments yield the same result.</para>
<para><functionname> hash_value</functionname> (val) in Boost.</para>
</returns>
<throws><para> Doesn't throw</para></throws>
</method>
</struct-specialization>
<struct-specialization name= "hash" >
<template></template>
<specialization>
<template-arg> std::wstring</template-arg>
</specialization>
<method name= "operator()" cv= "const" >
<type> std::size_t</type>
<parameter name= "val" >
<paramtype> std::wstring const& </paramtype>
</parameter>
<returns>
<para> Unspecified in TR1, except that equal arguments yield the same result.</para>
<para><functionname> hash_value</functionname> (val) in Boost.</para>
</returns>
<throws><para> Doesn't throw</para></throws>
</method>
</struct-specialization>
2007-05-01 21:28:45 +00:00
<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>
2011-01-17 04:15:00 +00:00
<struct-specialization name= "hash" >
<template></template>
<specialization>
<template-arg> std::type_index</template-arg>
</specialization>
<method name= "operator()" cv= "const" >
<type> std::size_t</type>
<parameter name= "val" >
<paramtype> std::type_index</paramtype>
</parameter>
<returns>
<para><code> val.hash_code()</code></para>
</returns>
<throws><para> Doesn't throw</para></throws>
</method>
<notes>
<para>
Only available if it's in your standard library and Boost.Config
is aware of it.
</para>
</notes>
</struct-specialization>
2008-06-12 00:27:13 +00:00
<free-function-group name= "Support functions (Boost extension)." >
2006-02-16 23:10:26 +00:00
<!--
boost::hash_combine
-->
<function name= "hash_combine" >
<template>
<template-type-parameter name= "T" />
</template>
<type> void</type>
<parameter name= "seed" ><paramtype> size_t & </paramtype></parameter>
2006-03-28 17:05:43 +00:00
<parameter name= "v" ><paramtype> T const& </paramtype></parameter>
2009-03-22 10:42:48 +00:00
<purpose><simpara>
2006-02-16 23:10:26 +00:00
Called repeatedly to incrementally create a hash value from
several variables.
2009-03-22 10:42:48 +00:00
</simpara></purpose>
2006-02-16 23:10:26 +00:00
<effects><programlisting> seed ^= <functionname> hash_value</functionname> (v) + 0x9e3779b9 + (seed << 6) + (seed >> 2);</programlisting></effects>
<notes>
<para><functionname> hash_value</functionname> is called without
qualification, so that overloads can be found via ADL.</para>
<para> This is an extension to TR1</para>
2012-05-27 21:13:49 +00:00
<para>
Forward declared in
<code> < boost/functional/hash_fwd.hpp> </code>
</para>
2006-02-16 23:10:26 +00:00
</notes>
<throws>
Only throws if <functionname> hash_value</functionname> (T) throws.
Strong exception safety, as long as <functionname> hash_value</functionname> (T)
also has strong exception safety.
</throws>
</function>
<!--
boost::hash_range
-->
<overloaded-function name= "hash_range" >
<signature>
<template>
<template-type-parameter name= "It" />
</template>
<type> std::size_t</type>
<parameter name= "first" ><paramtype> It</paramtype></parameter>
<parameter name= "last" ><paramtype> It</paramtype></parameter>
</signature>
<signature>
<template>
<template-type-parameter name= "It" />
</template>
<type> void</type>
<parameter name= "seed" ><paramtype> std::size_t& </paramtype></parameter>
<parameter name= "first" ><paramtype> It</paramtype></parameter>
<parameter name= "last" ><paramtype> It</paramtype></parameter>
</signature>
2009-03-22 10:42:48 +00:00
<purpose><simpara>
2006-02-16 23:10:26 +00:00
Calculate the combined hash value of the elements of an iterator
range.
2009-03-22 10:42:48 +00:00
</simpara></purpose>
2006-02-16 23:10:26 +00:00
<effects>
<para> For the two argument overload:
<programlisting>
size_t seed = 0;
for(; first != last; ++first)
{
<functionname> hash_combine</functionname> (seed, *first);
}
return seed;
</programlisting>
2012-05-27 21:13:49 +00:00
</para>
<para> For the three arguments overload:</para>
2006-02-16 23:10:26 +00:00
<programlisting>
for(; first != last; ++first)
{
<functionname> hash_combine</functionname> (seed, *first);
}
</programlisting>
</effects>
<notes>
<para>
<code> hash_range</code> is sensitive to the order of the elements
so it wouldn't be appropriate to use this with an unordered
container.
</para>
<para> This is an extension to TR1</para>
2012-05-27 21:13:49 +00:00
<para>
Forward declared in
<code> < boost/functional/hash_fwd.hpp> </code>
</para>
2006-02-16 23:10:26 +00:00
</notes>
<throws><para>
Only throws if <code><functionname> hash_value</functionname> (std::iterator_traits< It> ::value_type)</code>
throws. <code> hash_range(std::size_t& , It, It)</code> has basic exception safety as long as
<code><functionname> hash_value</functionname> (std::iterator_traits< It> ::value_type)</code>
has basic exception safety.
</para></throws>
</overloaded-function>
2008-06-12 00:27:13 +00:00
</free-function-group>
<free-function-group name= "Overloadable hash implementation (Boost extension)." >
2006-02-16 23:10:26 +00:00
<!--
boost::hash_value - integers
-->
<overloaded-function name= "hash_value" >
2009-03-22 10:42:48 +00:00
<purpose><simpara>
2006-03-28 17:05:43 +00:00
Implementation of the hash function.
2009-03-22 10:42:48 +00:00
</simpara></purpose>
2006-02-16 23:10:26 +00:00
2007-11-25 18:38:02 +00:00
<signature>
<type> std::size_t</type>
<parameter name= "val" ><paramtype> bool</paramtype></parameter>
</signature>
<signature>
<type> std::size_t</type>
<parameter name= "val" ><paramtype> char</paramtype></parameter>
</signature>
<signature>
<type> std::size_t</type>
<parameter name= "val" ><paramtype> signed char</paramtype></parameter>
</signature>
<signature>
<type> std::size_t</type>
<parameter name= "val" ><paramtype> unsigned char</paramtype></parameter>
</signature>
<signature>
<type> std::size_t</type>
<parameter name= "val" ><paramtype> wchar_t</paramtype></parameter>
</signature>
<signature>
<type> std::size_t</type>
<parameter name= "val" ><paramtype> short</paramtype></parameter>
</signature>
<signature>
<type> std::size_t</type>
<parameter name= "val" ><paramtype> unsigned short</paramtype></parameter>
</signature>
2006-02-16 23:10:26 +00:00
<signature>
<type> std::size_t</type>
<parameter name= "val" ><paramtype> int</paramtype></parameter>
</signature>
<signature>
<type> std::size_t</type>
<parameter name= "val" ><paramtype> unsigned int</paramtype></parameter>
</signature>
<signature>
<type> std::size_t</type>
<parameter name= "val" ><paramtype> long</paramtype></parameter>
</signature>
<signature>
<type> std::size_t</type>
<parameter name= "val" ><paramtype> unsigned long</paramtype></parameter>
</signature>
2007-11-25 18:38:02 +00:00
<signature>
<type> std::size_t</type>
<parameter name= "val" ><paramtype> long long</paramtype></parameter>
</signature>
<signature>
<type> std::size_t</type>
<parameter name= "val" ><paramtype> unsigned long long</paramtype></parameter>
</signature>
2006-02-16 23:10:26 +00:00
<signature>
<type> std::size_t</type>
<parameter name= "val" ><paramtype> float</paramtype></parameter>
</signature>
<signature>
<type> std::size_t</type>
<parameter name= "val" ><paramtype> double</paramtype></parameter>
</signature>
<signature>
<type> std::size_t</type>
<parameter name= "val" ><paramtype> long double</paramtype></parameter>
</signature>
<signature>
<template><template-type-parameter name= "T" /></template>
<type> std::size_t</type>
<parameter name= "val" ><paramtype> T* const& </paramtype></parameter>
</signature>
<signature>
<template>
<template-type-parameter name= "T" />
<template-nontype-parameter name= "N" ><type> unsigned</type></template-nontype-parameter>
</template>
<type> std::size_t</type>
<parameter><paramtype> T (& val)[N]</paramtype></parameter>
</signature>
<signature>
<template>
<template-type-parameter name= "T" />
<template-nontype-parameter name= "N" ><type> unsigned</type></template-nontype-parameter>
</template>
<type> std::size_t</type>
<parameter><paramtype> const T (& val)[N]</paramtype></parameter>
</signature>
<signature>
<template>
<template-type-parameter name= "Ch" />
<template-type-parameter name= "A" />
</template>
<type> std::size_t</type>
<parameter name= "val" >
<paramtype> std::basic_string< Ch, std::char_traits< Ch> , A> const& </paramtype>
</parameter>
</signature>
2006-03-28 17:05:43 +00:00
<signature>
2006-02-16 23:10:26 +00:00
<template>
<template-type-parameter name= "A" />
<template-type-parameter name= "B" />
</template>
<type> std::size_t</type>
2006-03-28 17:05:43 +00:00
<parameter name= "val" ><paramtype> std::pair< A, B> const& </paramtype></parameter>
2006-02-16 23:10:26 +00:00
</signature>
2006-03-28 17:05:43 +00:00
<signature>
<template>
<template-type-parameter name= "T" />
<template-type-parameter name= "A" />
</template>
<type> std::size_t</type>
<parameter name= "val" ><paramtype> std::vector< T, A> const& </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< T, A> const& </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< T, A> const& </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< K, C, A> const& </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< K, C, A> const& </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< K, T, C, A> const& </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< K, T, C, A> const& </paramtype></parameter>
</signature>
2007-11-25 18:38:02 +00:00
<signature>
<template>
<template-type-parameter name= "T" />
</template>
<type> std::size_t</type>
<parameter name= "val" ><paramtype> std::complex< T> const& </paramtype></parameter>
</signature>
2011-01-17 04:15:00 +00:00
<signature>
<type> std::size_t</type>
<parameter name= "val" ><paramtype> std::type_index</paramtype></parameter>
</signature>
2012-05-03 22:05:21 +00:00
<signature>
<template>
<template-type-parameter name= "T" />
<template-nontype-parameter name= "N" >
<type> std::size_t</type>
</template-nontype-parameter>
</template>
<type> std::size_t</type>
<parameter name= "val" ><paramtype> std::array< T, N> const& </paramtype></parameter>
</signature>
<signature>
<template>
<template-type-parameter name= "T" pack= "1" />
</template>
<type> std::size_t</type>
<parameter name= "val" ><paramtype> std::tuple< T...> </paramtype></parameter>
</signature>
2006-03-28 17:05:43 +00:00
<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>
2006-02-16 23:10:26 +00:00
<throws>
2006-03-28 17:05:43 +00:00
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.
2006-02-16 23:10:26 +00:00
</throws>
<returns>
2006-03-28 17:05:43 +00:00
<informaltable>
<tgroup cols= "2" >
<thead>
<row>
<entry> Types</entry>
<entry> Returns</entry>
</row>
</thead>
<tbody>
<row>
2007-11-25 18:38:02 +00:00
<entry><code> bool</code> ,
<code> char</code> , <code> signed char</code> , <code> unsigned char</code> , <code> wchar_t</code> ,
<code> short</code> , <code> unsigned short</code> ,
<code> int</code> , <code> unsigned int</code> , <code> long</code> , <code> unsigned long</code>
</entry>
2006-04-06 19:55:06 +00:00
<entry><code> val</code></entry>
2006-03-28 17:05:43 +00:00
</row>
2007-11-25 18:38:02 +00:00
<row>
<entry><code> long long</code> , <code> unsigned long long</code></entry>
<entry><code> val</code> when <code> abs(val) < = std::numeric_limits< std::size_t> ::max()</code> .</entry>
</row>
2006-03-28 17:05:43 +00:00
<row>
2006-04-06 19:55:06 +00:00
<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>
2006-03-28 17:05:43 +00:00
</row>
<row>
2006-04-06 19:55:06 +00:00
<entry><code> T*</code></entry>
<entry> An unspecified value, except that equal arguments shall yield the same result.</entry>
2006-03-28 17:05:43 +00:00
</row>
<row>
2006-04-06 19:55:06 +00:00
<entry>
<code> T  val[N]</code> ,
<code> const  T  val[N]</code>
</entry>
<entry><code> hash_range(val, val+N)</code></entry>
2006-03-28 17:05:43 +00:00
</row>
<row>
2006-04-06 19:55:06 +00:00
<entry>
<code> std:basic_string< Ch,  std::char_traits< Ch> ,  A> </code> ,
<code> std::vector< T,  A> </code> ,
<code> std::list< T,  A> </code> ,
<code> std::deque< T,  A> </code> ,
<code> std::set< K,  C,  A> </code> ,
<code> std::multiset< K,  C,  A> </code> ,
<code> std::map< K,  T,  C,  A> </code> ,
2012-05-03 22:05:21 +00:00
<code> std::multimap< K,  T,  C,  A> </code> ,
<code> std::array< T,  N> </code>
2006-04-06 19:55:06 +00:00
</entry>
<entry><code> hash_range(val.begin(), val.end())</code></entry>
</row>
<row>
<entry><code> std::pair< A, B> </code></entry>
2006-03-28 17:05:43 +00:00
<entry><programlisting> size_t seed = 0;
<functionname> hash_combine</functionname> (seed, val.first);
<functionname> hash_combine</functionname> (seed, val.second);
2012-05-03 22:05:21 +00:00
return seed;</programlisting></entry>
</row>
<row>
<entry><code> std::tuple< T...> </code></entry>
<entry><programlisting> size_t seed = 0;
<functionname> hash_combine</functionname> (seed, get< 0> (val));
<functionname> hash_combine</functionname> (seed, get< 1> (val));
// ....
2006-03-28 17:05:43 +00:00
return seed;</programlisting></entry>
</row>
2007-11-25 18:38:02 +00:00
<row>
<entry>
<code> std::complex< T> </code>
</entry>
<entry> When <code> T</code> is a built in type and <code> val.imag() == 0</code> , the result is equal to <code> hash_value(val.real())</code> . Otherwise an unspecified value, except that equal arguments shall yield the same result.</entry>
</row>
2011-01-17 04:15:00 +00:00
<row>
<entry>
<code> std::type_index</code>
</entry>
<entry><code> val.hash_code()</code></entry>
</row>
2006-03-28 17:05:43 +00:00
</tbody>
</tgroup>
</informaltable>
2006-02-16 23:10:26 +00:00
</returns>
2006-03-28 17:05:43 +00:00
</overloaded-function>
2008-06-12 00:27:13 +00:00
</free-function-group>
2006-02-16 23:10:26 +00:00
</namespace>
</header>
</library-reference>