diff --git a/hash/test/hash_float_test.hpp b/hash/test/hash_float_test.hpp index eef49b2..eed2e31 100644 --- a/hash/test/hash_float_test.hpp +++ b/hash/test/hash_float_test.hpp @@ -14,7 +14,7 @@ #include #include -#include +#include #include diff --git a/hash/test/hash_function_pointer_test.cpp b/hash/test/hash_function_pointer_test.cpp index 7fa4c89..73719e2 100644 --- a/hash/test/hash_function_pointer_test.cpp +++ b/hash/test/hash_function_pointer_test.cpp @@ -13,7 +13,6 @@ #include -#include #include #include diff --git a/hash/test/hash_number_test.cpp b/hash/test/hash_number_test.cpp index 1000258..88e03bd 100644 --- a/hash/test/hash_number_test.cpp +++ b/hash/test/hash_number_test.cpp @@ -15,7 +15,7 @@ #include #include -#include +#include #include #include diff --git a/hash/test/hash_string_test.cpp b/hash/test/hash_string_test.cpp index 85f5a0d..b3b8394 100644 --- a/hash/test/hash_string_test.cpp +++ b/hash/test/hash_string_test.cpp @@ -13,7 +13,6 @@ #include -#include #include #include #include diff --git a/include/boost/functional/hash/detail/hash_float.hpp b/include/boost/functional/hash/detail/hash_float.hpp index 5d5ac34..9844c6a 100644 --- a/include/boost/functional/hash/detail/hash_float.hpp +++ b/include/boost/functional/hash/detail/hash_float.hpp @@ -19,9 +19,9 @@ #endif #include +#include #include #include -#include #include // Select implementation for the current platform. @@ -50,43 +50,10 @@ #endif -// On OpenBSD, numeric_limits is not reliable for long doubles, but -// the macros defined in are. - -#if defined(__OpenBSD__) -#include -#endif - namespace boost { namespace hash_detail { - template - struct limits : std::numeric_limits {}; - -#if defined(__OpenBSD__) - template <> - struct limits - : std::numeric_limits - { - 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); diff --git a/include/boost/functional/hash/detail/limits.hpp b/include/boost/functional/hash/detail/limits.hpp new file mode 100644 index 0000000..b691d5b --- /dev/null +++ b/include/boost/functional/hash/detail/limits.hpp @@ -0,0 +1,57 @@ + +// 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) +// +// On some platforms std::limits gives incorrect values for long double. +// This tries to work around them. + +#if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_LIMITS_HEADER) +#define BOOST_FUNCTIONAL_HASH_DETAIL_LIMITS_HEADER + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include + +// On OpenBSD, numeric_limits is not reliable for long doubles, but +// the macros defined in are. + +#if defined(__OpenBSD__) +#include +#endif + +namespace boost +{ + namespace hash_detail + { + template + struct limits : std::numeric_limits {}; + +#if defined(__OpenBSD__) + template <> + struct limits + : std::numeric_limits + { + 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__ + } +} + +#endif \ No newline at end of file diff --git a/include/boost/functional/hash/hash.hpp b/include/boost/functional/hash/hash.hpp index 67284fc..12283ff 100644 --- a/include/boost/functional/hash/hash.hpp +++ b/include/boost/functional/hash/hash.hpp @@ -15,6 +15,7 @@ #include #include #include +#include #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) #include