summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-06-01 08:48:42 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-06-01 09:24:28 (GMT)
commit2812bddd81f8a1b804c7460f4e14cd0aa393d129 (patch)
treed46294f35150c4f0f43deaf2d31fceaf945ae715 /3rdParty/Boost/boost/functional/hash
downloadswift-contrib-2812bddd81f8a1b804c7460f4e14cd0aa393d129.zip
swift-contrib-2812bddd81f8a1b804c7460f4e14cd0aa393d129.tar.bz2
Import.
Diffstat (limited to '3rdParty/Boost/boost/functional/hash')
-rw-r--r--3rdParty/Boost/boost/functional/hash/detail/float_functions.hpp162
-rw-r--r--3rdParty/Boost/boost/functional/hash/detail/hash_float.hpp197
-rw-r--r--3rdParty/Boost/boost/functional/hash/extensions.hpp182
-rw-r--r--3rdParty/Boost/boost/functional/hash/hash.hpp529
-rw-r--r--3rdParty/Boost/boost/functional/hash/hash_fwd.hpp40
5 files changed, 1110 insertions, 0 deletions
diff --git a/3rdParty/Boost/boost/functional/hash/detail/float_functions.hpp b/3rdParty/Boost/boost/functional/hash/detail/float_functions.hpp
new file mode 100644
index 0000000..69cf91a
--- /dev/null
+++ b/3rdParty/Boost/boost/functional/hash/detail/float_functions.hpp
@@ -0,0 +1,162 @@
+
+// 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)
+
+#if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_FLOAT_FUNCTIONS_HPP)
+#define BOOST_FUNCTIONAL_HASH_DETAIL_FLOAT_FUNCTIONS_HPP
+
+#include <boost/config/no_tr1/cmath.hpp>
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+// The C++ standard requires that the C float functions are overloarded
+// for float, double and long double in the std namespace, but some of the older
+// library implementations don't support this. On some that don't, the C99
+// float functions (frexpf, frexpl, etc.) are available.
+//
+// Some of this is based on guess work. If I don't know any better I assume that
+// the standard C++ overloaded functions are available. If they're not then this
+// means that the argument is cast to a double and back, which is inefficient
+// and will give pretty bad results for long doubles - so if you know better
+// let me know.
+
+// STLport:
+#if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
+# 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
+# else
+# define BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS
+# endif
+
+// Roguewave:
+//
+// On borland 5.51, with roguewave 2.1.1 the standard C++ overloads aren't
+// defined, but for the same version of roguewave on sunpro they are.
+#elif defined(_RWSTD_VER)
+# if defined(__BORLANDC__)
+# define BOOST_HASH_USE_C99_FLOAT_FUNCS
+# define BOOST_HASH_C99_NO_FLOAT_FUNCS
+# elif defined(__DECCXX)
+# define BOOST_HASH_USE_C99_FLOAT_FUNCS
+# else
+# define BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS
+# endif
+
+// libstdc++ (gcc 3.0 onwards, I think)
+#elif defined(__GLIBCPP__) || defined(__GLIBCXX__)
+# define BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS
+
+// SGI:
+#elif defined(__STL_CONFIG_H)
+# if defined(linux) || defined(__linux) || defined(__linux__)
+# define BOOST_HASH_USE_C99_FLOAT_FUNCS
+# else
+# define BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS
+# endif
+
+// vxWorks. It has its own math library, but uses Dinkumware STL
+#elif defined(__VXWORKS__)
+# define BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS
+
+// Dinkumware.
+#elif (defined(_YVALS) && !defined(__IBMCPP__)) || defined(_CPPLIB_VER)
+// Some versions of Visual C++ don't seem to have the C++ overloads but they
+// all seem to have the c99 float overloads
+# if defined(BOOST_MSVC)
+# define BOOST_HASH_USE_C99_FLOAT_FUNCS
+// On other platforms the C++ overloads seem to have been introduced sometime
+// before 402.
+# elif defined(_CPPLIB_VER) && (_CPPLIB_VER >= 402)
+# define BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS
+# else
+# define BOOST_HASH_USE_C99_FLOAT_FUNCS
+# endif
+
+// Digital Mars
+#elif defined(__DMC__)
+# define BOOST_HASH_USE_C99_FLOAT_FUNCS
+
+// Use overloaded float functions by default.
+#else
+# define BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS
+#endif
+
+namespace boost
+{
+ namespace hash_detail
+ {
+
+ inline float call_ldexp(float v, int exp)
+ {
+ using namespace std;
+#if defined(BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS) || \
+ defined(BOOST_HASH_C99_NO_FLOAT_FUNCS)
+ return ldexp(v, exp);
+#else
+ return ldexpf(v, exp);
+#endif
+ }
+
+ inline double call_ldexp(double v, int exp)
+ {
+ using namespace std;
+ return ldexp(v, exp);
+ }
+
+ inline long double call_ldexp(long double v, int exp)
+ {
+ using namespace std;
+#if defined(BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS)
+ return ldexp(v, exp);
+#else
+ return ldexpl(v, exp);
+#endif
+ }
+
+ inline float call_frexp(float v, int* exp)
+ {
+ using namespace std;
+#if defined(BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS) || \
+ defined(BOOST_HASH_C99_NO_FLOAT_FUNCS)
+ return frexp(v, exp);
+#else
+ return frexpf(v, exp);
+#endif
+ }
+
+ inline double call_frexp(double v, int* exp)
+ {
+ using namespace std;
+ return frexp(v, exp);
+ }
+
+ inline long double call_frexp(long double v, int* exp)
+ {
+ using namespace std;
+#if defined(BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS)
+ return frexp(v, exp);
+#else
+ return frexpl(v, exp);
+#endif
+ }
+ }
+}
+
+#if defined(BOOST_HASH_USE_C99_FLOAT_FUNCS)
+#undef BOOST_HASH_USE_C99_FLOAT_FUNCS
+#endif
+
+#if defined(BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS)
+#undef BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS
+#endif
+
+#if defined(BOOST_HASH_C99_NO_FLOAT_FUNCS)
+#undef BOOST_HASH_C99_NO_FLOAT_FUNCS
+#endif
+
+#endif
diff --git a/3rdParty/Boost/boost/functional/hash/detail/hash_float.hpp b/3rdParty/Boost/boost/functional/hash/detail/hash_float.hpp
new file mode 100644
index 0000000..5d5ac34
--- /dev/null
+++ b/3rdParty/Boost/boost/functional/hash/detail/hash_float.hpp
@@ -0,0 +1,197 @@
+
+// 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)
+
+#if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_HEADER)
+#define BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_HEADER
+
+#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
+
+#include <boost/functional/hash/detail/float_functions.hpp>
+#include <boost/integer/static_log2.hpp>
+#include <boost/cstdint.hpp>
+#include <boost/limits.hpp>
+#include <boost/assert.hpp>
+
+// Select implementation for the current platform.
+
+// Cygwn
+#if defined(__CYGWIN__)
+# if defined(__i386__) || defined(_M_IX86)
+# define BOOST_HASH_USE_x86_BINARY_HASH
+# endif
+
+// STLport
+#elif defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
+// fpclassify aren't good enough on STLport.
+
+// GNU libstdc++ 3
+#elif defined(__GLIBCPP__) || defined(__GLIBCXX__)
+# if (defined(__USE_ISOC99) || defined(_GLIBCXX_USE_C99_MATH)) && \
+ !(defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__))
+# define BOOST_HASH_USE_FPCLASSIFY
+# endif
+
+// Dinkumware Library, on Visual C++
+#elif (defined(_YVALS) && !defined(__IBMCPP__)) || defined(_CPPLIB_VER)
+
+// Not using _fpclass because it is only available for double.
+
+#endif
+
+// On OpenBSD, numeric_limits is not reliable for long doubles, but
+// the macros defined in <float.h> are.
+
+#if defined(__OpenBSD__)
+#include <float.h>
+#endif
+
+namespace boost
+{
+ namespace hash_detail
+ {
+ template <class T>
+ struct limits : std::numeric_limits<T> {};
+
+#if defined(__OpenBSD__)
+ template <>
+ struct limits<long double>
+ : std::numeric_limits<long double>
+ {
+ static long double epsilon() {
+ return LDBL_EPSILON;
+ }
+
+ static long double (max)() {
+ return LDBL_MAX;
+ }
+
+ static long double (min)() {
+ return LDBL_MIN;
+ }
+
+ BOOST_STATIC_CONSTANT(int, digits = LDBL_MANT_DIG);
+ BOOST_STATIC_CONSTANT(int, max_exponent = LDBL_MAX_EXP);
+ BOOST_STATIC_CONSTANT(int, min_exponent = LDBL_MIN_EXP);
+ };
+#endif // __OpenBSD__
+
+ inline void hash_float_combine(std::size_t& seed, std::size_t value)
+ {
+ seed ^= value + (seed<<6) + (seed>>2);
+ }
+
+// A simple, non-portable hash algorithm for x86.
+#if defined(BOOST_HASH_USE_x86_BINARY_HASH)
+ 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;
+ }
+
+#else
+
+ template <class T>
+ inline std::size_t float_hash_impl(T v)
+ {
+ int exp = 0;
+
+ v = boost::hash_detail::call_frexp(v, &exp);
+
+ // A postive value is easier to hash, so combine the
+ // sign with the exponent.
+ if(v < 0) {
+ v = -v;
+ exp += limits<T>::max_exponent -
+ limits<T>::min_exponent;
+ }
+
+ // The result of frexp is always between 0.5 and 1, so its
+ // top bit will always be 1. Subtract by 0.5 to remove that.
+ v -= T(0.5);
+ v = boost::hash_detail::call_ldexp(v,
+ limits<std::size_t>::digits + 1);
+ std::size_t seed = static_cast<std::size_t>(v);
+ v -= 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 - 1)
+ / limits<std::size_t>::digits;
+
+ for(std::size_t i = 0; i != length; ++i)
+ {
+ v = boost::hash_detail::call_ldexp(v,
+ limits<std::size_t>::digits);
+ std::size_t part = static_cast<std::size_t>(v);
+ v -= part;
+ hash_float_combine(seed, part);
+ }
+
+ hash_float_combine(seed, exp);
+
+ return seed;
+ }
+#endif
+
+ template <class T>
+ inline std::size_t float_hash_value(T v)
+ {
+#if defined(BOOST_HASH_USE_FPCLASSIFY)
+ using namespace std;
+ switch (fpclassify(v)) {
+ case FP_ZERO:
+ return 0;
+ case FP_INFINITE:
+ return (std::size_t)(v > 0 ? -1 : -2);
+ case FP_NAN:
+ return (std::size_t)(-3);
+ case FP_NORMAL:
+ case FP_SUBNORMAL:
+ return float_hash_impl(v);
+ default:
+ BOOST_ASSERT(0);
+ return 0;
+ }
+#else
+ return v == 0 ? 0 : float_hash_impl(v);
+#endif
+ }
+ }
+}
+
+#if defined(BOOST_MSVC)
+#pragma warning(pop)
+#endif
+
+#endif
diff --git a/3rdParty/Boost/boost/functional/hash/extensions.hpp b/3rdParty/Boost/boost/functional/hash/extensions.hpp
new file mode 100644
index 0000000..d173314
--- /dev/null
+++ b/3rdParty/Boost/boost/functional/hash/extensions.hpp
@@ -0,0 +1,182 @@
+
+// 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)
+
+// 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_EXTENSIONS_HPP)
+#define BOOST_FUNCTIONAL_HASH_EXTENSIONS_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+namespace boost
+{
+
+#if defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
+ namespace hash_detail
+ {
+ template <bool IsArray>
+ struct call_hash_impl
+ {
+ template <class T>
+ struct inner
+ {
+ static std::size_t call(T const& v)
+ {
+ using namespace boost;
+ return hash_value(v);
+ }
+ };
+ };
+
+ template <>
+ struct call_hash_impl<true>
+ {
+ template <class Array>
+ struct inner
+ {
+#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
+ static std::size_t call(Array const& v)
+#else
+ static std::size_t call(Array& v)
+#endif
+ {
+ const int size = sizeof(v) / sizeof(*v);
+ return boost::hash_range(v, v + size);
+ }
+ };
+ };
+
+ template <class T>
+ struct call_hash
+ : public call_hash_impl<boost::is_array<T>::value>
+ ::BOOST_NESTED_TEMPLATE inner<T>
+ {
+ };
+ }
+#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
+
+#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
+
+ template <class T> struct hash
+ : std::unary_function<T, std::size_t>
+ {
+#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
+ std::size_t operator()(T const& val) const
+ {
+ return hash_value(val);
+ }
+#else
+ std::size_t operator()(T const& val) const
+ {
+ return hash_detail::call_hash<T>::call(val);
+ }
+#endif
+ };
+
+#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
+ // need to supply the non-pointer version.
+
+ namespace hash_detail
+ {
+ template <bool IsPointer>
+ struct hash_impl;
+
+#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
+
+ template <>
+ struct hash_impl<false>
+ {
+ template <class T>
+ struct inner
+ : std::unary_function<T, std::size_t>
+ {
+#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
+ std::size_t operator()(T const& val) const
+ {
+ return hash_value(val);
+ }
+#else
+ std::size_t operator()(T const& val) const
+ {
+ return hash_detail::call_hash<T>::call(val);
+ }
+#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.
+
+ template <bool IsConst>
+ struct hash_impl_msvc
+ {
+ template <class T>
+ struct inner
+ : public std::unary_function<T, std::size_t>
+ {
+ std::size_t operator()(T const& val) const
+ {
+ return hash_detail::call_hash<T const>::call(val);
+ }
+
+ std::size_t operator()(T& val) const
+ {
+ return hash_detail::call_hash<T>::call(val);
+ }
+ };
+ };
+
+ template <>
+ struct hash_impl_msvc<true>
+ {
+ template <class T>
+ struct inner
+ : public std::unary_function<T, std::size_t>
+ {
+ std::size_t operator()(T& val) const
+ {
+ return hash_detail::call_hash<T>::call(val);
+ }
+ };
+ };
+
+ template <class T>
+ struct hash_impl_msvc2
+ : public hash_impl_msvc<boost::is_const<T>::value>
+ ::BOOST_NESTED_TEMPLATE inner<T> {};
+
+ template <>
+ struct hash_impl<false>
+ {
+ template <class T>
+ struct inner : public hash_impl_msvc2<T> {};
+ };
+
+#endif // Visual C++ 6.5
+ }
+#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+}
+
+#endif
diff --git a/3rdParty/Boost/boost/functional/hash/hash.hpp b/3rdParty/Boost/boost/functional/hash/hash.hpp
new file mode 100644
index 0000000..67284fc
--- /dev/null
+++ b/3rdParty/Boost/boost/functional/hash/hash.hpp
@@ -0,0 +1,529 @@
+
+// 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)
+
+// 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_HASH_HPP)
+#define BOOST_FUNCTIONAL_HASH_HASH_HPP
+
+#include <boost/functional/hash/hash_fwd.hpp>
+#include <functional>
+#include <boost/functional/hash/detail/hash_float.hpp>
+#include <boost/detail/container_fwd.hpp>
+#include <string>
+
+#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
+#include <boost/type_traits/is_pointer.hpp>
+#endif
+
+#if defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
+#include <boost/type_traits/is_array.hpp>
+#endif
+
+#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
+#include <boost/type_traits/is_const.hpp>
+#endif
+
+namespace boost
+{
+ 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);
+
+#if !defined(BOOST_NO_INTRINSIC_WCHAR_T)
+ std::size_t hash_value(wchar_t);
+#endif
+
+#if defined(BOOST_HAS_LONG_LONG)
+ std::size_t hash_value(boost::long_long_type);
+ std::size_t hash_value(boost::ulong_long_type);
+#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 >
+ std::size_t hash_value(const T (&x)[N]);
+
+ template< class T, unsigned N >
+ 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&);
+
+ template <class A, class B>
+ std::size_t hash_value(std::pair<A, B> const&);
+ template <class T, class A>
+ std::size_t hash_value(std::vector<T, A> const&);
+ template <class T, class A>
+ std::size_t hash_value(std::list<T, A> const& v);
+ template <class T, class A>
+ std::size_t hash_value(std::deque<T, A> const& v);
+ template <class K, class C, class A>
+ std::size_t hash_value(std::set<K, C, A> const& v);
+ template <class K, class C, class A>
+ std::size_t hash_value(std::multiset<K, C, A> const& v);
+ template <class K, class T, class C, class A>
+ std::size_t hash_value(std::map<K, T, C, A> const& v);
+ template <class K, class T, class C, class A>
+ std::size_t hash_value(std::multimap<K, T, C, A> const& v);
+
+ template <class T>
+ std::size_t hash_value(std::complex<T> const&);
+
+ // Implementation
+
+ namespace hash_detail
+ {
+ template <class T>
+ inline std::size_t hash_value_signed(T val)
+ {
+ const int size_t_bits = std::numeric_limits<std::size_t>::digits;
+ // ceiling(std::numeric_limits<T>::digits / size_t_bits) - 1
+ const int length = (std::numeric_limits<T>::digits - 1)
+ / size_t_bits;
+
+ std::size_t seed = 0;
+ T positive = val < 0 ? -1 - val : val;
+
+ // Hopefully, this loop can be unrolled.
+ for(unsigned int i = length * size_t_bits; i > 0; i -= size_t_bits)
+ {
+ seed ^= (std::size_t) (positive >> i) + (seed<<6) + (seed>>2);
+ }
+ seed ^= (std::size_t) val + (seed<<6) + (seed>>2);
+
+ return seed;
+ }
+
+ template <class T>
+ inline std::size_t hash_value_unsigned(T val)
+ {
+ const int size_t_bits = std::numeric_limits<std::size_t>::digits;
+ // ceiling(std::numeric_limits<T>::digits / size_t_bits) - 1
+ const int length = (std::numeric_limits<T>::digits - 1)
+ / size_t_bits;
+
+ std::size_t seed = 0;
+
+ // Hopefully, this loop can be unrolled.
+ for(unsigned int i = length * size_t_bits; i > 0; i -= size_t_bits)
+ {
+ seed ^= (std::size_t) (val >> i) + (seed<<6) + (seed>>2);
+ }
+ seed ^= (std::size_t) val + (seed<<6) + (seed>>2);
+
+ return seed;
+ }
+ }
+
+ 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)
+ {
+ return static_cast<std::size_t>(v);
+ }
+
+#if !defined(BOOST_NO_INTRINSIC_WCHAR_T)
+ inline std::size_t hash_value(wchar_t v)
+ {
+ return static_cast<std::size_t>(v);
+ }
+#endif
+
+#if defined(BOOST_HAS_LONG_LONG)
+ inline std::size_t hash_value(boost::long_long_type v)
+ {
+ return hash_detail::hash_value_signed(v);
+ }
+
+ inline std::size_t hash_value(boost::ulong_long_type v)
+ {
+ return hash_detail::hash_value_unsigned(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));
+
+ return x + (x >> 3);
+ }
+
+#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
+ template <class T>
+ inline void hash_combine(std::size_t& seed, T& v)
+#else
+ template <class T>
+ inline void hash_combine(std::size_t& seed, T const& v)
+#endif
+ {
+ boost::hash<T> hasher;
+ seed ^= hasher(v) + 0x9e3779b9 + (seed<<6) + (seed>>2);
+ }
+
+ template <class It>
+ inline std::size_t hash_range(It first, It last)
+ {
+ std::size_t seed = 0;
+
+ for(; first != last; ++first)
+ {
+ hash_combine(seed, *first);
+ }
+
+ return seed;
+ }
+
+ template <class It>
+ inline void hash_range(std::size_t& seed, It first, It last)
+ {
+ for(; first != last; ++first)
+ {
+ hash_combine(seed, *first);
+ }
+ }
+
+#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
+ template <class T>
+ inline std::size_t hash_range(T* first, T* last)
+ {
+ std::size_t seed = 0;
+
+ for(; first != last; ++first)
+ {
+ boost::hash<T> hasher;
+ seed ^= hasher(*first) + 0x9e3779b9 + (seed<<6) + (seed>>2);
+ }
+
+ return seed;
+ }
+
+ template <class T>
+ inline void hash_range(std::size_t& seed, T* first, T* last)
+ {
+ for(; first != last; ++first)
+ {
+ boost::hash<T> hasher;
+ seed ^= hasher(*first) + 0x9e3779b9 + (seed<<6) + (seed>>2);
+ }
+ }
+#endif
+
+#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
+ template< class T, unsigned N >
+ inline std::size_t hash_value(const T (&x)[N])
+ {
+ return hash_range(x, x + N);
+ }
+
+ template< class T, unsigned N >
+ inline std::size_t hash_value(T (&x)[N])
+ {
+ return hash_range(x, x + N);
+ }
+#endif
+
+ template <class Ch, class A>
+ inline std::size_t hash_value(std::basic_string<Ch, std::BOOST_HASH_CHAR_TRAITS<Ch>, A> const& v)
+ {
+ 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)
+ {
+ return boost::hash_detail::float_hash_value(v);
+ }
+
+ template <class A, class B>
+ 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);
+ 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());
+ }
+
+ template <class T, class A>
+ std::size_t hash_value(std::list<T, A> const& v)
+ {
+ return 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());
+ }
+
+ 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());
+ }
+
+ 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());
+ }
+
+ 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());
+ }
+
+ 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());
+ }
+
+ template <class T>
+ std::size_t hash_value(std::complex<T> const& v)
+ {
+ boost::hash<T> hasher;
+ std::size_t seed = hasher(v.imag());
+ seed ^= hasher(v.real()) + (seed<<6) + (seed>>2);
+ return seed;
+ }
+
+ //
+ // boost::hash
+ //
+
+#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
+#define BOOST_HASH_SPECIALIZE(type) \
+ template <> struct hash<type> \
+ : public std::unary_function<type, std::size_t> \
+ { \
+ std::size_t operator()(type v) const \
+ { \
+ return boost::hash_value(v); \
+ } \
+ };
+
+#define BOOST_HASH_SPECIALIZE_REF(type) \
+ template <> struct hash<type> \
+ : public std::unary_function<type, std::size_t> \
+ { \
+ std::size_t operator()(type const& v) const \
+ { \
+ return boost::hash_value(v); \
+ } \
+ };
+#else
+#define BOOST_HASH_SPECIALIZE(type) \
+ template <> struct hash<type> \
+ : public std::unary_function<type, std::size_t> \
+ { \
+ std::size_t operator()(type v) const \
+ { \
+ return boost::hash_value(v); \
+ } \
+ }; \
+ \
+ template <> struct hash<const type> \
+ : public std::unary_function<const type, std::size_t> \
+ { \
+ std::size_t operator()(const type v) const \
+ { \
+ return boost::hash_value(v); \
+ } \
+ };
+
+#define BOOST_HASH_SPECIALIZE_REF(type) \
+ template <> struct hash<type> \
+ : public std::unary_function<type, std::size_t> \
+ { \
+ std::size_t operator()(type const& v) const \
+ { \
+ return boost::hash_value(v); \
+ } \
+ }; \
+ \
+ template <> struct hash<const type> \
+ : public std::unary_function<const type, std::size_t> \
+ { \
+ std::size_t operator()(type const& v) const \
+ { \
+ return boost::hash_value(v); \
+ } \
+ };
+#endif
+
+ BOOST_HASH_SPECIALIZE(bool)
+ BOOST_HASH_SPECIALIZE(char)
+ BOOST_HASH_SPECIALIZE(signed char)
+ BOOST_HASH_SPECIALIZE(unsigned char)
+#if !defined(BOOST_NO_INTRINSIC_WCHAR_T)
+ BOOST_HASH_SPECIALIZE(wchar_t)
+#endif
+ BOOST_HASH_SPECIALIZE(short)
+ BOOST_HASH_SPECIALIZE(unsigned short)
+ BOOST_HASH_SPECIALIZE(int)
+ BOOST_HASH_SPECIALIZE(unsigned int)
+ BOOST_HASH_SPECIALIZE(long)
+ BOOST_HASH_SPECIALIZE(unsigned long)
+
+ BOOST_HASH_SPECIALIZE(float)
+ BOOST_HASH_SPECIALIZE(double)
+ BOOST_HASH_SPECIALIZE(long double)
+
+ BOOST_HASH_SPECIALIZE_REF(std::string)
+#if !defined(BOOST_NO_STD_WSTRING)
+ BOOST_HASH_SPECIALIZE_REF(std::wstring)
+#endif
+
+#undef BOOST_HASH_SPECIALIZE
+#undef BOOST_HASH_SPECIALIZE_REF
+
+#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
+ template <class T>
+ struct hash<T*>
+ : public std::unary_function<T*, std::size_t>
+ {
+ std::size_t operator()(T* v) const
+ {
+#if !BOOST_WORKAROUND(__SUNPRO_CC, <= 0x590)
+ return boost::hash_value(v);
+#else
+ std::size_t x = static_cast<std::size_t>(
+ reinterpret_cast<std::ptrdiff_t>(v));
+
+ return x + (x >> 3);
+#endif
+ }
+ };
+#else
+ namespace hash_detail
+ {
+ template <bool IsPointer>
+ struct hash_impl;
+
+ template <>
+ struct hash_impl<true>
+ {
+ template <class T>
+ struct inner
+ : public std::unary_function<T, std::size_t>
+ {
+ std::size_t operator()(T val) const
+ {
+#if !BOOST_WORKAROUND(__SUNPRO_CC, <= 590)
+ return boost::hash_value(val);
+#else
+ std::size_t x = static_cast<std::size_t>(
+ reinterpret_cast<std::ptrdiff_t>(val));
+
+ return x + (x >> 3);
+#endif
+ }
+ };
+ };
+ }
+
+ template <class T> struct hash
+ : public boost::hash_detail::hash_impl<boost::is_pointer<T>::value>
+ ::BOOST_NESTED_TEMPLATE inner<T>
+ {
+ };
+#endif
+}
+
+#endif // BOOST_FUNCTIONAL_HASH_HASH_HPP
+
+// Include this outside of the include guards in case the file is included
+// twice - once with BOOST_HASH_NO_EXTENSIONS defined, and then with it
+// undefined.
+
+#if !defined(BOOST_HASH_NO_EXTENSIONS) \
+ && !defined(BOOST_FUNCTIONAL_HASH_EXTENSIONS_HPP)
+#include <boost/functional/hash/extensions.hpp>
+#endif
diff --git a/3rdParty/Boost/boost/functional/hash/hash_fwd.hpp b/3rdParty/Boost/boost/functional/hash/hash_fwd.hpp
new file mode 100644
index 0000000..1d51b07
--- /dev/null
+++ b/3rdParty/Boost/boost/functional/hash/hash_fwd.hpp
@@ -0,0 +1,40 @@
+
+// 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)
+
+// 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_FWD_HPP)
+#define BOOST_FUNCTIONAL_HASH_FWD_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/config.hpp>
+#include <cstddef>
+#include <boost/detail/workaround.hpp>
+
+namespace boost
+{
+ template <class T> struct hash;
+
+#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
+ template <class T> void hash_combine(std::size_t& seed, T& v);
+#else
+ template <class T> void hash_combine(std::size_t& seed, T const& v);
+#endif
+
+ template <class It> std::size_t hash_range(It, It);
+ template <class It> void hash_range(std::size_t&, It, It);
+
+#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
+ template <class T> inline std::size_t hash_range(T*, T*);
+ template <class T> inline void hash_range(std::size_t&, T*, T*);
+#endif
+}
+
+#endif