summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '3rdParty/Boost/src/boost/functional')
-rw-r--r--3rdParty/Boost/src/boost/functional/hash/detail/container_fwd_0x.hpp29
-rw-r--r--3rdParty/Boost/src/boost/functional/hash/detail/hash_float.hpp195
-rw-r--r--3rdParty/Boost/src/boost/functional/hash/detail/hash_float_generic.hpp91
-rw-r--r--3rdParty/Boost/src/boost/functional/hash/detail/hash_float_x86.hpp56
-rw-r--r--3rdParty/Boost/src/boost/functional/hash/extensions.hpp101
-rw-r--r--3rdParty/Boost/src/boost/functional/hash/hash.hpp183
6 files changed, 379 insertions, 276 deletions
diff --git a/3rdParty/Boost/src/boost/functional/hash/detail/container_fwd_0x.hpp b/3rdParty/Boost/src/boost/functional/hash/detail/container_fwd_0x.hpp
new file mode 100644
index 0000000..bed7730
--- /dev/null
+++ b/3rdParty/Boost/src/boost/functional/hash/detail/container_fwd_0x.hpp
@@ -0,0 +1,29 @@
+
+// Copyright 2012 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)
+
+#if !defined(BOOST_DETAIL_CONTAINER_FWD_0X_HPP)
+#define BOOST_DETAIL_CONTAINER_FWD_0X_HPP
+
+#include <boost/detail/container_fwd.hpp>
+
+// std::array
+
+#if !defined(BOOST_NO_CXX11_HDR_ARRAY)
+# include <array>
+#endif
+
+// std::tuple
+
+#if !defined(BOOST_NO_CXX11_HDR_TUPLE)
+# include <tuple>
+#endif
+
+// std::shared_ptr/std::unique_ptr
+
+#if !defined(BOOST_NO_CXX11_HDR_MEMORY)
+# include <memory>
+#endif
+
+#endif
diff --git a/3rdParty/Boost/src/boost/functional/hash/detail/hash_float.hpp b/3rdParty/Boost/src/boost/functional/hash/detail/hash_float.hpp
index ea1bc25..3edc6ab 100644
--- a/3rdParty/Boost/src/boost/functional/hash/detail/hash_float.hpp
+++ b/3rdParty/Boost/src/boost/functional/hash/detail/hash_float.hpp
@@ -1,5 +1,5 @@
-// Copyright 2005-2009 Daniel James.
+// Copyright 2005-2012 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)
@@ -13,21 +13,19 @@
#include <boost/config.hpp>
#include <boost/functional/hash/detail/float_functions.hpp>
#include <boost/functional/hash/detail/limits.hpp>
+#include <boost/utility/enable_if.hpp>
#include <boost/integer/static_log2.hpp>
#include <boost/cstdint.hpp>
#include <boost/assert.hpp>
+#include <boost/limits.hpp>
+#include <cstring>
-// Include hash implementation for the current platform.
-
-// Cygwn
-#if defined(__CYGWIN__)
-# if defined(__i386__) || defined(_M_IX86)
-# include <boost/functional/hash/detail/hash_float_x86.hpp>
-# else
-# include <boost/functional/hash/detail/hash_float_generic.hpp>
-# endif
-#else
-# include <boost/functional/hash/detail/hash_float_generic.hpp>
+#if defined(BOOST_MSVC)
+#pragma warning(push)
+#if BOOST_MSVC >= 1400
+#pragma warning(disable:6294) // Ill-defined for-loop: initial condition does
+ // not satisfy test. Loop body not executed
+#endif
#endif
// Can we use fpclassify?
@@ -50,6 +48,157 @@
# define BOOST_HASH_USE_FPCLASSIFY 0
#endif
+namespace boost
+{
+ namespace hash_detail
+ {
+ inline void hash_float_combine(std::size_t& seed, std::size_t value)
+ {
+ seed ^= value + (seed<<6) + (seed>>2);
+ }
+
+ ////////////////////////////////////////////////////////////////////////
+ // Binary hash function
+ //
+ // Only used for floats with known iec559 floats, and certain values in
+ // numeric_limits
+
+ inline std::size_t hash_binary(char* ptr, std::size_t length)
+ {
+ std::size_t seed = 0;
+
+ if (length >= sizeof(std::size_t)) {
+ seed = *(std::size_t*) ptr;
+ length -= sizeof(std::size_t);
+ ptr += sizeof(std::size_t);
+
+ while(length >= sizeof(std::size_t)) {
+ hash_float_combine(seed, *(std::size_t*) ptr);
+ length -= sizeof(std::size_t);
+ ptr += sizeof(std::size_t);
+ }
+ }
+
+ if (length > 0) {
+ std::size_t buffer = 0;
+ std::memcpy(&buffer, ptr, length);
+ hash_float_combine(seed, buffer);
+ }
+
+ return seed;
+ }
+
+ template <typename Float>
+ inline std::size_t float_hash_impl(Float v,
+ BOOST_DEDUCED_TYPENAME boost::enable_if_c<
+ std::numeric_limits<Float>::is_iec559 &&
+ std::numeric_limits<Float>::digits == 24 &&
+ std::numeric_limits<Float>::radix == 2 &&
+ std::numeric_limits<Float>::max_exponent == 128,
+ int>::type
+ )
+ {
+ return hash_binary((char*) &v, 4);
+ }
+
+
+ template <typename Float>
+ inline std::size_t float_hash_impl(Float v,
+ BOOST_DEDUCED_TYPENAME boost::enable_if_c<
+ std::numeric_limits<Float>::is_iec559 &&
+ std::numeric_limits<Float>::digits == 53 &&
+ std::numeric_limits<Float>::radix == 2 &&
+ std::numeric_limits<Float>::max_exponent == 1024,
+ int>::type
+ )
+ {
+ return hash_binary((char*) &v, 8);
+ }
+
+ template <typename Float>
+ inline std::size_t float_hash_impl(Float v,
+ BOOST_DEDUCED_TYPENAME boost::enable_if_c<
+ std::numeric_limits<Float>::is_iec559 &&
+ std::numeric_limits<Float>::digits == 64 &&
+ std::numeric_limits<Float>::radix == 2 &&
+ std::numeric_limits<Float>::max_exponent == 16384,
+ int>::type
+ )
+ {
+ return hash_binary((char*) &v, 10);
+ }
+
+ template <typename Float>
+ inline std::size_t float_hash_impl(Float v,
+ BOOST_DEDUCED_TYPENAME boost::enable_if_c<
+ std::numeric_limits<Float>::is_iec559 &&
+ std::numeric_limits<Float>::digits == 113 &&
+ std::numeric_limits<Float>::radix == 2 &&
+ std::numeric_limits<Float>::max_exponent == 16384,
+ int>::type
+ )
+ {
+ return hash_binary((char*) &v, 16);
+ }
+
+ ////////////////////////////////////////////////////////////////////////
+ // Portable hash function
+ //
+ // Used as a fallback when the binary hash function isn't supported.
+
+ template <class T>
+ inline std::size_t float_hash_impl2(T v)
+ {
+ boost::hash_detail::call_frexp<T> frexp;
+ boost::hash_detail::call_ldexp<T> ldexp;
+
+ int exp = 0;
+
+ v = frexp(v, &exp);
+
+ // A postive value is easier to hash, so combine the
+ // sign with the exponent and use the absolute value.
+ if(v < 0) {
+ v = -v;
+ exp += limits<T>::max_exponent -
+ limits<T>::min_exponent;
+ }
+
+ v = ldexp(v, limits<std::size_t>::digits);
+ std::size_t seed = static_cast<std::size_t>(v);
+ v -= static_cast<T>(seed);
+
+ // ceiling(digits(T) * log2(radix(T))/ digits(size_t)) - 1;
+ std::size_t const length
+ = (limits<T>::digits *
+ boost::static_log2<limits<T>::radix>::value
+ + limits<std::size_t>::digits - 1)
+ / limits<std::size_t>::digits;
+
+ for(std::size_t i = 0; i != length; ++i)
+ {
+ v = ldexp(v, limits<std::size_t>::digits);
+ std::size_t part = static_cast<std::size_t>(v);
+ v -= static_cast<T>(part);
+ hash_float_combine(seed, part);
+ }
+
+ hash_float_combine(seed, exp);
+
+ return seed;
+ }
+
+#if !defined(BOOST_HASH_DETAIL_TEST_WITHOUT_GENERIC)
+ template <class T>
+ inline std::size_t float_hash_impl(T v, ...)
+ {
+ typedef BOOST_DEDUCED_TYPENAME select_hash_type<T>::type type;
+ return float_hash_impl2(static_cast<type>(v));
+ }
+#endif
+ }
+}
+
#if BOOST_HASH_USE_FPCLASSIFY
#include <boost/config/no_tr1/cmath.hpp>
@@ -71,7 +220,7 @@ namespace boost
return (std::size_t)(-3);
case FP_NORMAL:
case FP_SUBNORMAL:
- return float_hash_impl(v);
+ return float_hash_impl(v, 0);
default:
BOOST_ASSERT(0);
return 0;
@@ -87,9 +236,23 @@ namespace boost
namespace hash_detail
{
template <class T>
+ inline bool is_zero(T v)
+ {
+#if !defined(__GNUC__)
+ return v == 0;
+#else
+ // GCC's '-Wfloat-equal' will complain about comparing
+ // v to 0, but because it disables warnings for system
+ // headers it won't complain if you use std::equal_to to
+ // compare with 0. Resulting in this silliness:
+ return std::equal_to<T>()(v, 0);
+#endif
+ }
+
+ template <class T>
inline std::size_t float_hash_value(T v)
{
- return v == 0 ? 0 : float_hash_impl(v);
+ return boost::hash_detail::is_zero(v) ? 0 : float_hash_impl(v, 0);
}
}
}
@@ -98,4 +261,8 @@ namespace boost
#undef BOOST_HASH_USE_FPCLASSIFY
+#if defined(BOOST_MSVC)
+#pragma warning(pop)
+#endif
+
#endif
diff --git a/3rdParty/Boost/src/boost/functional/hash/detail/hash_float_generic.hpp b/3rdParty/Boost/src/boost/functional/hash/detail/hash_float_generic.hpp
deleted file mode 100644
index 1278c2f..0000000
--- a/3rdParty/Boost/src/boost/functional/hash/detail/hash_float_generic.hpp
+++ /dev/null
@@ -1,91 +0,0 @@
-
-// Copyright 2005-2009 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)
-
-// A general purpose hash function for non-zero floating point values.
-
-#if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_GENERIC_HEADER)
-#define BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_GENERIC_HEADER
-
-#include <boost/functional/hash/detail/float_functions.hpp>
-#include <boost/integer/static_log2.hpp>
-#include <boost/functional/hash/detail/limits.hpp>
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-# pragma once
-#endif
-
-#if defined(BOOST_MSVC)
-#pragma warning(push)
-#if BOOST_MSVC >= 1400
-#pragma warning(disable:6294) // Ill-defined for-loop: initial condition does
- // not satisfy test. Loop body not executed
-#endif
-#endif
-
-namespace boost
-{
- namespace hash_detail
- {
- inline void hash_float_combine(std::size_t& seed, std::size_t value)
- {
- seed ^= value + (seed<<6) + (seed>>2);
- }
-
- template <class T>
- inline std::size_t float_hash_impl2(T v)
- {
- boost::hash_detail::call_frexp<T> frexp;
- boost::hash_detail::call_ldexp<T> ldexp;
-
- int exp = 0;
-
- v = frexp(v, &exp);
-
- // A postive value is easier to hash, so combine the
- // sign with the exponent and use the absolute value.
- if(v < 0) {
- v = -v;
- exp += limits<T>::max_exponent -
- limits<T>::min_exponent;
- }
-
- v = ldexp(v, limits<std::size_t>::digits);
- std::size_t seed = static_cast<std::size_t>(v);
- v -= static_cast<T>(seed);
-
- // ceiling(digits(T) * log2(radix(T))/ digits(size_t)) - 1;
- std::size_t const length
- = (limits<T>::digits *
- boost::static_log2<limits<T>::radix>::value
- + limits<std::size_t>::digits - 1)
- / limits<std::size_t>::digits;
-
- for(std::size_t i = 0; i != length; ++i)
- {
- v = ldexp(v, limits<std::size_t>::digits);
- std::size_t part = static_cast<std::size_t>(v);
- v -= static_cast<T>(part);
- hash_float_combine(seed, part);
- }
-
- hash_float_combine(seed, exp);
-
- return seed;
- }
-
- template <class T>
- inline std::size_t float_hash_impl(T v)
- {
- typedef BOOST_DEDUCED_TYPENAME select_hash_type<T>::type type;
- return float_hash_impl2(static_cast<type>(v));
- }
- }
-}
-
-#if defined(BOOST_MSVC)
-#pragma warning(pop)
-#endif
-
-#endif
diff --git a/3rdParty/Boost/src/boost/functional/hash/detail/hash_float_x86.hpp b/3rdParty/Boost/src/boost/functional/hash/detail/hash_float_x86.hpp
deleted file mode 100644
index b39bb0d..0000000
--- a/3rdParty/Boost/src/boost/functional/hash/detail/hash_float_x86.hpp
+++ /dev/null
@@ -1,56 +0,0 @@
-
-// Copyright 2005-2009 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)
-
-// A non-portable hash function form non-zero floats on x86.
-//
-// Even if you're on an x86 platform, this might not work if their floating
-// point isn't set up as this expects. So this should only be used if it's
-// absolutely certain that it will work.
-
-#if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_X86_HEADER)
-#define BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_X86_HEADER
-
-#include <boost/cstdint.hpp>
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-# pragma once
-#endif
-
-namespace boost
-{
- namespace hash_detail
- {
- inline void hash_float_combine(std::size_t& seed, std::size_t value)
- {
- seed ^= value + (seed<<6) + (seed>>2);
- }
-
- inline std::size_t float_hash_impl(float v)
- {
- boost::uint32_t* ptr = (boost::uint32_t*)&v;
- std::size_t seed = *ptr;
- return seed;
- }
-
- inline std::size_t float_hash_impl(double v)
- {
- boost::uint32_t* ptr = (boost::uint32_t*)&v;
- std::size_t seed = *ptr++;
- hash_float_combine(seed, *ptr);
- return seed;
- }
-
- inline std::size_t float_hash_impl(long double v)
- {
- boost::uint32_t* ptr = (boost::uint32_t*)&v;
- std::size_t seed = *ptr++;
- hash_float_combine(seed, *ptr++);
- hash_float_combine(seed, *(boost::uint16_t*)ptr);
- return seed;
- }
- }
-}
-
-#endif
diff --git a/3rdParty/Boost/src/boost/functional/hash/extensions.hpp b/3rdParty/Boost/src/boost/functional/hash/extensions.hpp
index 3c587a3..4358736 100644
--- a/3rdParty/Boost/src/boost/functional/hash/extensions.hpp
+++ b/3rdParty/Boost/src/boost/functional/hash/extensions.hpp
@@ -14,7 +14,11 @@
#define BOOST_FUNCTIONAL_HASH_EXTENSIONS_HPP
#include <boost/functional/hash/hash.hpp>
-#include <boost/detail/container_fwd.hpp>
+#include <boost/functional/hash/detail/container_fwd_0x.hpp>
+#include <boost/utility/enable_if.hpp>
+#include <boost/static_assert.hpp>
+#include <boost/preprocessor/repetition/repeat_from_to.hpp>
+#include <boost/preprocessor/repetition/enum_params.hpp>
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
@@ -54,51 +58,51 @@ namespace boost
std::size_t hash_value(std::pair<A, B> const& v)
{
std::size_t seed = 0;
- hash_combine(seed, v.first);
- hash_combine(seed, v.second);
+ boost::hash_combine(seed, v.first);
+ boost::hash_combine(seed, v.second);
return seed;
}
template <class T, class A>
std::size_t hash_value(std::vector<T, A> const& v)
{
- return hash_range(v.begin(), v.end());
+ return boost::hash_range(v.begin(), v.end());
}
template <class T, class A>
std::size_t hash_value(std::list<T, A> const& v)
{
- return hash_range(v.begin(), v.end());
+ return boost::hash_range(v.begin(), v.end());
}
template <class T, class A>
std::size_t hash_value(std::deque<T, A> const& v)
{
- return hash_range(v.begin(), v.end());
+ return boost::hash_range(v.begin(), v.end());
}
template <class K, class C, class A>
std::size_t hash_value(std::set<K, C, A> const& v)
{
- return hash_range(v.begin(), v.end());
+ return boost::hash_range(v.begin(), v.end());
}
template <class K, class C, class A>
std::size_t hash_value(std::multiset<K, C, A> const& v)
{
- return hash_range(v.begin(), v.end());
+ return boost::hash_range(v.begin(), v.end());
}
template <class K, class T, class C, class A>
std::size_t hash_value(std::map<K, T, C, A> const& v)
{
- return hash_range(v.begin(), v.end());
+ return boost::hash_range(v.begin(), v.end());
}
template <class K, class T, class C, class A>
std::size_t hash_value(std::multimap<K, T, C, A> const& v)
{
- return hash_range(v.begin(), v.end());
+ return boost::hash_range(v.begin(), v.end());
}
template <class T>
@@ -110,6 +114,83 @@ namespace boost
return seed;
}
+#if !defined(BOOST_NO_CXX11_HDR_ARRAY)
+ template <class T, std::size_t N>
+ std::size_t hash_value(std::array<T, N> const& v)
+ {
+ return boost::hash_range(v.begin(), v.end());
+ }
+#endif
+
+#if !defined(BOOST_NO_CXX11_HDR_TUPLE)
+ namespace hash_detail {
+ template <std::size_t I, typename T>
+ inline typename boost::enable_if_c<(I == std::tuple_size<T>::value),
+ void>::type
+ hash_combine_tuple(std::size_t&, T const&)
+ {
+ }
+
+ template <std::size_t I, typename T>
+ inline typename boost::enable_if_c<(I < std::tuple_size<T>::value),
+ void>::type
+ hash_combine_tuple(std::size_t& seed, T const& v)
+ {
+ boost::hash_combine(seed, std::get<I>(v));
+ boost::hash_detail::hash_combine_tuple<I + 1>(seed, v);
+ }
+
+ template <typename T>
+ inline std::size_t hash_tuple(T const& v)
+ {
+ std::size_t seed = 0;
+ boost::hash_detail::hash_combine_tuple<0>(seed, v);
+ return seed;
+ }
+ }
+
+#if !defined(BOOST_NO_VARIADIC_TEMPLATES)
+ template <typename... T>
+ inline std::size_t hash_value(std::tuple<T...> const& v)
+ {
+ return boost::hash_detail::hash_tuple(v);
+ }
+#else
+
+ inline std::size_t hash_value(std::tuple<> const& v)
+ {
+ return boost::hash_detail::hash_tuple(v);
+ }
+
+# define BOOST_HASH_TUPLE_F(z, n, _) \
+ template< \
+ BOOST_PP_ENUM_PARAMS_Z(z, n, typename A) \
+ > \
+ inline std::size_t hash_value(std::tuple< \
+ BOOST_PP_ENUM_PARAMS_Z(z, n, A) \
+ > const& v) \
+ { \
+ return boost::hash_detail::hash_tuple(v); \
+ }
+
+ BOOST_PP_REPEAT_FROM_TO(1, 11, BOOST_HASH_TUPLE_F, _)
+# undef BOOST_HASH_TUPLE_F
+#endif
+
+#endif
+
+#if !defined(BOOST_NO_CXX11_SMART_PTR)
+ template <typename T>
+ inline std::size_t hash_value(std::shared_ptr<T> const& x) {
+ return boost::hash_value(x.get());
+ }
+
+ template <typename T, typename Deleter>
+ inline std::size_t hash_value(std::unique_ptr<T, Deleter> const& x) {
+ return boost::hash_value(x.get());
+ }
+#endif
+
//
// call_hash_impl
//
diff --git a/3rdParty/Boost/src/boost/functional/hash/hash.hpp b/3rdParty/Boost/src/boost/functional/hash/hash.hpp
index 51ec860..647fd68 100644
--- a/3rdParty/Boost/src/boost/functional/hash/hash.hpp
+++ b/3rdParty/Boost/src/boost/functional/hash/hash.hpp
@@ -15,16 +15,14 @@
#include <boost/functional/hash/detail/hash_float.hpp>
#include <string>
#include <boost/limits.hpp>
-
-#if defined(BOOST_HASH_NO_IMPLICIT_CASTS)
-#include <boost/static_assert.hpp>
-#endif
+#include <boost/type_traits/is_enum.hpp>
+#include <boost/utility/enable_if.hpp>
#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
#include <boost/type_traits/is_pointer.hpp>
#endif
-#if !defined(BOOST_NO_0X_HDR_TYPEINDEX)
+#if !defined(BOOST_NO_CXX11_HDR_TYPEINDEX)
#include <typeindex>
#endif
@@ -37,38 +35,67 @@
namespace boost
{
-#if defined(BOOST_HASH_NO_IMPLICIT_CASTS)
-
- // If you get a static assertion here, it's because hash_value
- // isn't declared for your type.
- template <typename T>
- std::size_t hash_value(T const&) {
- BOOST_STATIC_ASSERT((T*) 0 && false);
- return 0;
- }
-
-#endif
-
- std::size_t hash_value(bool);
- std::size_t hash_value(char);
- std::size_t hash_value(unsigned char);
- std::size_t hash_value(signed char);
- std::size_t hash_value(short);
- std::size_t hash_value(unsigned short);
- std::size_t hash_value(int);
- std::size_t hash_value(unsigned int);
- std::size_t hash_value(long);
- std::size_t hash_value(unsigned long);
+ namespace hash_detail
+ {
+ struct enable_hash_value { typedef std::size_t type; };
+
+ template <typename T> struct basic_numbers {};
+ template <typename T> struct long_numbers {};
+ template <typename T> struct ulong_numbers {};
+ template <typename T> struct float_numbers {};
+
+ template <> struct basic_numbers<bool> :
+ boost::hash_detail::enable_hash_value {};
+ template <> struct basic_numbers<char> :
+ boost::hash_detail::enable_hash_value {};
+ template <> struct basic_numbers<unsigned char> :
+ boost::hash_detail::enable_hash_value {};
+ template <> struct basic_numbers<signed char> :
+ boost::hash_detail::enable_hash_value {};
+ template <> struct basic_numbers<short> :
+ boost::hash_detail::enable_hash_value {};
+ template <> struct basic_numbers<unsigned short> :
+ boost::hash_detail::enable_hash_value {};
+ template <> struct basic_numbers<int> :
+ boost::hash_detail::enable_hash_value {};
+ template <> struct basic_numbers<unsigned int> :
+ boost::hash_detail::enable_hash_value {};
+ template <> struct basic_numbers<long> :
+ boost::hash_detail::enable_hash_value {};
+ template <> struct basic_numbers<unsigned long> :
+ boost::hash_detail::enable_hash_value {};
#if !defined(BOOST_NO_INTRINSIC_WCHAR_T)
- std::size_t hash_value(wchar_t);
+ template <> struct basic_numbers<wchar_t> :
+ boost::hash_detail::enable_hash_value {};
#endif
-
+
#if !defined(BOOST_NO_LONG_LONG)
- std::size_t hash_value(boost::long_long_type);
- std::size_t hash_value(boost::ulong_long_type);
+ template <> struct long_numbers<boost::long_long_type> :
+ boost::hash_detail::enable_hash_value {};
+ template <> struct ulong_numbers<boost::ulong_long_type> :
+ boost::hash_detail::enable_hash_value {};
#endif
+ template <> struct float_numbers<float> :
+ boost::hash_detail::enable_hash_value {};
+ template <> struct float_numbers<double> :
+ boost::hash_detail::enable_hash_value {};
+ template <> struct float_numbers<long double> :
+ boost::hash_detail::enable_hash_value {};
+ }
+
+ template <typename T>
+ typename boost::hash_detail::basic_numbers<T>::type hash_value(T);
+ template <typename T>
+ typename boost::hash_detail::long_numbers<T>::type hash_value(T);
+ template <typename T>
+ typename boost::hash_detail::ulong_numbers<T>::type hash_value(T);
+
+ template <typename T>
+ typename boost::enable_if<boost::is_enum<T>, std::size_t>::type
+ hash_value(T);
+
#if !BOOST_WORKAROUND(__DMC__, <= 0x848)
template <class T> std::size_t hash_value(T* const&);
#else
@@ -83,15 +110,14 @@ namespace boost
std::size_t hash_value(T (&x)[N]);
#endif
- std::size_t hash_value(float v);
- std::size_t hash_value(double v);
- std::size_t hash_value(long double v);
-
template <class Ch, class A>
std::size_t hash_value(
std::basic_string<Ch, std::BOOST_HASH_CHAR_TRAITS<Ch>, A> const&);
-#if !defined(BOOST_NO_0X_HDR_TYPEINDEX)
+ template <typename T>
+ typename boost::hash_detail::float_numbers<T>::type hash_value(T);
+
+#if !defined(BOOST_NO_CXX11_HDR_TYPEINDEX)
std::size_t hash_value(std::type_index);
#endif
@@ -141,74 +167,30 @@ namespace boost
}
}
- inline std::size_t hash_value(bool v)
- {
- return static_cast<std::size_t>(v);
- }
-
- inline std::size_t hash_value(char v)
- {
- return static_cast<std::size_t>(v);
- }
-
- inline std::size_t hash_value(unsigned char v)
- {
- return static_cast<std::size_t>(v);
- }
-
- inline std::size_t hash_value(signed char v)
- {
- return static_cast<std::size_t>(v);
- }
-
- inline std::size_t hash_value(short v)
- {
- return static_cast<std::size_t>(v);
- }
-
- inline std::size_t hash_value(unsigned short v)
- {
- return static_cast<std::size_t>(v);
- }
-
- inline std::size_t hash_value(int v)
- {
- return static_cast<std::size_t>(v);
- }
-
- inline std::size_t hash_value(unsigned int v)
- {
- return static_cast<std::size_t>(v);
- }
-
- inline std::size_t hash_value(long v)
- {
- return static_cast<std::size_t>(v);
- }
-
- inline std::size_t hash_value(unsigned long v)
+ template <typename T>
+ typename boost::hash_detail::basic_numbers<T>::type hash_value(T v)
{
return static_cast<std::size_t>(v);
}
-#if !defined(BOOST_NO_INTRINSIC_WCHAR_T)
- inline std::size_t hash_value(wchar_t v)
+ template <typename T>
+ typename boost::hash_detail::long_numbers<T>::type hash_value(T v)
{
- return static_cast<std::size_t>(v);
+ return hash_detail::hash_value_signed(v);
}
-#endif
-#if !defined(BOOST_NO_LONG_LONG)
- inline std::size_t hash_value(boost::long_long_type v)
+ template <typename T>
+ typename boost::hash_detail::ulong_numbers<T>::type hash_value(T v)
{
- return hash_detail::hash_value_signed(v);
+ return hash_detail::hash_value_unsigned(v);
}
- inline std::size_t hash_value(boost::ulong_long_type v)
+ template <typename T>
+ typename boost::enable_if<boost::is_enum<T>, std::size_t>::type
+ hash_value(T v)
{
- return hash_detail::hash_value_unsigned(v);
+ return static_cast<std::size_t>(v);
}
-#endif
// Implementation by Alberto Barbati and Dave Harris.
#if !BOOST_WORKAROUND(__DMC__, <= 0x848)
@@ -324,22 +306,13 @@ namespace boost
return hash_range(v.begin(), v.end());
}
- inline std::size_t hash_value(float v)
- {
- return boost::hash_detail::float_hash_value(v);
- }
-
- inline std::size_t hash_value(double v)
- {
- return boost::hash_detail::float_hash_value(v);
- }
-
- inline std::size_t hash_value(long double v)
+ template <typename T>
+ typename boost::hash_detail::float_numbers<T>::type hash_value(T v)
{
return boost::hash_detail::float_hash_value(v);
}
-#if !defined(BOOST_NO_0X_HDR_TYPEINDEX)
+#if !defined(BOOST_NO_CXX11_HDR_TYPEINDEX)
inline std::size_t hash_value(std::type_index v)
{
return v.hash_code();
@@ -450,7 +423,7 @@ namespace boost
BOOST_HASH_SPECIALIZE(boost::ulong_long_type)
#endif
-#if !defined(BOOST_NO_0X_HDR_TYPEINDEX)
+#if !defined(BOOST_NO_CXX11_HDR_TYPEINDEX)
BOOST_HASH_SPECIALIZE(std::type_index)
#endif