From 89fd55fa969584491d44b7719fee0f88828b2d95 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Mon, 26 Nov 2012 21:45:20 +0000 Subject: [PATCH 01/32] Removed missed usage of deprecated macros in Boost.Functional [SVN r81578] --- include/boost/functional/hash/extensions.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/functional/hash/extensions.hpp b/include/boost/functional/hash/extensions.hpp index 4358736..1ca7263 100644 --- a/include/boost/functional/hash/extensions.hpp +++ b/include/boost/functional/hash/extensions.hpp @@ -149,7 +149,7 @@ namespace boost } } -#if !defined(BOOST_NO_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) template inline std::size_t hash_value(std::tuple const& v) { From 2380fd919e4a549fdb23d82e08c482b2cf93ace5 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sun, 2 Dec 2012 21:11:45 +0000 Subject: [PATCH 02/32] Hash: Don't use workarounds with recent compilers. #7221, #7470 [SVN r81677] --- hash/doc/changes.qbk | 3 + .../hash/detail/float_functions.hpp | 90 +++++++++++++++++++ .../functional/hash/detail/hash_float.hpp | 9 +- 3 files changed, 101 insertions(+), 1 deletion(-) diff --git a/hash/doc/changes.qbk b/hash/doc/changes.qbk index c98bd86..b98e2ea 100644 --- a/hash/doc/changes.qbk +++ b/hash/doc/changes.qbk @@ -144,5 +144,8 @@ * Restore `enum` support, which was accidentally removed in the last version. * New floating point hasher - will hash the binary representation on more platforms, which should be faster. +* On platforms that are known to have standard floating point, don't use the + automatic detection of floating point functions - which can break if there + are ambiguous overloads. [endsect] diff --git a/include/boost/functional/hash/detail/float_functions.hpp b/include/boost/functional/hash/detail/float_functions.hpp index ae03ff0..4b8374d 100644 --- a/include/boost/functional/hash/detail/float_functions.hpp +++ b/include/boost/functional/hash/detail/float_functions.hpp @@ -13,6 +13,94 @@ # pragma once #endif +// Set BOOST_HASH_CONFORMANT_FLOATS to 1 for libraries known to have +// sufficiently good floating point support to not require any +// workarounds. +// +// When set to 0, the library tries to automatically +// use the best available implementation. This normally works well, but +// breaks when ambiguities are created by odd namespacing of the functions. +// +// Note that if this is set to 0, the library should still take full +// advantage of the platform's floating point support. + +#if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) +# define BOOST_HASH_CONFORMANT_FLOATS 0 +#elif defined(__LIBCOMO__) +# define BOOST_HASH_CONFORMANT_FLOATS 0 +#elif defined(__STD_RWCOMPILER_H__) || defined(_RWSTD_VER) +// Rogue Wave library: +# define BOOST_HASH_CONFORMANT_FLOATS 0 +#elif defined(_LIBCPP_VERSION) +// libc++ +# define BOOST_HASH_CONFORMANT_FLOATS 1 +#elif defined(__GLIBCPP__) || defined(__GLIBCXX__) +// GNU libstdc++ 3 +# if defined(__GNUC__) && __GNUC__ >= 4 +# define BOOST_HASH_CONFORMANT_FLOATS 1 +# else +# define BOOST_HASH_CONFORMANT_FLOATS 0 +# endif +#elif defined(__STL_CONFIG_H) +// generic SGI STL +# define BOOST_HASH_CONFORMANT_FLOATS 0 +#elif defined(__MSL_CPP__) +// MSL standard lib: +# define BOOST_HASH_CONFORMANT_FLOATS 0 +#elif defined(__IBMCPP__) +// VACPP std lib (probably conformant for much earlier version). +# if __IBMCPP__ >= 1210 +# define BOOST_HASH_CONFORMANT_FLOATS 1 +# else +# define BOOST_HASH_CONFORMANT_FLOATS 0 +# endif +#elif defined(MSIPL_COMPILE_H) +// Modena C++ standard library +# define BOOST_HASH_CONFORMANT_FLOATS 0 +#elif (defined(_YVALS) && !defined(__IBMCPP__)) || defined(_CPPLIB_VER) +// Dinkumware Library (this has to appear after any possible replacement libraries): +# if _CPPLIB_VER >= 405 +# define BOOST_HASH_CONFORMANT_FLOATS 1 +# else +# define BOOST_HASH_CONFORMANT_FLOATS 0 +# endif +#else +# define BOOST_HASH_CONFORMANT_FLOATS 0 +#endif + +#if BOOST_HASH_CONFORMANT_FLOATS + +// The standard library is known to be compliant, so don't use the +// configuration mechanism. + +namespace boost { + namespace hash_detail { + template + struct call_ldexp { + typedef Float float_type; + inline Float operator()(Float x, int y) const { + return std::ldexp(x, y); + } + }; + + template + struct call_frexp { + typedef Float float_type; + inline Float operator()(Float x, int* y) const { + return std::frexp(x, y); + } + }; + + template + struct select_hash_type + { + typedef Float type; + }; + } +} + +#else // BOOST_HASH_CONFORMANT_FLOATS == 0 + // 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 @@ -243,4 +331,6 @@ namespace boost } } +#endif // BOOST_HASH_CONFORMANT_FLOATS + #endif diff --git a/include/boost/functional/hash/detail/hash_float.hpp b/include/boost/functional/hash/detail/hash_float.hpp index 3edc6ab..5e20b9c 100644 --- a/include/boost/functional/hash/detail/hash_float.hpp +++ b/include/boost/functional/hash/detail/hash_float.hpp @@ -210,8 +210,15 @@ namespace boost template inline std::size_t float_hash_value(T v) { +#if defined(fpclassify) + switch (fpclassify(v)) +#elif BOOST_HASH_CONFORMANT_FLOATS + switch (std::fpclassify(v)) +#else using namespace std; - switch (fpclassify(v)) { + switch (fpclassify(v)) +#endif + { case FP_ZERO: return 0; case FP_INFINITE: From 407df60e3e39170e26c35f56099a3d22cd2bbf72 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sun, 2 Dec 2012 21:12:24 +0000 Subject: [PATCH 03/32] Hash: Remove container_fwd_0x.hpp [SVN r81678] --- .../hash/detail/container_fwd_0x.hpp | 29 ------------------- include/boost/functional/hash/extensions.hpp | 14 ++++++++- 2 files changed, 13 insertions(+), 30 deletions(-) delete mode 100644 include/boost/functional/hash/detail/container_fwd_0x.hpp diff --git a/include/boost/functional/hash/detail/container_fwd_0x.hpp b/include/boost/functional/hash/detail/container_fwd_0x.hpp deleted file mode 100644 index bed7730..0000000 --- a/include/boost/functional/hash/detail/container_fwd_0x.hpp +++ /dev/null @@ -1,29 +0,0 @@ - -// 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 - -// std::array - -#if !defined(BOOST_NO_CXX11_HDR_ARRAY) -# include -#endif - -// std::tuple - -#if !defined(BOOST_NO_CXX11_HDR_TUPLE) -# include -#endif - -// std::shared_ptr/std::unique_ptr - -#if !defined(BOOST_NO_CXX11_HDR_MEMORY) -# include -#endif - -#endif diff --git a/include/boost/functional/hash/extensions.hpp b/include/boost/functional/hash/extensions.hpp index 1ca7263..998c08e 100644 --- a/include/boost/functional/hash/extensions.hpp +++ b/include/boost/functional/hash/extensions.hpp @@ -14,12 +14,24 @@ #define BOOST_FUNCTIONAL_HASH_EXTENSIONS_HPP #include -#include +#include #include #include #include #include +#if !defined(BOOST_NO_CXX11_HDR_ARRAY) +# include +#endif + +#if !defined(BOOST_NO_CXX11_HDR_TUPLE) +# include +#endif + +#if !defined(BOOST_NO_CXX11_HDR_MEMORY) +# include +#endif + #if defined(_MSC_VER) && (_MSC_VER >= 1020) # pragma once #endif From 8600928f9f8cc723f0b5b3612e71d3005e707d9f Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sun, 2 Dec 2012 21:12:38 +0000 Subject: [PATCH 04/32] Hash: Avoid some intel warnings in tests. It doesn't have the GCC warning pragma, and doesn't like compiling the integer tests with floats (used to compile them, but never use them). [SVN r81679] --- hash/test/hash_complex_test.cpp | 2 +- hash/test/hash_float_test.hpp | 2 +- hash/test/hash_number_test.cpp | 39 +++++++++++++++++++++++---------- 3 files changed, 29 insertions(+), 14 deletions(-) diff --git a/hash/test/hash_complex_test.cpp b/hash/test/hash_complex_test.cpp index bb1592c..36d2673 100644 --- a/hash/test/hash_complex_test.cpp +++ b/hash/test/hash_complex_test.cpp @@ -35,7 +35,7 @@ int main() {} #endif #endif -#if defined(__GNUC__) +#if defined(__GNUC__) && !defined(BOOST_INTEL_CXX_VERSION) #pragma GCC diagnostic ignored "-Wfloat-equal" #endif diff --git a/hash/test/hash_float_test.hpp b/hash/test/hash_float_test.hpp index c608915..a61d9de 100644 --- a/hash/test/hash_float_test.hpp +++ b/hash/test/hash_float_test.hpp @@ -30,7 +30,7 @@ #endif #endif -#if defined(__GNUC__) +#if defined(__GNUC__) && !defined(BOOST_INTEL_CXX_VERSION) #pragma GCC diagnostic ignored "-Wfloat-equal" #endif diff --git a/hash/test/hash_number_test.cpp b/hash/test/hash_number_test.cpp index 2645dfa..b7083c9 100644 --- a/hash/test/hash_number_test.cpp +++ b/hash/test/hash_number_test.cpp @@ -16,6 +16,7 @@ #include #include +#include #include "./compile_time.hpp" @@ -26,10 +27,34 @@ #pragma warning(disable:4310) // cast truncates constant value #endif -#if defined(__GNUC__) +#if defined(__GNUC__) && !defined(BOOST_INTEL_CXX_VERSION) #pragma GCC diagnostic ignored "-Wfloat-equal" #endif +template +void numeric_extra_tests(typename + boost::enable_if_c::is_integer, + void*>::type = 0) +{ + typedef boost::hash_detail::limits limits; + + if(limits::is_signed || + limits::digits <= boost::hash_detail::limits::digits) + { + BOOST_TEST(HASH_NAMESPACE::hash_value(T(-5)) == (std::size_t)T(-5)); + } + BOOST_TEST(HASH_NAMESPACE::hash_value(T(0)) == (std::size_t)T(0u)); + BOOST_TEST(HASH_NAMESPACE::hash_value(T(10)) == (std::size_t)T(10u)); + BOOST_TEST(HASH_NAMESPACE::hash_value(T(25)) == (std::size_t)T(25u)); +} + +template +void numeric_extra_tests(typename + boost::disable_if_c::is_integer, + void*>::type = 0) +{ +} + template void numeric_test(T*) { @@ -55,17 +80,7 @@ void numeric_test(T*) BOOST_TEST(x1(T(10)) == HASH_NAMESPACE::hash_value(T(10))); BOOST_TEST(x1(T(25)) == HASH_NAMESPACE::hash_value(T(25))); - if (limits::is_integer) - { - if(limits::is_signed || - limits::digits <= boost::hash_detail::limits::digits) - { - BOOST_TEST(HASH_NAMESPACE::hash_value(T(-5)) == (std::size_t)T(-5)); - } - BOOST_TEST(HASH_NAMESPACE::hash_value(T(0)) == (std::size_t)T(0u)); - BOOST_TEST(HASH_NAMESPACE::hash_value(T(10)) == (std::size_t)T(10u)); - BOOST_TEST(HASH_NAMESPACE::hash_value(T(25)) == (std::size_t)T(25u)); - } + numeric_extra_tests(); #endif } From d0bcc1ef41ce948846b6f224b0d8e71de8c3cb56 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Tue, 4 Dec 2012 22:23:20 +0000 Subject: [PATCH 05/32] Hash: Stop using warnings as errors for Visual C++. I'd like to get full test results for Visual C++ with STLport. [SVN r81712] --- hash/test/Jamfile.v2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hash/test/Jamfile.v2 b/hash/test/Jamfile.v2 index 34b69e6..5325b19 100644 --- a/hash/test/Jamfile.v2 +++ b/hash/test/Jamfile.v2 @@ -12,7 +12,7 @@ project hash-tests intel:-strict-ansi gcc:"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter -Wconversion -Wfloat-equal -Wshadow" darwin:"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter -Wconversion -Wfloat-equal -Wshadow" - msvc:on + #msvc:on #gcc:on #darwin:on ; From 8a0c516b22c4c61035172fe0e6070f804c84e75e Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sat, 8 Dec 2012 09:19:24 +0000 Subject: [PATCH 06/32] Hash: Detab. [SVN r81787] --- hash/test/extra/check_float_funcs.cpp | 2 +- hash/test/hash_enum_test.cpp | 68 +++++++++++++------------- include/boost/functional/hash/hash.hpp | 6 +-- 3 files changed, 38 insertions(+), 38 deletions(-) diff --git a/hash/test/extra/check_float_funcs.cpp b/hash/test/extra/check_float_funcs.cpp index a937082..01d5168 100644 --- a/hash/test/extra/check_float_funcs.cpp +++ b/hash/test/extra/check_float_funcs.cpp @@ -55,4 +55,4 @@ int main() { int (*fpc3)(long double) = std::fpclassify; #endif -} \ No newline at end of file +} diff --git a/hash/test/hash_enum_test.cpp b/hash/test/hash_enum_test.cpp index 30444e5..016ea69 100644 --- a/hash/test/hash_enum_test.cpp +++ b/hash/test/hash_enum_test.cpp @@ -15,49 +15,49 @@ #include "./compile_time.hpp" namespace test { - enum enum_override { enum_override1, enum_override2 }; - std::size_t hash_value(enum_override) { return 896532; } + enum enum_override { enum_override1, enum_override2 }; + std::size_t hash_value(enum_override) { return 896532; } - enum enum1 { enum1a }; - enum enum2 { enum2a, enum2b }; - enum enum3 { enum3a = 574, enum3b }; - enum enum4 { enum4a = -12574, enum4b }; + enum enum1 { enum1a }; + enum enum2 { enum2a, enum2b }; + enum enum3 { enum3a = 574, enum3b }; + enum enum4 { enum4a = -12574, enum4b }; } int main() { - compile_time_tests((test::enum1*) 0); - compile_time_tests((test::enum2*) 0); - compile_time_tests((test::enum3*) 0); - compile_time_tests((test::enum4*) 0); - compile_time_tests((test::enum_override*) 0); + compile_time_tests((test::enum1*) 0); + compile_time_tests((test::enum2*) 0); + compile_time_tests((test::enum3*) 0); + compile_time_tests((test::enum4*) 0); + compile_time_tests((test::enum_override*) 0); - HASH_NAMESPACE::hash hash1; - HASH_NAMESPACE::hash hash2; - HASH_NAMESPACE::hash hash3; - HASH_NAMESPACE::hash hash4; - - BOOST_TEST(hash1(test::enum1a) == hash1(test::enum1a)); + HASH_NAMESPACE::hash hash1; + HASH_NAMESPACE::hash hash2; + HASH_NAMESPACE::hash hash3; + HASH_NAMESPACE::hash hash4; - BOOST_TEST(hash2(test::enum2a) == hash2(test::enum2a)); - BOOST_TEST(hash2(test::enum2a) != hash2(test::enum2b)); - BOOST_TEST(hash2(test::enum2b) == hash2(test::enum2b)); + BOOST_TEST(hash1(test::enum1a) == hash1(test::enum1a)); - BOOST_TEST(hash3(test::enum3a) == hash3(test::enum3a)); - BOOST_TEST(hash3(test::enum3a) != hash3(test::enum3b)); - BOOST_TEST(hash3(test::enum3b) == hash3(test::enum3b)); + BOOST_TEST(hash2(test::enum2a) == hash2(test::enum2a)); + BOOST_TEST(hash2(test::enum2a) != hash2(test::enum2b)); + BOOST_TEST(hash2(test::enum2b) == hash2(test::enum2b)); - BOOST_TEST(hash4(test::enum4a) == hash4(test::enum4a)); - BOOST_TEST(hash4(test::enum4a) != hash4(test::enum4b)); - BOOST_TEST(hash4(test::enum4b) == hash4(test::enum4b)); + BOOST_TEST(hash3(test::enum3a) == hash3(test::enum3a)); + BOOST_TEST(hash3(test::enum3a) != hash3(test::enum3b)); + BOOST_TEST(hash3(test::enum3b) == hash3(test::enum3b)); - HASH_NAMESPACE::hash hash_override; + BOOST_TEST(hash4(test::enum4a) == hash4(test::enum4a)); + BOOST_TEST(hash4(test::enum4a) != hash4(test::enum4b)); + BOOST_TEST(hash4(test::enum4b) == hash4(test::enum4b)); - BOOST_TEST(hash_override(test::enum_override1) == - hash_override(test::enum_override1)); - BOOST_TEST(hash_override(test::enum_override1) == - hash_override(test::enum_override2)); - BOOST_TEST(hash_override(test::enum_override1) == - hash_override(test::enum_override1)); + HASH_NAMESPACE::hash hash_override; - return boost::report_errors(); + BOOST_TEST(hash_override(test::enum_override1) == + hash_override(test::enum_override1)); + BOOST_TEST(hash_override(test::enum_override1) == + hash_override(test::enum_override2)); + BOOST_TEST(hash_override(test::enum_override1) == + hash_override(test::enum_override1)); + + return boost::report_errors(); } diff --git a/include/boost/functional/hash/hash.hpp b/include/boost/functional/hash/hash.hpp index 647fd68..1fc5566 100644 --- a/include/boost/functional/hash/hash.hpp +++ b/include/boost/functional/hash/hash.hpp @@ -94,7 +94,7 @@ namespace boost template typename boost::enable_if, std::size_t>::type - hash_value(T); + hash_value(T); #if !BOOST_WORKAROUND(__DMC__, <= 0x848) template std::size_t hash_value(T* const&); @@ -187,9 +187,9 @@ namespace boost template typename boost::enable_if, std::size_t>::type - hash_value(T v) + hash_value(T v) { - return static_cast(v); + return static_cast(v); } // Implementation by Alberto Barbati and Dave Harris. From 5fcfd1ae384760a78e5c8b151569f42a769f4780 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Mon, 10 Dec 2012 10:40:44 +0000 Subject: [PATCH 07/32] Hash: Support boost::int128_type. [SVN r81816] --- hash/test/hash_number_test.cpp | 5 +++++ include/boost/functional/hash/hash.hpp | 20 ++++++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/hash/test/hash_number_test.cpp b/hash/test/hash_number_test.cpp index b7083c9..e4555e3 100644 --- a/hash/test/hash_number_test.cpp +++ b/hash/test/hash_number_test.cpp @@ -175,6 +175,11 @@ int main() NUMERIC_TEST_NO_LIMITS(boost::ulong_long_type, ulong_long) #endif +#if defined(BOOST_HAS_INT128) + NUMERIC_TEST_NO_LIMITS(boost::int128_type, int128) + NUMERIC_TEST_NO_LIMITS(boost::uint128_type, uint128) +#endif + NUMERIC_TEST(float, float) NUMERIC_TEST(double, double) diff --git a/include/boost/functional/hash/hash.hpp b/include/boost/functional/hash/hash.hpp index 1fc5566..24318c8 100644 --- a/include/boost/functional/hash/hash.hpp +++ b/include/boost/functional/hash/hash.hpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) @@ -40,8 +41,8 @@ namespace boost struct enable_hash_value { typedef std::size_t type; }; template struct basic_numbers {}; - template struct long_numbers {}; - template struct ulong_numbers {}; + template struct long_numbers; + template struct ulong_numbers; template struct float_numbers {}; template <> struct basic_numbers : @@ -70,6 +71,14 @@ namespace boost boost::hash_detail::enable_hash_value {}; #endif + // long_numbers is defined like this to allow for separate + // specialization for long_long and int128_type, in case + // they conflict. + template struct long_numbers2 {}; + template struct ulong_numbers2 {}; + template struct long_numbers : long_numbers2 {}; + template struct ulong_numbers : long_numbers2 {}; + #if !defined(BOOST_NO_LONG_LONG) template <> struct long_numbers : boost::hash_detail::enable_hash_value {}; @@ -77,6 +86,13 @@ namespace boost boost::hash_detail::enable_hash_value {}; #endif +#if defined(BOOST_HAS_INT128) + template <> struct long_numbers2 : + boost::hash_detail::enable_hash_value {}; + template <> struct ulong_numbers2 : + boost::hash_detail::enable_hash_value {}; +#endif + template <> struct float_numbers : boost::hash_detail::enable_hash_value {}; template <> struct float_numbers : From f572834b59ebcc600dff0e128c401b838f07fe29 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Tue, 11 Dec 2012 15:48:19 +0000 Subject: [PATCH 08/32] Hash: Fix int128 support. [SVN r81854] --- include/boost/functional/hash/hash.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/functional/hash/hash.hpp b/include/boost/functional/hash/hash.hpp index 24318c8..f94ffce 100644 --- a/include/boost/functional/hash/hash.hpp +++ b/include/boost/functional/hash/hash.hpp @@ -77,7 +77,7 @@ namespace boost template struct long_numbers2 {}; template struct ulong_numbers2 {}; template struct long_numbers : long_numbers2 {}; - template struct ulong_numbers : long_numbers2 {}; + template struct ulong_numbers : ulong_numbers2 {}; #if !defined(BOOST_NO_LONG_LONG) template <> struct long_numbers : From 75ffe88f823ef08950391f445000afe5cd80f4ec Mon Sep 17 00:00:00 2001 From: Daniel James Date: Wed, 12 Dec 2012 09:44:32 +0000 Subject: [PATCH 09/32] Hash: Fix int128 with BOOST_HASH_NO_EXTENSIONS. I don't think int128 should count as an extension. BOOST_HASH_NO_EXTENSIONS is actually a bit of a pain, and I don't think it's that useful. Maybe I should deprecate it. [SVN r81870] --- hash/doc/changes.qbk | 3 +++ include/boost/functional/hash/hash.hpp | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/hash/doc/changes.qbk b/hash/doc/changes.qbk index b98e2ea..b20e58d 100644 --- a/hash/doc/changes.qbk +++ b/hash/doc/changes.qbk @@ -142,6 +142,9 @@ [h2 Boost 1.52.0] * Restore `enum` support, which was accidentally removed in the last version. +* Add support for `boost::int128_type` and `boost::uint128_type` where + available - currently only `__int128` and `unsigned __int128` on some + versions of gcc. * New floating point hasher - will hash the binary representation on more platforms, which should be faster. * On platforms that are known to have standard floating point, don't use the diff --git a/include/boost/functional/hash/hash.hpp b/include/boost/functional/hash/hash.hpp index f94ffce..aa4e49f 100644 --- a/include/boost/functional/hash/hash.hpp +++ b/include/boost/functional/hash/hash.hpp @@ -439,6 +439,11 @@ namespace boost BOOST_HASH_SPECIALIZE(boost::ulong_long_type) #endif +#if defined(BOOST_HAS_INT128) + BOOST_HASH_SPECIALIZE(boost::int128_type) + BOOST_HASH_SPECIALIZE(boost::uint128_type) +#endif + #if !defined(BOOST_NO_CXX11_HDR_TYPEINDEX) BOOST_HASH_SPECIALIZE(std::type_index) #endif From cc257de68eb0ac18e828780d15497eefc6f87811 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Mon, 17 Dec 2012 23:37:56 +0000 Subject: [PATCH 10/32] Hash: Safer macro names in tests. [SVN r82059] --- hash/test/compile_time.hpp | 2 +- hash/test/config.hpp | 10 ++--- hash/test/hash_built_in_array_test.cpp | 30 +++++++------- hash/test/hash_complex_test.cpp | 10 ++--- hash/test/hash_custom_test.cpp | 28 ++++++------- hash/test/hash_deque_test.cpp | 10 ++--- hash/test/hash_enum_test.cpp | 12 +++--- hash/test/hash_float_test.hpp | 48 +++++++++++------------ hash/test/hash_friend_test.cpp | 28 ++++++------- hash/test/hash_function_pointer_test.cpp | 12 +++--- hash/test/hash_fwd_test.hpp | 22 +++++------ hash/test/hash_fwd_test_1.cpp | 36 ++++++++--------- hash/test/hash_fwd_test_2.cpp | 4 +- hash/test/hash_global_namespace_test.cpp | 28 ++++++------- hash/test/hash_list_test.cpp | 10 ++--- hash/test/hash_map_test.cpp | 10 ++--- hash/test/hash_map_test.hpp | 6 +-- hash/test/hash_no_ext_fail_test.cpp | 4 +- hash/test/hash_no_ext_macro_1.cpp | 8 ++-- hash/test/hash_no_ext_macro_2.cpp | 8 ++-- hash/test/hash_number_test.cpp | 46 +++++++++++----------- hash/test/hash_pointer_test.cpp | 12 +++--- hash/test/hash_range_test.cpp | 50 ++++++++++++------------ hash/test/hash_sequence_test.hpp | 6 +-- hash/test/hash_set_test.cpp | 8 ++-- hash/test/hash_set_test.hpp | 6 +-- hash/test/hash_std_array_test.cpp | 6 +-- hash/test/hash_std_smart_ptr_test.cpp | 22 +++++------ hash/test/hash_std_tuple_test.cpp | 6 +-- hash/test/hash_string_test.cpp | 38 +++++++++--------- hash/test/hash_type_index_test.cpp | 10 ++--- hash/test/hash_value_array_test.cpp | 24 ++++++------ hash/test/hash_vector_test.cpp | 10 ++--- hash/test/link_ext_test.cpp | 12 +++--- hash/test/link_no_ext_test.cpp | 4 +- 35 files changed, 293 insertions(+), 293 deletions(-) diff --git a/hash/test/compile_time.hpp b/hash/test/compile_time.hpp index bd86038..40f39d8 100644 --- a/hash/test/compile_time.hpp +++ b/hash/test/compile_time.hpp @@ -11,6 +11,6 @@ template void compile_time_tests(T*) { BOOST_STATIC_ASSERT((boost::is_base_and_derived< - std::unary_function, HASH_NAMESPACE::hash >::value)); + std::unary_function, BOOST_HASH_TEST_NAMESPACE::hash >::value)); } diff --git a/hash/test/config.hpp b/hash/test/config.hpp index 216d9c4..53edf0a 100644 --- a/hash/test/config.hpp +++ b/hash/test/config.hpp @@ -3,13 +3,13 @@ // 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(TEST_STD) -# define TEST_STD_INCLUDES -# define HASH_NAMESPACE std +#if defined(BOOST_HASH_TEST_STD) +# define BOOST_HASH_TEST_STD_INCLUDES +# define BOOST_HASH_TEST_NAMESPACE std #else -# define HASH_NAMESPACE boost +# define BOOST_HASH_TEST_NAMESPACE boost # if !defined(BOOST_HASH_NO_EXTENSIONS) -# define TEST_EXTENSIONS +# define BOOST_HASH_TEST_EXTENSIONS # endif #endif diff --git a/hash/test/hash_built_in_array_test.cpp b/hash/test/hash_built_in_array_test.cpp index 9c91799..e2dfe99 100644 --- a/hash/test/hash_built_in_array_test.cpp +++ b/hash/test/hash_built_in_array_test.cpp @@ -5,8 +5,8 @@ #include "./config.hpp" -#ifdef TEST_EXTENSIONS -# ifdef TEST_STD_INCLUDES +#ifdef BOOST_HASH_TEST_EXTENSIONS +# ifdef BOOST_HASH_TEST_STD_INCLUDES # include # else # include @@ -15,7 +15,7 @@ #include -#ifdef TEST_EXTENSIONS +#ifdef BOOST_HASH_TEST_EXTENSIONS void array_int_test() { @@ -27,47 +27,47 @@ void array_int_test() 8, -12, 23, 65, 45, -1, 93, -54, 987, 3 }; - HASH_NAMESPACE::hash hasher1; + BOOST_HASH_TEST_NAMESPACE::hash hasher1; const int length2 = 1; int array2[1] = {3}; - HASH_NAMESPACE::hash hasher2; + BOOST_HASH_TEST_NAMESPACE::hash hasher2; const int length3 = 2; int array3[2] = {2, 3}; - HASH_NAMESPACE::hash hasher3; + BOOST_HASH_TEST_NAMESPACE::hash hasher3; BOOST_TEST(hasher1(array1) - == HASH_NAMESPACE::hash_range(array1, array1 + length1)); + == BOOST_HASH_TEST_NAMESPACE::hash_range(array1, array1 + length1)); BOOST_TEST(hasher2(array2) - == HASH_NAMESPACE::hash_range(array2, array2 + length2)); + == BOOST_HASH_TEST_NAMESPACE::hash_range(array2, array2 + length2)); BOOST_TEST(hasher3(array3) - == HASH_NAMESPACE::hash_range(array3, array3 + length3)); + == BOOST_HASH_TEST_NAMESPACE::hash_range(array3, array3 + length3)); } void two_dimensional_array_test() { int array[3][2] = {{-5, 6}, {7, -3}, {26, 1}}; - HASH_NAMESPACE::hash hasher; + BOOST_HASH_TEST_NAMESPACE::hash hasher; std::size_t seed1 = 0; for(int i = 0; i < 3; ++i) { std::size_t seed2 = 0; for(int j = 0; j < 2; ++j) - HASH_NAMESPACE::hash_combine(seed2, array[i][j]); - HASH_NAMESPACE::hash_combine(seed1, seed2); + BOOST_HASH_TEST_NAMESPACE::hash_combine(seed2, array[i][j]); + BOOST_HASH_TEST_NAMESPACE::hash_combine(seed1, seed2); } BOOST_TEST(hasher(array) == seed1); - BOOST_TEST(hasher(array) == HASH_NAMESPACE::hash_range(array, array + 3)); + BOOST_TEST(hasher(array) == BOOST_HASH_TEST_NAMESPACE::hash_range(array, array + 3)); } -#endif // TEST_EXTENSIONS +#endif // BOOST_HASH_TEST_EXTENSIONS int main() { -#ifdef TEST_EXTENSIONS +#ifdef BOOST_HASH_TEST_EXTENSIONS array_int_test(); two_dimensional_array_test(); #endif diff --git a/hash/test/hash_complex_test.cpp b/hash/test/hash_complex_test.cpp index 36d2673..617b51b 100644 --- a/hash/test/hash_complex_test.cpp +++ b/hash/test/hash_complex_test.cpp @@ -5,13 +5,13 @@ #include "./config.hpp" -#if !defined(TEST_EXTENSIONS) +#if !defined(BOOST_HASH_TEST_EXTENSIONS) int main() {} #else -#ifdef TEST_STD_INCLUDES +#ifdef BOOST_HASH_TEST_STD_INCLUDES # include #else # include @@ -46,11 +46,11 @@ int main() {} template void generic_complex_tests(std::complex v) { - HASH_NAMESPACE::hash > complex_hasher; + BOOST_HASH_TEST_NAMESPACE::hash > complex_hasher; BOOST_TEST(complex_hasher(v) == complex_hasher(v)); - HASH_NAMESPACE::hash real_hasher; + BOOST_HASH_TEST_NAMESPACE::hash real_hasher; T real = v.real(); T imag = v.imag(); @@ -107,4 +107,4 @@ int main() return boost::report_errors(); } -#endif // TEST_EXTENSIONS +#endif // BOOST_HASH_TEST_EXTENSIONS diff --git a/hash/test/hash_custom_test.cpp b/hash/test/hash_custom_test.cpp index 966df09..75f1c2b 100644 --- a/hash/test/hash_custom_test.cpp +++ b/hash/test/hash_custom_test.cpp @@ -41,8 +41,8 @@ namespace boost #include "./config.hpp" -#ifdef TEST_EXTENSIONS -# ifdef TEST_STD_INCLUDES +#ifdef BOOST_HASH_TEST_EXTENSIONS +# ifdef BOOST_HASH_TEST_STD_INCLUDES # include # else # include @@ -51,7 +51,7 @@ namespace boost #include -#ifdef TEST_EXTENSIONS +#ifdef BOOST_HASH_TEST_EXTENSIONS #include #include @@ -59,13 +59,13 @@ namespace boost void custom_tests() { - HASH_NAMESPACE::hash custom_hasher; + BOOST_HASH_TEST_NAMESPACE::hash custom_hasher; BOOST_TEST(custom_hasher(10) == 100u); test::custom x(55); BOOST_TEST(custom_hasher(x) == 550u); { - using namespace HASH_NAMESPACE; + using namespace BOOST_HASH_TEST_NAMESPACE; BOOST_TEST(custom_hasher(x) == hash_value(x)); } @@ -75,25 +75,25 @@ void custom_tests() custom_vector.push_back(35); std::size_t seed = 0; - HASH_NAMESPACE::hash_combine(seed, test::custom(5)); - HASH_NAMESPACE::hash_combine(seed, test::custom(25)); - HASH_NAMESPACE::hash_combine(seed, test::custom(35)); + BOOST_HASH_TEST_NAMESPACE::hash_combine(seed, test::custom(5)); + BOOST_HASH_TEST_NAMESPACE::hash_combine(seed, test::custom(25)); + BOOST_HASH_TEST_NAMESPACE::hash_combine(seed, test::custom(35)); std::size_t seed2 = 0; - HASH_NAMESPACE::hash_combine(seed2, 50u); - HASH_NAMESPACE::hash_combine(seed2, 250u); - HASH_NAMESPACE::hash_combine(seed2, 350u); + BOOST_HASH_TEST_NAMESPACE::hash_combine(seed2, 50u); + BOOST_HASH_TEST_NAMESPACE::hash_combine(seed2, 250u); + BOOST_HASH_TEST_NAMESPACE::hash_combine(seed2, 350u); - BOOST_TEST(seed == HASH_NAMESPACE::hash_range( + BOOST_TEST(seed == BOOST_HASH_TEST_NAMESPACE::hash_range( custom_vector.begin(), custom_vector.end())); BOOST_TEST(seed == seed2); } -#endif // TEST_EXTENSIONS +#endif // BOOST_HASH_TEST_EXTENSIONS int main() { -#ifdef TEST_EXTENSIONS +#ifdef BOOST_HASH_TEST_EXTENSIONS custom_tests(); #endif return boost::report_errors(); diff --git a/hash/test/hash_deque_test.cpp b/hash/test/hash_deque_test.cpp index bfb2691..4d7f447 100644 --- a/hash/test/hash_deque_test.cpp +++ b/hash/test/hash_deque_test.cpp @@ -5,8 +5,8 @@ #include "./config.hpp" -#ifdef TEST_EXTENSIONS -# ifdef TEST_STD_INCLUDES +#ifdef BOOST_HASH_TEST_EXTENSIONS +# ifdef BOOST_HASH_TEST_STD_INCLUDES # include # else # include @@ -15,7 +15,7 @@ #include -#ifdef TEST_EXTENSIONS +#ifdef BOOST_HASH_TEST_EXTENSIONS #include @@ -23,11 +23,11 @@ using std::deque; #define CONTAINER_TYPE deque #include "./hash_sequence_test.hpp" -#endif // TEST_EXTENSIONS +#endif // BOOST_HASH_TEST_EXTENSIONS int main() { -#ifdef TEST_EXTENSIONS +#ifdef BOOST_HASH_TEST_EXTENSIONS deque_tests::deque_hash_integer_tests(); #endif diff --git a/hash/test/hash_enum_test.cpp b/hash/test/hash_enum_test.cpp index 016ea69..2872b43 100644 --- a/hash/test/hash_enum_test.cpp +++ b/hash/test/hash_enum_test.cpp @@ -5,7 +5,7 @@ #include "./config.hpp" -#ifdef TEST_STD_INCLUDES +#ifdef BOOST_HASH_TEST_STD_INCLUDES # include #else # include @@ -31,10 +31,10 @@ int main() { compile_time_tests((test::enum4*) 0); compile_time_tests((test::enum_override*) 0); - HASH_NAMESPACE::hash hash1; - HASH_NAMESPACE::hash hash2; - HASH_NAMESPACE::hash hash3; - HASH_NAMESPACE::hash hash4; + BOOST_HASH_TEST_NAMESPACE::hash hash1; + BOOST_HASH_TEST_NAMESPACE::hash hash2; + BOOST_HASH_TEST_NAMESPACE::hash hash3; + BOOST_HASH_TEST_NAMESPACE::hash hash4; BOOST_TEST(hash1(test::enum1a) == hash1(test::enum1a)); @@ -50,7 +50,7 @@ int main() { BOOST_TEST(hash4(test::enum4a) != hash4(test::enum4b)); BOOST_TEST(hash4(test::enum4b) == hash4(test::enum4b)); - HASH_NAMESPACE::hash hash_override; + BOOST_HASH_TEST_NAMESPACE::hash hash_override; BOOST_TEST(hash_override(test::enum_override1) == hash_override(test::enum_override1)); diff --git a/hash/test/hash_float_test.hpp b/hash/test/hash_float_test.hpp index a61d9de..8c2a43a 100644 --- a/hash/test/hash_float_test.hpp +++ b/hash/test/hash_float_test.hpp @@ -5,7 +5,7 @@ #include "./config.hpp" -#ifdef TEST_STD_INCLUDES +#ifdef BOOST_HASH_TEST_STD_INCLUDES # include #else # include @@ -43,7 +43,7 @@ void float_tests(char const* name, T* = 0) { std::cerr << "\n" - << "Testing " BOOST_STRINGIZE(HASH_NAMESPACE) "::hash<" + << "Testing " BOOST_STRINGIZE(BOOST_HASH_TEST_NAMESPACE) "::hash<" << name << ">\n" << "\n" @@ -70,7 +70,7 @@ void float_tests(char const* name, T* = 0) << "\n" ; - HASH_NAMESPACE::hash x1; + BOOST_HASH_TEST_NAMESPACE::hash x1; T zero = 0; T minus_zero = (T) -1 * zero; @@ -78,9 +78,9 @@ void float_tests(char const* name, T* = 0) BOOST_TEST(zero == minus_zero); BOOST_TEST(x1(zero) == x1(minus_zero)); -#if defined(TEST_EXTENSIONS) - BOOST_TEST(x1(zero) == HASH_NAMESPACE::hash_value(zero)); - BOOST_TEST(x1(minus_zero) == HASH_NAMESPACE::hash_value(minus_zero)); +#if defined(BOOST_HASH_TEST_EXTENSIONS) + BOOST_TEST(x1(zero) == BOOST_HASH_TEST_NAMESPACE::hash_value(zero)); + BOOST_TEST(x1(minus_zero) == BOOST_HASH_TEST_NAMESPACE::hash_value(minus_zero)); #endif BOOST_TEST(x1(zero) != x1(0.5)); @@ -106,10 +106,10 @@ void float_tests(char const* name, T* = 0) T minus_infinity2 = (T) -1. / zero; T minus_infinity3 = (T) 1. / minus_zero; -#if defined(TEST_EXTENSIONS) - BOOST_TEST(x1(infinity) == HASH_NAMESPACE::hash_value(infinity)); +#if defined(BOOST_HASH_TEST_EXTENSIONS) + BOOST_TEST(x1(infinity) == BOOST_HASH_TEST_NAMESPACE::hash_value(infinity)); BOOST_TEST(x1(minus_infinity) - == HASH_NAMESPACE::hash_value(minus_infinity)); + == BOOST_HASH_TEST_NAMESPACE::hash_value(minus_infinity)); #endif if(infinity == infinity2) @@ -191,12 +191,12 @@ void float_tests(char const* name, T* = 0) BOOST_TEST(three_quarter_max != -three_quarter_max); -#if defined(TEST_EXTENSIONS) - BOOST_TEST(x1(max) == HASH_NAMESPACE::hash_value(max)); - BOOST_TEST(x1(half_max) == HASH_NAMESPACE::hash_value(half_max)); - BOOST_TEST(x1(quarter_max) == HASH_NAMESPACE::hash_value(quarter_max)); +#if defined(BOOST_HASH_TEST_EXTENSIONS) + BOOST_TEST(x1(max) == BOOST_HASH_TEST_NAMESPACE::hash_value(max)); + BOOST_TEST(x1(half_max) == BOOST_HASH_TEST_NAMESPACE::hash_value(half_max)); + BOOST_TEST(x1(quarter_max) == BOOST_HASH_TEST_NAMESPACE::hash_value(quarter_max)); BOOST_TEST(x1(three_quarter_max) == - HASH_NAMESPACE::hash_value(three_quarter_max)); + BOOST_HASH_TEST_NAMESPACE::hash_value(three_quarter_max)); #endif // The '!=' tests could legitimately fail, but with my hash it indicates a @@ -227,16 +227,16 @@ void float_tests(char const* name, T* = 0) if(v1 == v2) BOOST_TEST(x1(v1) == x1(v2)); -#if defined(TEST_EXTENSIONS) - BOOST_TEST(x1(v1) == HASH_NAMESPACE::hash_value(v1)); - BOOST_TEST(x1(v2) == HASH_NAMESPACE::hash_value(v2)); +#if defined(BOOST_HASH_TEST_EXTENSIONS) + BOOST_TEST(x1(v1) == BOOST_HASH_TEST_NAMESPACE::hash_value(v1)); + BOOST_TEST(x1(v2) == BOOST_HASH_TEST_NAMESPACE::hash_value(v2)); #endif #endif -#if defined(TEST_EXTENSIONS) +#if defined(BOOST_HASH_TEST_EXTENSIONS) BOOST_TEST(x1(boost::hash_detail::limits::epsilon()) == - HASH_NAMESPACE::hash_value( + BOOST_HASH_TEST_NAMESPACE::hash_value( boost::hash_detail::limits::epsilon())); #endif @@ -269,12 +269,12 @@ void float_tests(char const* name, T* = 0) if(x1(boost::hash_detail::limits::denorm_min()) == x1(zero)) { std::cerr<<"x1(denorm_min) == x1(zero) == "<::denorm_min()) != - HASH_NAMESPACE::hash_value( + BOOST_HASH_TEST_NAMESPACE::hash_value( boost::hash_detail::limits::denorm_min())) { std::cerr @@ -282,7 +282,7 @@ void float_tests(char const* name, T* = 0) << x1(boost::hash_detail::limits::denorm_min()) << "\nhash_value(boost::hash_detail::limits::denorm_min())" " = " - << HASH_NAMESPACE::hash_value( + << BOOST_HASH_TEST_NAMESPACE::hash_value( boost::hash_detail::limits::denorm_min()) << "\nx1(0) = " << x1(0) @@ -292,13 +292,13 @@ void float_tests(char const* name, T* = 0) } // NaN also causes borland to crash. -#if !defined(__BORLANDC__) && defined(TEST_EXTENSIONS) +#if !defined(__BORLANDC__) && defined(BOOST_HASH_TEST_EXTENSIONS) if(boost::hash_detail::limits::has_quiet_NaN) { if(x1(boost::hash_detail::limits::quiet_NaN()) == x1(1.0)) { std::cerr<<"x1(quiet_NaN) == x1(1.0) == "<::quiet_NaN()) == - HASH_NAMESPACE::hash_value( + BOOST_HASH_TEST_NAMESPACE::hash_value( boost::hash_detail::limits::quiet_NaN())); } #endif diff --git a/hash/test/hash_friend_test.cpp b/hash/test/hash_friend_test.cpp index 9d84570..03755a8 100644 --- a/hash/test/hash_friend_test.cpp +++ b/hash/test/hash_friend_test.cpp @@ -44,8 +44,8 @@ namespace boost #include "./config.hpp" -#ifdef TEST_EXTENSIONS -# ifdef TEST_STD_INCLUDES +#ifdef BOOST_HASH_TEST_EXTENSIONS +# ifdef BOOST_HASH_TEST_STD_INCLUDES # include # else # include @@ -54,7 +54,7 @@ namespace boost #include -#ifdef TEST_EXTENSIONS +#ifdef BOOST_HASH_TEST_EXTENSIONS #include #include @@ -62,13 +62,13 @@ namespace boost void custom_tests() { - HASH_NAMESPACE::hash > custom_hasher; + BOOST_HASH_TEST_NAMESPACE::hash > custom_hasher; BOOST_TEST(custom_hasher(10) == 100u); test::custom x(55); BOOST_TEST(custom_hasher(x) == 550u); { - using namespace HASH_NAMESPACE; + using namespace BOOST_HASH_TEST_NAMESPACE; BOOST_TEST(custom_hasher(x) == hash_value(x)); } @@ -78,25 +78,25 @@ void custom_tests() custom_vector.push_back(35); std::size_t seed = 0; - HASH_NAMESPACE::hash_combine(seed, test::custom(5)); - HASH_NAMESPACE::hash_combine(seed, test::custom(25)); - HASH_NAMESPACE::hash_combine(seed, test::custom(35)); + BOOST_HASH_TEST_NAMESPACE::hash_combine(seed, test::custom(5)); + BOOST_HASH_TEST_NAMESPACE::hash_combine(seed, test::custom(25)); + BOOST_HASH_TEST_NAMESPACE::hash_combine(seed, test::custom(35)); std::size_t seed2 = 0; - HASH_NAMESPACE::hash_combine(seed2, 50u); - HASH_NAMESPACE::hash_combine(seed2, 250u); - HASH_NAMESPACE::hash_combine(seed2, 350u); + BOOST_HASH_TEST_NAMESPACE::hash_combine(seed2, 50u); + BOOST_HASH_TEST_NAMESPACE::hash_combine(seed2, 250u); + BOOST_HASH_TEST_NAMESPACE::hash_combine(seed2, 350u); - BOOST_TEST(seed == HASH_NAMESPACE::hash_range( + BOOST_TEST(seed == BOOST_HASH_TEST_NAMESPACE::hash_range( custom_vector.begin(), custom_vector.end())); BOOST_TEST(seed == seed2); } -#endif // TEST_EXTENSIONS +#endif // BOOST_HASH_TEST_EXTENSIONS int main() { -#ifdef TEST_EXTENSIONS +#ifdef BOOST_HASH_TEST_EXTENSIONS custom_tests(); #endif return boost::report_errors(); diff --git a/hash/test/hash_function_pointer_test.cpp b/hash/test/hash_function_pointer_test.cpp index a73b718..50fedf7 100644 --- a/hash/test/hash_function_pointer_test.cpp +++ b/hash/test/hash_function_pointer_test.cpp @@ -5,7 +5,7 @@ #include "./config.hpp" -#ifdef TEST_STD_INCLUDES +#ifdef BOOST_HASH_TEST_STD_INCLUDES # include #else # include @@ -24,8 +24,8 @@ void function_pointer_tests() compile_time_tests((void(**)()) 0); compile_time_tests((int(**)(int)) 0); - HASH_NAMESPACE::hash hasher_void; - HASH_NAMESPACE::hash hasher_int; + BOOST_HASH_TEST_NAMESPACE::hash hasher_void; + BOOST_HASH_TEST_NAMESPACE::hash hasher_int; BOOST_TEST(&void_func1 != &void_func2); BOOST_TEST(&int_func1 != &int_func2); @@ -38,11 +38,11 @@ void function_pointer_tests() BOOST_TEST(hasher_int(&int_func1) == hasher_int(&int_func1)); BOOST_TEST(hasher_int(&int_func1) != hasher_int(&int_func2)); BOOST_TEST(hasher_int(&int_func1) != hasher_int(0)); -#if defined(TEST_EXTENSIONS) +#if defined(BOOST_HASH_TEST_EXTENSIONS) BOOST_TEST(hasher_void(&void_func1) - == HASH_NAMESPACE::hash_value(&void_func1)); + == BOOST_HASH_TEST_NAMESPACE::hash_value(&void_func1)); BOOST_TEST(hasher_int(&int_func1) - == HASH_NAMESPACE::hash_value(&int_func1)); + == BOOST_HASH_TEST_NAMESPACE::hash_value(&int_func1)); // This isn't specified in Peter's proposal: BOOST_TEST(hasher_void(0) == 0); diff --git a/hash/test/hash_fwd_test.hpp b/hash/test/hash_fwd_test.hpp index 09ef3b3..d3c8186 100644 --- a/hash/test/hash_fwd_test.hpp +++ b/hash/test/hash_fwd_test.hpp @@ -5,7 +5,7 @@ #include "./config.hpp" -#if defined(TEST_EXTENSIONS) && !defined(TEST_STD_INCLUDES) +#if defined(BOOST_HASH_TEST_EXTENSIONS) && !defined(BOOST_HASH_TEST_STD_INCLUDES) #include #include @@ -25,7 +25,7 @@ namespace test { template std::size_t hash_value(test_type1 const& x) { - HASH_NAMESPACE::hash hasher; + BOOST_HASH_TEST_NAMESPACE::hash hasher; return hasher(x.value); } #endif @@ -42,8 +42,8 @@ namespace test { std::size_t hash_value(test_type2 const& x) { std::size_t seed = 0; - HASH_NAMESPACE::hash_combine(seed, x.value1); - HASH_NAMESPACE::hash_combine(seed, x.value2); + BOOST_HASH_TEST_NAMESPACE::hash_combine(seed, x.value1); + BOOST_HASH_TEST_NAMESPACE::hash_combine(seed, x.value2); return seed; } #endif @@ -61,8 +61,8 @@ namespace test { std::size_t hash_value(test_type3 const& x) { std::size_t seed = - HASH_NAMESPACE::hash_range(x.values.begin(), x.values.end()); - HASH_NAMESPACE::hash_range(seed, x.values.begin(), x.values.end()); + BOOST_HASH_TEST_NAMESPACE::hash_range(x.values.begin(), x.values.end()); + BOOST_HASH_TEST_NAMESPACE::hash_range(seed, x.values.begin(), x.values.end()); return seed; } #endif @@ -76,7 +76,7 @@ namespace boost template std::size_t hash_value(test::test_type1 const& x) { - HASH_NAMESPACE::hash hasher; + BOOST_HASH_TEST_NAMESPACE::hash hasher; return hasher(x.value); } @@ -84,8 +84,8 @@ namespace boost std::size_t hash_value(test::test_type2 const& x) { std::size_t seed = 0; - HASH_NAMESPACE::hash_combine(seed, x.value1); - HASH_NAMESPACE::hash_combine(seed, x.value2); + BOOST_HASH_TEST_NAMESPACE::hash_combine(seed, x.value1); + BOOST_HASH_TEST_NAMESPACE::hash_combine(seed, x.value2); return seed; } @@ -93,8 +93,8 @@ namespace boost std::size_t hash_value(test::test_type3 const& x) { std::size_t seed = - HASH_NAMESPACE::hash_range(x.values.begin(), x.values.end()); - HASH_NAMESPACE::hash_range(seed, x.values.begin(), x.values.end()); + BOOST_HASH_TEST_NAMESPACE::hash_range(x.values.begin(), x.values.end()); + BOOST_HASH_TEST_NAMESPACE::hash_range(seed, x.values.begin(), x.values.end()); return seed; } } diff --git a/hash/test/hash_fwd_test_1.cpp b/hash/test/hash_fwd_test_1.cpp index 1f27f65..68fdde2 100644 --- a/hash/test/hash_fwd_test_1.cpp +++ b/hash/test/hash_fwd_test_1.cpp @@ -11,7 +11,7 @@ #include -#if defined(TEST_EXTENSIONS) && !defined(TEST_STD_INCLUDES) +#if defined(BOOST_HASH_TEST_EXTENSIONS) && !defined(BOOST_HASH_TEST_STD_INCLUDES) #include #include @@ -21,10 +21,10 @@ void fwd_test1() test::test_type1 x(5); test::test_type1 y("Test"); - HASH_NAMESPACE::hash hasher_int; - HASH_NAMESPACE::hash hasher_string; - HASH_NAMESPACE::hash > hasher_test_int; - HASH_NAMESPACE::hash > hasher_test_string; + BOOST_HASH_TEST_NAMESPACE::hash hasher_int; + BOOST_HASH_TEST_NAMESPACE::hash hasher_string; + BOOST_HASH_TEST_NAMESPACE::hash > hasher_test_int; + BOOST_HASH_TEST_NAMESPACE::hash > hasher_test_string; BOOST_TEST(hasher_int(5) == hasher_test_int(x)); BOOST_TEST(hasher_string("Test") == hasher_test_string(y)); @@ -36,15 +36,15 @@ void fwd_test2() test::test_type2 y("Test1", "Test2"); std::size_t seed1 = 0; - HASH_NAMESPACE::hash_combine(seed1, 5); - HASH_NAMESPACE::hash_combine(seed1, 10); + BOOST_HASH_TEST_NAMESPACE::hash_combine(seed1, 5); + BOOST_HASH_TEST_NAMESPACE::hash_combine(seed1, 10); std::size_t seed2 = 0; - HASH_NAMESPACE::hash_combine(seed2, std::string("Test1")); - HASH_NAMESPACE::hash_combine(seed2, std::string("Test2")); + BOOST_HASH_TEST_NAMESPACE::hash_combine(seed2, std::string("Test1")); + BOOST_HASH_TEST_NAMESPACE::hash_combine(seed2, std::string("Test2")); - HASH_NAMESPACE::hash > hasher_test_int; - HASH_NAMESPACE::hash > hasher_test_string; + BOOST_HASH_TEST_NAMESPACE::hash > hasher_test_int; + BOOST_HASH_TEST_NAMESPACE::hash > hasher_test_string; BOOST_TEST(seed1 == hasher_test_int(x)); BOOST_TEST(seed2 == hasher_test_string(y)); @@ -69,15 +69,15 @@ void fwd_test3() test::test_type3 y(values2.begin(), values2.end()); std::size_t seed1 = - HASH_NAMESPACE::hash_range(values1.begin(), values1.end()); - HASH_NAMESPACE::hash_range(seed1, values1.begin(), values1.end()); + BOOST_HASH_TEST_NAMESPACE::hash_range(values1.begin(), values1.end()); + BOOST_HASH_TEST_NAMESPACE::hash_range(seed1, values1.begin(), values1.end()); std::size_t seed2 = - HASH_NAMESPACE::hash_range(values2.begin(), values2.end()); - HASH_NAMESPACE::hash_range(seed2, values2.begin(), values2.end()); + BOOST_HASH_TEST_NAMESPACE::hash_range(values2.begin(), values2.end()); + BOOST_HASH_TEST_NAMESPACE::hash_range(seed2, values2.begin(), values2.end()); - HASH_NAMESPACE::hash > hasher_test_int; - HASH_NAMESPACE::hash > hasher_test_string; + BOOST_HASH_TEST_NAMESPACE::hash > hasher_test_int; + BOOST_HASH_TEST_NAMESPACE::hash > hasher_test_string; BOOST_TEST(seed1 == hasher_test_int(x)); BOOST_TEST(seed2 == hasher_test_string(y)); @@ -87,7 +87,7 @@ void fwd_test3() int main() { -#ifdef TEST_EXTENSIONS +#ifdef BOOST_HASH_TEST_EXTENSIONS fwd_test1(); fwd_test2(); fwd_test3(); diff --git a/hash/test/hash_fwd_test_2.cpp b/hash/test/hash_fwd_test_2.cpp index 869f67b..d4c1a32 100644 --- a/hash/test/hash_fwd_test_2.cpp +++ b/hash/test/hash_fwd_test_2.cpp @@ -8,7 +8,7 @@ #include "./config.hpp" -#if !defined(TEST_EXTENSIONS) || defined(TEST_STD_INCLUDES) +#if !defined(BOOST_HASH_TEST_EXTENSIONS) || defined(BOOST_HASH_TEST_STD_INCLUDES) int main() {} @@ -44,4 +44,4 @@ int main() return boost::report_errors(); } -#endif // defined(TEST_EXTENSIONS) && !defined(TEST_STD_INCLUDES) +#endif // defined(BOOST_HASH_TEST_EXTENSIONS) && !defined(BOOST_HASH_TEST_STD_INCLUDES) diff --git a/hash/test/hash_global_namespace_test.cpp b/hash/test/hash_global_namespace_test.cpp index d1d504d..877ff00 100644 --- a/hash/test/hash_global_namespace_test.cpp +++ b/hash/test/hash_global_namespace_test.cpp @@ -42,8 +42,8 @@ namespace boost #include "./config.hpp" -#ifdef TEST_EXTENSIONS -# ifdef TEST_STD_INCLUDES +#ifdef BOOST_HASH_TEST_EXTENSIONS +# ifdef BOOST_HASH_TEST_STD_INCLUDES # include # else # include @@ -52,7 +52,7 @@ namespace boost #include -#ifdef TEST_EXTENSIONS +#ifdef BOOST_HASH_TEST_EXTENSIONS #include #include @@ -60,13 +60,13 @@ namespace boost void custom_tests() { - HASH_NAMESPACE::hash custom_hasher; + BOOST_HASH_TEST_NAMESPACE::hash custom_hasher; BOOST_TEST(custom_hasher(10) == 100u); custom x(55); BOOST_TEST(custom_hasher(x) == 550u); { - using namespace HASH_NAMESPACE; + using namespace BOOST_HASH_TEST_NAMESPACE; BOOST_TEST(custom_hasher(x) == hash_value(x)); } @@ -76,26 +76,26 @@ void custom_tests() custom_vector.push_back(35); std::size_t seed = 0; - HASH_NAMESPACE::hash_combine(seed, custom(5)); - HASH_NAMESPACE::hash_combine(seed, custom(25)); - HASH_NAMESPACE::hash_combine(seed, custom(35)); + BOOST_HASH_TEST_NAMESPACE::hash_combine(seed, custom(5)); + BOOST_HASH_TEST_NAMESPACE::hash_combine(seed, custom(25)); + BOOST_HASH_TEST_NAMESPACE::hash_combine(seed, custom(35)); std::size_t seed2 = 0; - HASH_NAMESPACE::hash_combine(seed2, 50u); - HASH_NAMESPACE::hash_combine(seed2, 250u); - HASH_NAMESPACE::hash_combine(seed2, 350u); + BOOST_HASH_TEST_NAMESPACE::hash_combine(seed2, 50u); + BOOST_HASH_TEST_NAMESPACE::hash_combine(seed2, 250u); + BOOST_HASH_TEST_NAMESPACE::hash_combine(seed2, 350u); - BOOST_TEST(seed == HASH_NAMESPACE::hash_range( + BOOST_TEST(seed == BOOST_HASH_TEST_NAMESPACE::hash_range( custom_vector.begin(), custom_vector.end())); BOOST_TEST(seed == seed2); } -#endif // TEST_EXTENSIONS +#endif // BOOST_HASH_TEST_EXTENSIONS int main() { -#ifdef TEST_EXTENSIONS +#ifdef BOOST_HASH_TEST_EXTENSIONS custom_tests(); #endif return boost::report_errors(); diff --git a/hash/test/hash_list_test.cpp b/hash/test/hash_list_test.cpp index 30560d3..a0f9716 100644 --- a/hash/test/hash_list_test.cpp +++ b/hash/test/hash_list_test.cpp @@ -5,8 +5,8 @@ #include "./config.hpp" -#ifdef TEST_EXTENSIONS -# ifdef TEST_STD_INCLUDES +#ifdef BOOST_HASH_TEST_EXTENSIONS +# ifdef BOOST_HASH_TEST_STD_INCLUDES # include # else # include @@ -15,7 +15,7 @@ #include -#ifdef TEST_EXTENSIONS +#ifdef BOOST_HASH_TEST_EXTENSIONS #include @@ -23,11 +23,11 @@ using std::list; #define CONTAINER_TYPE list #include "./hash_sequence_test.hpp" -#endif // TEST_EXTENSIONS +#endif // BOOST_HASH_TEST_EXTENSIONS int main() { -#ifdef TEST_EXTENSIONS +#ifdef BOOST_HASH_TEST_EXTENSIONS list_tests::list_hash_integer_tests(); #endif diff --git a/hash/test/hash_map_test.cpp b/hash/test/hash_map_test.cpp index 7e117c7..01a7854 100644 --- a/hash/test/hash_map_test.cpp +++ b/hash/test/hash_map_test.cpp @@ -5,8 +5,8 @@ #include "./config.hpp" -#ifdef TEST_EXTENSIONS -# ifdef TEST_STD_INCLUDES +#ifdef BOOST_HASH_TEST_EXTENSIONS +# ifdef BOOST_HASH_TEST_STD_INCLUDES # include # else # include @@ -17,7 +17,7 @@ #include -#ifdef TEST_EXTENSIONS +#ifdef BOOST_HASH_TEST_EXTENSIONS using std::map; #define CONTAINER_TYPE map @@ -27,11 +27,11 @@ using std::multimap; #define CONTAINER_TYPE multimap #include "./hash_map_test.hpp" -#endif // TEST_EXTENSIONS +#endif // BOOST_HASH_TEST_EXTENSIONS int main() { -#ifdef TEST_EXTENSIONS +#ifdef BOOST_HASH_TEST_EXTENSIONS map_tests::map_hash_integer_tests(); multimap_tests::multimap_hash_integer_tests(); #endif diff --git a/hash/test/hash_map_test.hpp b/hash/test/hash_map_test.hpp index bd0255f..41bb2fa 100644 --- a/hash/test/hash_map_test.hpp +++ b/hash/test/hash_map_test.hpp @@ -38,16 +38,16 @@ namespace BOOST_PP_CAT(CONTAINER_TYPE, _tests) containers[9].insert(pair(key(-1),value(3))); containers[9].insert(pair(key(-1),value(3))); - HASH_NAMESPACE::hash hasher; + BOOST_HASH_TEST_NAMESPACE::hash hasher; for(int i2 = 0; i2 < number_of_containers; ++i2) { BOOST_TEST(hasher(containers[i2]) == hasher(containers[i2])); BOOST_TEST(hasher(containers[i2]) == - HASH_NAMESPACE::hash_value(containers[i2])); + BOOST_HASH_TEST_NAMESPACE::hash_value(containers[i2])); BOOST_TEST(hasher(containers[i2]) - == HASH_NAMESPACE::hash_range( + == BOOST_HASH_TEST_NAMESPACE::hash_range( containers[i2].begin(), containers[i2].end())); for(int j2 = i2 + 1; j2 < number_of_containers; ++j2) { diff --git a/hash/test/hash_no_ext_fail_test.cpp b/hash/test/hash_no_ext_fail_test.cpp index 22f6f5a..6d1636e 100644 --- a/hash/test/hash_no_ext_fail_test.cpp +++ b/hash/test/hash_no_ext_fail_test.cpp @@ -11,7 +11,7 @@ # define BOOST_HASH_NO_EXTENSIONS #endif -#ifdef TEST_STD_INCLUDES +#ifdef BOOST_HASH_TEST_STD_INCLUDES # include #else # include @@ -21,7 +21,7 @@ template void ignore(T const&) {} int main() { - HASH_NAMESPACE::hash< int[10] > hasher; + BOOST_HASH_TEST_NAMESPACE::hash< int[10] > hasher; ignore(hasher); return 0; diff --git a/hash/test/hash_no_ext_macro_1.cpp b/hash/test/hash_no_ext_macro_1.cpp index ea727bb..d69e5b5 100644 --- a/hash/test/hash_no_ext_macro_1.cpp +++ b/hash/test/hash_no_ext_macro_1.cpp @@ -5,7 +5,7 @@ #include "./config.hpp" -#if defined(TEST_EXTENSIONS) +#if defined(BOOST_HASH_TEST_EXTENSIONS) // Include header without BOOST_HASH_NO_EXTENSIONS defined # if defined(BOOST_HASH_NO_EXTENSIONS) @@ -23,14 +23,14 @@ int main() { -#if defined(TEST_EXTENSIONS) +#if defined(BOOST_HASH_TEST_EXTENSIONS) std::deque x; x.push_back(1); x.push_back(2); - HASH_NAMESPACE::hash > hasher; - BOOST_TEST(hasher(x) == HASH_NAMESPACE::hash_value(x)); + BOOST_HASH_TEST_NAMESPACE::hash > hasher; + BOOST_TEST(hasher(x) == BOOST_HASH_TEST_NAMESPACE::hash_value(x)); #endif return boost::report_errors(); diff --git a/hash/test/hash_no_ext_macro_2.cpp b/hash/test/hash_no_ext_macro_2.cpp index a8d8c65..fe548ee 100644 --- a/hash/test/hash_no_ext_macro_2.cpp +++ b/hash/test/hash_no_ext_macro_2.cpp @@ -5,7 +5,7 @@ #include "./config.hpp" -#if defined(TEST_EXTENSIONS) +#if defined(BOOST_HASH_TEST_EXTENSIONS) // Include header with BOOST_HASH_NO_EXTENSIONS defined # if !defined(BOOST_HASH_NO_EXTENSIONS) @@ -23,14 +23,14 @@ int main() { -#if defined(TEST_EXTENSIONS) +#if defined(BOOST_HASH_TEST_EXTENSIONS) std::map x; x.insert(std::map::value_type(53, -42)); x.insert(std::map::value_type(14, -75)); - HASH_NAMESPACE::hash > hasher; - BOOST_TEST(hasher(x) == HASH_NAMESPACE::hash_value(x)); + BOOST_HASH_TEST_NAMESPACE::hash > hasher; + BOOST_TEST(hasher(x) == BOOST_HASH_TEST_NAMESPACE::hash_value(x)); #endif return boost::report_errors(); diff --git a/hash/test/hash_number_test.cpp b/hash/test/hash_number_test.cpp index e4555e3..242c731 100644 --- a/hash/test/hash_number_test.cpp +++ b/hash/test/hash_number_test.cpp @@ -5,7 +5,7 @@ #include "./config.hpp" -#ifdef TEST_STD_INCLUDES +#ifdef BOOST_HASH_TEST_STD_INCLUDES # include #else # include @@ -41,11 +41,11 @@ void numeric_extra_tests(typename if(limits::is_signed || limits::digits <= boost::hash_detail::limits::digits) { - BOOST_TEST(HASH_NAMESPACE::hash_value(T(-5)) == (std::size_t)T(-5)); + BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_value(T(-5)) == (std::size_t)T(-5)); } - BOOST_TEST(HASH_NAMESPACE::hash_value(T(0)) == (std::size_t)T(0u)); - BOOST_TEST(HASH_NAMESPACE::hash_value(T(10)) == (std::size_t)T(10u)); - BOOST_TEST(HASH_NAMESPACE::hash_value(T(25)) == (std::size_t)T(25u)); + BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_value(T(0)) == (std::size_t)T(0u)); + BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_value(T(10)) == (std::size_t)T(10u)); + BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_value(T(25)) == (std::size_t)T(25u)); } template @@ -62,8 +62,8 @@ void numeric_test(T*) compile_time_tests((T*) 0); - HASH_NAMESPACE::hash x1; - HASH_NAMESPACE::hash x2; + BOOST_HASH_TEST_NAMESPACE::hash x1; + BOOST_HASH_TEST_NAMESPACE::hash x2; T v1 = (T) -5; BOOST_TEST(x1(v1) == x2(v1)); @@ -74,11 +74,11 @@ void numeric_test(T*) BOOST_TEST(x1(T(5) - T(5)) == x2(T(0))); BOOST_TEST(x1(T(6) + T(4)) == x2(T(10))); -#if defined(TEST_EXTENSIONS) - BOOST_TEST(x1(T(-5)) == HASH_NAMESPACE::hash_value(T(-5))); - BOOST_TEST(x1(T(0)) == HASH_NAMESPACE::hash_value(T(0))); - BOOST_TEST(x1(T(10)) == HASH_NAMESPACE::hash_value(T(10))); - BOOST_TEST(x1(T(25)) == HASH_NAMESPACE::hash_value(T(25))); +#if defined(BOOST_HASH_TEST_EXTENSIONS) + BOOST_TEST(x1(T(-5)) == BOOST_HASH_TEST_NAMESPACE::hash_value(T(-5))); + BOOST_TEST(x1(T(0)) == BOOST_HASH_TEST_NAMESPACE::hash_value(T(0))); + BOOST_TEST(x1(T(10)) == BOOST_HASH_TEST_NAMESPACE::hash_value(T(10))); + BOOST_TEST(x1(T(25)) == BOOST_HASH_TEST_NAMESPACE::hash_value(T(25))); numeric_extra_tests(); #endif @@ -91,8 +91,8 @@ void limits_test(T*) if(limits::is_specialized) { - HASH_NAMESPACE::hash x1; - HASH_NAMESPACE::hash x2; + BOOST_HASH_TEST_NAMESPACE::hash x1; + BOOST_HASH_TEST_NAMESPACE::hash x2; T min_value = (limits::min)(); T max_value = (limits::max)(); @@ -100,15 +100,15 @@ void limits_test(T*) BOOST_TEST(x1(min_value) == x2((limits::min)())); BOOST_TEST(x1(max_value) == x2((limits::max)())); -#if defined(TEST_EXTENSIONS) - BOOST_TEST(x1(min_value) == HASH_NAMESPACE::hash_value(min_value)); - BOOST_TEST(x1(max_value) == HASH_NAMESPACE::hash_value(max_value)); +#if defined(BOOST_HASH_TEST_EXTENSIONS) + BOOST_TEST(x1(min_value) == BOOST_HASH_TEST_NAMESPACE::hash_value(min_value)); + BOOST_TEST(x1(max_value) == BOOST_HASH_TEST_NAMESPACE::hash_value(max_value)); if (limits::is_integer) { - BOOST_TEST(HASH_NAMESPACE::hash_value(min_value) + BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_value(min_value) == std::size_t(min_value)); - BOOST_TEST(HASH_NAMESPACE::hash_value(max_value) + BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_value(max_value) == std::size_t(max_value)); } #endif @@ -120,8 +120,8 @@ void poor_quality_tests(T*) { typedef boost::hash_detail::limits limits; - HASH_NAMESPACE::hash x1; - HASH_NAMESPACE::hash x2; + BOOST_HASH_TEST_NAMESPACE::hash x1; + BOOST_HASH_TEST_NAMESPACE::hash x2; // A hash function can legally fail these tests, but it'll not be a good // sign. @@ -136,8 +136,8 @@ void poor_quality_tests(T*) void bool_test() { - HASH_NAMESPACE::hash x1; - HASH_NAMESPACE::hash x2; + BOOST_HASH_TEST_NAMESPACE::hash x1; + BOOST_HASH_TEST_NAMESPACE::hash x2; BOOST_TEST(x1(true) == x2(true)); BOOST_TEST(x1(false) == x2(false)); diff --git a/hash/test/hash_pointer_test.cpp b/hash/test/hash_pointer_test.cpp index b255a28..7cacaa8 100644 --- a/hash/test/hash_pointer_test.cpp +++ b/hash/test/hash_pointer_test.cpp @@ -5,7 +5,7 @@ #include "./config.hpp" -#ifdef TEST_STD_INCLUDES +#ifdef BOOST_HASH_TEST_STD_INCLUDES # include #else # include @@ -20,8 +20,8 @@ void pointer_tests() compile_time_tests((int**) 0); compile_time_tests((void**) 0); - HASH_NAMESPACE::hash x1; - HASH_NAMESPACE::hash x2; + BOOST_HASH_TEST_NAMESPACE::hash x1; + BOOST_HASH_TEST_NAMESPACE::hash x2; int int1; int int2; @@ -29,9 +29,9 @@ void pointer_tests() BOOST_TEST(x1(0) == x2(0)); BOOST_TEST(x1(&int1) == x2(&int1)); BOOST_TEST(x1(&int2) == x2(&int2)); -#if defined(TEST_EXTENSIONS) - BOOST_TEST(x1(&int1) == HASH_NAMESPACE::hash_value(&int1)); - BOOST_TEST(x1(&int2) == HASH_NAMESPACE::hash_value(&int2)); +#if defined(BOOST_HASH_TEST_EXTENSIONS) + BOOST_TEST(x1(&int1) == BOOST_HASH_TEST_NAMESPACE::hash_value(&int1)); + BOOST_TEST(x1(&int2) == BOOST_HASH_TEST_NAMESPACE::hash_value(&int2)); // This isn't specified in Peter's proposal: BOOST_TEST(x1(0) == 0); diff --git a/hash/test/hash_range_test.cpp b/hash/test/hash_range_test.cpp index f5fdb2a..a5bdbb6 100644 --- a/hash/test/hash_range_test.cpp +++ b/hash/test/hash_range_test.cpp @@ -5,13 +5,13 @@ #include "./config.hpp" -#if !defined(TEST_EXTENSIONS) +#if !defined(BOOST_HASH_TEST_EXTENSIONS) int main() {} #else -#ifdef TEST_STD_INCLUDES +#ifdef BOOST_HASH_TEST_STD_INCLUDES # include #else # include @@ -40,39 +40,39 @@ void hash_range_tests() std::vector x; std::size_t x_seed = 0; - BOOST_TEST(x_seed == HASH_NAMESPACE::hash_range(x.begin(), x.end())); + BOOST_TEST(x_seed == BOOST_HASH_TEST_NAMESPACE::hash_range(x.begin(), x.end())); - BOOST_TEST(HASH_NAMESPACE::hash_range(empty.begin(), empty.end()) - == HASH_NAMESPACE::hash_range(x.begin(), x.end())); - BOOST_TEST(HASH_NAMESPACE::hash_range(empty.begin(), empty.end()) - != HASH_NAMESPACE::hash_range(values1.begin(), values1.end())); + BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_range(empty.begin(), empty.end()) + == BOOST_HASH_TEST_NAMESPACE::hash_range(x.begin(), x.end())); + BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_range(empty.begin(), empty.end()) + != BOOST_HASH_TEST_NAMESPACE::hash_range(values1.begin(), values1.end())); x.push_back(10); - HASH_NAMESPACE::hash_combine(x_seed, 10); - BOOST_TEST(x_seed == HASH_NAMESPACE::hash_range(x.begin(), x.end())); + BOOST_HASH_TEST_NAMESPACE::hash_combine(x_seed, 10); + BOOST_TEST(x_seed == BOOST_HASH_TEST_NAMESPACE::hash_range(x.begin(), x.end())); - BOOST_TEST(HASH_NAMESPACE::hash_range(empty.begin(), empty.end()) - != HASH_NAMESPACE::hash_range(x.begin(), x.end())); - BOOST_TEST(HASH_NAMESPACE::hash_range(values2.begin(), values2.end()) - == HASH_NAMESPACE::hash_range(x.begin(), x.end())); + BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_range(empty.begin(), empty.end()) + != BOOST_HASH_TEST_NAMESPACE::hash_range(x.begin(), x.end())); + BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_range(values2.begin(), values2.end()) + == BOOST_HASH_TEST_NAMESPACE::hash_range(x.begin(), x.end())); x.push_back(20); - HASH_NAMESPACE::hash_combine(x_seed, 20); - BOOST_TEST(x_seed == HASH_NAMESPACE::hash_range(x.begin(), x.end())); + BOOST_HASH_TEST_NAMESPACE::hash_combine(x_seed, 20); + BOOST_TEST(x_seed == BOOST_HASH_TEST_NAMESPACE::hash_range(x.begin(), x.end())); - BOOST_TEST(HASH_NAMESPACE::hash_range(empty.begin(), empty.end()) - != HASH_NAMESPACE::hash_range(x.begin(), x.end())); - BOOST_TEST(HASH_NAMESPACE::hash_range(values2.begin(), values2.end()) - != HASH_NAMESPACE::hash_range(x.begin(), x.end())); - BOOST_TEST(HASH_NAMESPACE::hash_range(values3.begin(), values3.end()) - == HASH_NAMESPACE::hash_range(x.begin(), x.end())); + BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_range(empty.begin(), empty.end()) + != BOOST_HASH_TEST_NAMESPACE::hash_range(x.begin(), x.end())); + BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_range(values2.begin(), values2.end()) + != BOOST_HASH_TEST_NAMESPACE::hash_range(x.begin(), x.end())); + BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_range(values3.begin(), values3.end()) + == BOOST_HASH_TEST_NAMESPACE::hash_range(x.begin(), x.end())); std::size_t seed = - HASH_NAMESPACE::hash_range(values3.begin(), values3.end()); - HASH_NAMESPACE::hash_range(seed, values4.begin(), values4.end()); - HASH_NAMESPACE::hash_range(seed, x.begin(), x.end()); + BOOST_HASH_TEST_NAMESPACE::hash_range(values3.begin(), values3.end()); + BOOST_HASH_TEST_NAMESPACE::hash_range(seed, values4.begin(), values4.end()); + BOOST_HASH_TEST_NAMESPACE::hash_range(seed, x.begin(), x.end()); BOOST_TEST(seed == - HASH_NAMESPACE::hash_range(values5.begin(), values5.end())); + BOOST_HASH_TEST_NAMESPACE::hash_range(values5.begin(), values5.end())); } int main() diff --git a/hash/test/hash_sequence_test.hpp b/hash/test/hash_sequence_test.hpp index 4093bc4..e0846b0 100644 --- a/hash/test/hash_sequence_test.hpp +++ b/hash/test/hash_sequence_test.hpp @@ -38,16 +38,16 @@ namespace BOOST_PP_CAT(CONTAINER_TYPE, _tests) containers[10].push_back(-1); containers[10].push_back(1); - HASH_NAMESPACE::hash hasher; + BOOST_HASH_TEST_NAMESPACE::hash hasher; for(int i2 = 0; i2 < number_of_containers; ++i2) { BOOST_TEST(hasher(containers[i2]) == hasher(containers[i2])); BOOST_TEST(hasher(containers[i2]) == - HASH_NAMESPACE::hash_value(containers[i2])); + BOOST_HASH_TEST_NAMESPACE::hash_value(containers[i2])); BOOST_TEST(hasher(containers[i2]) - == HASH_NAMESPACE::hash_range( + == BOOST_HASH_TEST_NAMESPACE::hash_range( containers[i2].begin(), containers[i2].end())); for(int j2 = i2 + 1; j2 < number_of_containers; ++j2) { diff --git a/hash/test/hash_set_test.cpp b/hash/test/hash_set_test.cpp index 8b5463d..1cf9fef 100644 --- a/hash/test/hash_set_test.cpp +++ b/hash/test/hash_set_test.cpp @@ -5,8 +5,8 @@ #include "./config.hpp" -#ifdef TEST_EXTENSIONS -# ifdef TEST_STD_INCLUDES +#ifdef BOOST_HASH_TEST_EXTENSIONS +# ifdef BOOST_HASH_TEST_STD_INCLUDES # include # else # include @@ -15,7 +15,7 @@ #include -#ifdef TEST_EXTENSIONS +#ifdef BOOST_HASH_TEST_EXTENSIONS #include @@ -31,7 +31,7 @@ using std::multiset; int main() { -#ifdef TEST_EXTENSIONS +#ifdef BOOST_HASH_TEST_EXTENSIONS set_tests::set_hash_integer_tests(); multiset_tests::multiset_hash_integer_tests(); #endif diff --git a/hash/test/hash_set_test.hpp b/hash/test/hash_set_test.hpp index 2a60781..31d4909 100644 --- a/hash/test/hash_set_test.hpp +++ b/hash/test/hash_set_test.hpp @@ -41,16 +41,16 @@ namespace BOOST_PP_CAT(CONTAINER_TYPE, _tests) containers[11].insert(4); containers[11].insert(5); - HASH_NAMESPACE::hash hasher; + BOOST_HASH_TEST_NAMESPACE::hash hasher; for(int i2 = 0; i2 < number_of_containers; ++i2) { BOOST_TEST(hasher(containers[i2]) == hasher(containers[i2])); BOOST_TEST(hasher(containers[i2]) == - HASH_NAMESPACE::hash_value(containers[i2])); + BOOST_HASH_TEST_NAMESPACE::hash_value(containers[i2])); BOOST_TEST(hasher(containers[i2]) - == HASH_NAMESPACE::hash_range( + == BOOST_HASH_TEST_NAMESPACE::hash_range( containers[i2].begin(), containers[i2].end())); for(int j2 = i2 + 1; j2 < number_of_containers; ++j2) { diff --git a/hash/test/hash_std_array_test.cpp b/hash/test/hash_std_array_test.cpp index 6f67a67..2b240a3 100644 --- a/hash/test/hash_std_array_test.cpp +++ b/hash/test/hash_std_array_test.cpp @@ -5,8 +5,8 @@ #include "./config.hpp" -#ifdef TEST_EXTENSIONS -# ifdef TEST_STD_INCLUDES +#ifdef BOOST_HASH_TEST_EXTENSIONS +# ifdef BOOST_HASH_TEST_STD_INCLUDES # include # else # include @@ -16,7 +16,7 @@ #include #include -#if defined(TEST_EXTENSIONS) && !defined(BOOST_NO_CXX11_HDR_ARRAY) +#if defined(BOOST_HASH_TEST_EXTENSIONS) && !defined(BOOST_NO_CXX11_HDR_ARRAY) #define TEST_ARRAY #include #include diff --git a/hash/test/hash_std_smart_ptr_test.cpp b/hash/test/hash_std_smart_ptr_test.cpp index 7452585..feb09d9 100644 --- a/hash/test/hash_std_smart_ptr_test.cpp +++ b/hash/test/hash_std_smart_ptr_test.cpp @@ -5,7 +5,7 @@ #include "./config.hpp" -#ifdef TEST_STD_INCLUDES +#ifdef BOOST_HASH_TEST_STD_INCLUDES # include #else # include @@ -14,7 +14,7 @@ #include #include "./compile_time.hpp" -#if defined(TEST_EXTENSIONS) && !defined(BOOST_NO_CXX11_SMART_PTR) +#if defined(BOOST_HASH_TEST_EXTENSIONS) && !defined(BOOST_NO_CXX11_SMART_PTR) #define TEST_SMART_PTRS #include #endif @@ -26,8 +26,8 @@ void shared_ptr_tests() std::shared_ptr x; compile_time_tests(&x); - HASH_NAMESPACE::hash > x1; - HASH_NAMESPACE::hash > x2; + BOOST_HASH_TEST_NAMESPACE::hash > x1; + BOOST_HASH_TEST_NAMESPACE::hash > x2; std::shared_ptr ptr1(new int(10)); std::shared_ptr ptr2; @@ -39,9 +39,9 @@ void shared_ptr_tests() BOOST_TEST(x1(ptr1) != x2(ptr2)); ptr2 = ptr1; BOOST_TEST(x1(ptr1) == x2(ptr2)); -#if defined(TEST_EXTENSIONS) - BOOST_TEST(x1(x) == HASH_NAMESPACE::hash_value(x)); - BOOST_TEST(x1(ptr1) == HASH_NAMESPACE::hash_value(ptr2)); +#if defined(BOOST_HASH_TEST_EXTENSIONS) + BOOST_TEST(x1(x) == BOOST_HASH_TEST_NAMESPACE::hash_value(x)); + BOOST_TEST(x1(ptr1) == BOOST_HASH_TEST_NAMESPACE::hash_value(ptr2)); #endif } @@ -50,8 +50,8 @@ void unique_ptr_tests() std::unique_ptr x; compile_time_tests(&x); - HASH_NAMESPACE::hash > x1; - HASH_NAMESPACE::hash > x2; + BOOST_HASH_TEST_NAMESPACE::hash > x1; + BOOST_HASH_TEST_NAMESPACE::hash > x2; std::unique_ptr ptr1(new int(10)); std::unique_ptr ptr2; @@ -62,8 +62,8 @@ void unique_ptr_tests() BOOST_TEST(x1(ptr1) == x2(ptr1)); BOOST_TEST(x1(ptr1) != x2(ptr2)); -#if defined(TEST_EXTENSIONS) - BOOST_TEST(x1(x) == HASH_NAMESPACE::hash_value(x)); +#if defined(BOOST_HASH_TEST_EXTENSIONS) + BOOST_TEST(x1(x) == BOOST_HASH_TEST_NAMESPACE::hash_value(x)); #endif } diff --git a/hash/test/hash_std_tuple_test.cpp b/hash/test/hash_std_tuple_test.cpp index 9314336..97bea99 100644 --- a/hash/test/hash_std_tuple_test.cpp +++ b/hash/test/hash_std_tuple_test.cpp @@ -5,8 +5,8 @@ #include "./config.hpp" -#ifdef TEST_EXTENSIONS -# ifdef TEST_STD_INCLUDES +#ifdef BOOST_HASH_TEST_EXTENSIONS +# ifdef BOOST_HASH_TEST_STD_INCLUDES # include # else # include @@ -16,7 +16,7 @@ #include #include -#if defined(TEST_EXTENSIONS) && !defined(BOOST_NO_CXX11_HDR_TUPLE) +#if defined(BOOST_HASH_TEST_EXTENSIONS) && !defined(BOOST_NO_CXX11_HDR_TUPLE) #define TEST_TUPLE #include #include diff --git a/hash/test/hash_string_test.cpp b/hash/test/hash_string_test.cpp index 29ff28e..de8ca87 100644 --- a/hash/test/hash_string_test.cpp +++ b/hash/test/hash_string_test.cpp @@ -5,7 +5,7 @@ #include "./config.hpp" -#ifdef TEST_STD_INCLUDES +#ifdef BOOST_HASH_TEST_STD_INCLUDES # include #else # include @@ -19,22 +19,22 @@ void string_tests() { compile_time_tests((std::string*) 0); - HASH_NAMESPACE::hash x1; - HASH_NAMESPACE::hash x2; + BOOST_HASH_TEST_NAMESPACE::hash x1; + BOOST_HASH_TEST_NAMESPACE::hash x2; BOOST_TEST(x1("Hello") == x2(std::string("Hel") + "lo")); BOOST_TEST(x1("") == x2(std::string())); -#if defined(TEST_EXTENSIONS) +#if defined(BOOST_HASH_TEST_EXTENSIONS) std::string value1; std::string value2("Hello"); - BOOST_TEST(x1(value1) == HASH_NAMESPACE::hash_value(value1)); - BOOST_TEST(x1(value2) == HASH_NAMESPACE::hash_value(value2)); - BOOST_TEST(HASH_NAMESPACE::hash_value(value1) == - HASH_NAMESPACE::hash_range(value1.begin(), value1.end())); - BOOST_TEST(HASH_NAMESPACE::hash_value(value2) == - HASH_NAMESPACE::hash_range(value2.begin(), value2.end())); + BOOST_TEST(x1(value1) == BOOST_HASH_TEST_NAMESPACE::hash_value(value1)); + BOOST_TEST(x1(value2) == BOOST_HASH_TEST_NAMESPACE::hash_value(value2)); + BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_value(value1) == + BOOST_HASH_TEST_NAMESPACE::hash_range(value1.begin(), value1.end())); + BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_value(value2) == + BOOST_HASH_TEST_NAMESPACE::hash_range(value2.begin(), value2.end())); #endif } @@ -43,22 +43,22 @@ void wstring_tests() { compile_time_tests((std::wstring*) 0); - HASH_NAMESPACE::hash x1; - HASH_NAMESPACE::hash x2; + BOOST_HASH_TEST_NAMESPACE::hash x1; + BOOST_HASH_TEST_NAMESPACE::hash x2; BOOST_TEST(x1(L"Hello") == x2(std::wstring(L"Hel") + L"lo")); BOOST_TEST(x1(L"") == x2(std::wstring())); -#if defined(TEST_EXTENSIONS) +#if defined(BOOST_HASH_TEST_EXTENSIONS) std::wstring value1; std::wstring value2(L"Hello"); - BOOST_TEST(x1(value1) == HASH_NAMESPACE::hash_value(value1)); - BOOST_TEST(x1(value2) == HASH_NAMESPACE::hash_value(value2)); - BOOST_TEST(HASH_NAMESPACE::hash_value(value1) == - HASH_NAMESPACE::hash_range(value1.begin(), value1.end())); - BOOST_TEST(HASH_NAMESPACE::hash_value(value2) == - HASH_NAMESPACE::hash_range(value2.begin(), value2.end())); + BOOST_TEST(x1(value1) == BOOST_HASH_TEST_NAMESPACE::hash_value(value1)); + BOOST_TEST(x1(value2) == BOOST_HASH_TEST_NAMESPACE::hash_value(value2)); + BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_value(value1) == + BOOST_HASH_TEST_NAMESPACE::hash_range(value1.begin(), value1.end())); + BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_value(value2) == + BOOST_HASH_TEST_NAMESPACE::hash_range(value2.begin(), value2.end())); #endif } #endif diff --git a/hash/test/hash_type_index_test.cpp b/hash/test/hash_type_index_test.cpp index 27fcfff..3288a5b 100644 --- a/hash/test/hash_type_index_test.cpp +++ b/hash/test/hash_type_index_test.cpp @@ -5,7 +5,7 @@ #include "./config.hpp" -#ifdef TEST_STD_INCLUDES +#ifdef BOOST_HASH_TEST_STD_INCLUDES # include #else # include @@ -18,7 +18,7 @@ #include void test_type_index() { - HASH_NAMESPACE::hash hasher; + BOOST_HASH_TEST_NAMESPACE::hash hasher; #if defined(BOOST_NO_TYPEID) std::cout<<"Unable to test std::type_index, as typeid isn't available" @@ -31,9 +31,9 @@ void test_type_index() { BOOST_TEST(hasher(int_index) == int_index.hash_code()); BOOST_TEST(hasher(int_index) == int2_index.hash_code()); BOOST_TEST(hasher(char_index) == char_index.hash_code()); - BOOST_TEST(HASH_NAMESPACE::hash_value(int_index) == int_index.hash_code()); - BOOST_TEST(HASH_NAMESPACE::hash_value(int_index) == int2_index.hash_code()); - BOOST_TEST(HASH_NAMESPACE::hash_value(char_index) == char_index.hash_code()); + BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_value(int_index) == int_index.hash_code()); + BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_value(int_index) == int2_index.hash_code()); + BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_value(char_index) == char_index.hash_code()); BOOST_TEST(hasher(int_index) == hasher(int2_index)); BOOST_TEST(hasher(int_index) != hasher(char_index)); diff --git a/hash/test/hash_value_array_test.cpp b/hash/test/hash_value_array_test.cpp index 75dfd4f..58fc447 100644 --- a/hash/test/hash_value_array_test.cpp +++ b/hash/test/hash_value_array_test.cpp @@ -8,8 +8,8 @@ #include "./config.hpp" -#ifdef TEST_EXTENSIONS -# ifdef TEST_STD_INCLUDES +#ifdef BOOST_HASH_TEST_EXTENSIONS +# ifdef BOOST_HASH_TEST_STD_INCLUDES # include # else # include @@ -18,7 +18,7 @@ #include -#ifdef TEST_EXTENSIONS +#ifdef BOOST_HASH_TEST_EXTENSIONS void array_int_test() { @@ -29,32 +29,32 @@ void array_int_test() 8, -12, 23, 65, 45, -1, 93, -54, 987, 3 }; - HASH_NAMESPACE::hash hasher1; + BOOST_HASH_TEST_NAMESPACE::hash hasher1; int array2[1] = {3}; - HASH_NAMESPACE::hash hasher2; + BOOST_HASH_TEST_NAMESPACE::hash hasher2; int array3[2] = {2, 3}; - HASH_NAMESPACE::hash hasher3; + BOOST_HASH_TEST_NAMESPACE::hash hasher3; - BOOST_TEST(hasher1(array1) == HASH_NAMESPACE::hash_value(array1)); - BOOST_TEST(hasher2(array2) == HASH_NAMESPACE::hash_value(array2)); - BOOST_TEST(hasher3(array3) == HASH_NAMESPACE::hash_value(array3)); + BOOST_TEST(hasher1(array1) == BOOST_HASH_TEST_NAMESPACE::hash_value(array1)); + BOOST_TEST(hasher2(array2) == BOOST_HASH_TEST_NAMESPACE::hash_value(array2)); + BOOST_TEST(hasher3(array3) == BOOST_HASH_TEST_NAMESPACE::hash_value(array3)); } void two_dimensional_array_test() { int array[3][2] = {{-5, 6}, {7, -3}, {26, 1}}; - HASH_NAMESPACE::hash hasher; + BOOST_HASH_TEST_NAMESPACE::hash hasher; - BOOST_TEST(hasher(array) == HASH_NAMESPACE::hash_value(array)); + BOOST_TEST(hasher(array) == BOOST_HASH_TEST_NAMESPACE::hash_value(array)); } #endif int main() { -#ifdef TEST_EXTENSIONS +#ifdef BOOST_HASH_TEST_EXTENSIONS array_int_test(); two_dimensional_array_test(); #endif diff --git a/hash/test/hash_vector_test.cpp b/hash/test/hash_vector_test.cpp index de02fe8..6dcf3b0 100644 --- a/hash/test/hash_vector_test.cpp +++ b/hash/test/hash_vector_test.cpp @@ -5,8 +5,8 @@ #include "./config.hpp" -#ifdef TEST_EXTENSIONS -# ifdef TEST_STD_INCLUDES +#ifdef BOOST_HASH_TEST_EXTENSIONS +# ifdef BOOST_HASH_TEST_STD_INCLUDES # include # else # include @@ -15,7 +15,7 @@ #include -#ifdef TEST_EXTENSIONS +#ifdef BOOST_HASH_TEST_EXTENSIONS #include @@ -23,11 +23,11 @@ using std::vector; #define CONTAINER_TYPE vector #include "./hash_sequence_test.hpp" -#endif // TEST_EXTENSIONS +#endif // BOOST_HASH_TEST_EXTENSIONS int main() { -#ifdef TEST_EXTENSIONS +#ifdef BOOST_HASH_TEST_EXTENSIONS vector_tests::vector_hash_integer_tests(); #endif diff --git a/hash/test/link_ext_test.cpp b/hash/test/link_ext_test.cpp index c0e224c..dd895aa 100644 --- a/hash/test/link_ext_test.cpp +++ b/hash/test/link_ext_test.cpp @@ -5,24 +5,24 @@ #include "./config.hpp" -#define HASH_NAMESPACE boost +#define BOOST_HASH_TEST_NAMESPACE boost #include #include #include int f(std::size_t hash1, int* x1) { - // Check that HASH_NAMESPACE::hash works in both files. - HASH_NAMESPACE::hash ptr_hasher; + // Check that BOOST_HASH_TEST_NAMESPACE::hash works in both files. + BOOST_HASH_TEST_NAMESPACE::hash ptr_hasher; BOOST_TEST(hash1 == ptr_hasher(x1)); -#if defined(TEST_EXTENSIONS) +#if defined(BOOST_HASH_TEST_EXTENSIONS) // Check that std::vector is avaiable in this file. std::vector x; x.push_back(*x1); - HASH_NAMESPACE::hash > vector_hasher; - return vector_hasher(x) != HASH_NAMESPACE::hash_value(x); + BOOST_HASH_TEST_NAMESPACE::hash > vector_hasher; + return vector_hasher(x) != BOOST_HASH_TEST_NAMESPACE::hash_value(x); #else diff --git a/hash/test/link_no_ext_test.cpp b/hash/test/link_no_ext_test.cpp index c2e6869..75cd47d 100644 --- a/hash/test/link_no_ext_test.cpp +++ b/hash/test/link_no_ext_test.cpp @@ -5,7 +5,7 @@ #include "./config.hpp" -#define HASH_NAMESPACE boost +#define BOOST_HASH_TEST_NAMESPACE boost #define BOOST_HASH_NO_EXTENSIONS #include #include @@ -13,7 +13,7 @@ extern int f(std::size_t, int*); int main() { - HASH_NAMESPACE::hash ptr_hasher; + BOOST_HASH_TEST_NAMESPACE::hash ptr_hasher; int x = 55; BOOST_TEST(!f(ptr_hasher(&x), &x)); return boost::report_errors(); From 3ed0808377123f502352ccc82f23a83d9b3ea79e Mon Sep 17 00:00:00 2001 From: Daniel James Date: Mon, 17 Dec 2012 23:38:35 +0000 Subject: [PATCH 11/32] Hash: Stop using `-strict-ansi` for Intel. It doesn't seem to be compatible with C++11. [SVN r82060] --- hash/test/Jamfile.v2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 hash/test/Jamfile.v2 diff --git a/hash/test/Jamfile.v2 b/hash/test/Jamfile.v2 old mode 100644 new mode 100755 index 5325b19..2767bf3 --- a/hash/test/Jamfile.v2 +++ b/hash/test/Jamfile.v2 @@ -9,7 +9,7 @@ project hash-tests : requirements all intel:on - intel:-strict-ansi + #intel:-strict-ansi gcc:"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter -Wconversion -Wfloat-equal -Wshadow" darwin:"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter -Wconversion -Wfloat-equal -Wshadow" #msvc:on From 818b412673dd1273caae151f00223503921c8239 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Fri, 21 Dec 2012 09:50:01 +0000 Subject: [PATCH 12/32] Hash: Fix changelog for 1.53.0. [SVN r82140] --- hash/doc/changes.qbk | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/hash/doc/changes.qbk b/hash/doc/changes.qbk index b20e58d..80cb06b 100644 --- a/hash/doc/changes.qbk +++ b/hash/doc/changes.qbk @@ -142,13 +142,16 @@ [h2 Boost 1.52.0] * Restore `enum` support, which was accidentally removed in the last version. +* New floating point hasher - will hash the binary representation on more + platforms, which should be faster. + +[h2 Boost 1.53.0] + * Add support for `boost::int128_type` and `boost::uint128_type` where available - currently only `__int128` and `unsigned __int128` on some versions of gcc. -* New floating point hasher - will hash the binary representation on more - platforms, which should be faster. -* On platforms that are known to have standard floating point, don't use the - automatic detection of floating point functions - which can break if there - are ambiguous overloads. +* On platforms that are known to have the standard floating point functions, + don't use automatic detection - which can break if there are ambiguous + overloads. [endsect] From 7cc6744ff63679a75f010dd3cd1c1d1e21cc70b1 Mon Sep 17 00:00:00 2001 From: Thomas Heller Date: Thu, 27 Dec 2012 10:49:19 +0000 Subject: [PATCH 13/32] Fixing UB by using memcpy instead of old style cast [SVN r82218] --- include/boost/functional/hash/detail/hash_float.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/boost/functional/hash/detail/hash_float.hpp b/include/boost/functional/hash/detail/hash_float.hpp index 5e20b9c..a98cd70 100644 --- a/include/boost/functional/hash/detail/hash_float.hpp +++ b/include/boost/functional/hash/detail/hash_float.hpp @@ -73,7 +73,9 @@ namespace boost ptr += sizeof(std::size_t); while(length >= sizeof(std::size_t)) { - hash_float_combine(seed, *(std::size_t*) ptr); + std::size_t buffer = 0; + std::memcpy(&buffer, ptr, sizeof(std::size_t)); + hash_float_combine(seed, buffer); length -= sizeof(std::size_t); ptr += sizeof(std::size_t); } From b0dac159c29d242765da0b51c48cabe4e0a29409 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sat, 29 Dec 2012 11:09:35 +0000 Subject: [PATCH 14/32] Hash: Changelog for undefined behaviour fix. [SVN r82255] --- hash/doc/changes.qbk | 1 + 1 file changed, 1 insertion(+) diff --git a/hash/doc/changes.qbk b/hash/doc/changes.qbk index 80cb06b..2334b15 100644 --- a/hash/doc/changes.qbk +++ b/hash/doc/changes.qbk @@ -153,5 +153,6 @@ * On platforms that are known to have the standard floating point functions, don't use automatic detection - which can break if there are ambiguous overloads. +* Fix undefined behaviour when using the binary float hash (Thomas Heller). [endsect] From 9c8cccb1ea154e194585a770b0912528a57d3c78 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Thu, 31 Jan 2013 21:57:26 +0000 Subject: [PATCH 15/32] Hash: Fix typo, refs #7957. [SVN r82674] --- hash/doc/rationale.qbk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hash/doc/rationale.qbk b/hash/doc/rationale.qbk index ab03d8b..8621081 100644 --- a/hash/doc/rationale.qbk +++ b/hash/doc/rationale.qbk @@ -38,7 +38,7 @@ function, such as [@http://www.concentric.net/~ttwang/tech/inthash.htm Thomas Wang's hash function]. This this may not work as well as a hash algorithm tailored for the input. -For strings that are several fast, high quality hash functions +For strings there are several fast, high quality hash functions available (for example [@http://code.google.com/p/smhasher/ MurmurHash3] and [@http://code.google.com/p/cityhash/ Google's CityHash]), although they tend to be more machine specific. From bea58b915d9121d6d5f9e8907070f0b2690aa71d Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sat, 25 May 2013 15:45:51 +0000 Subject: [PATCH 16/32] Change log entries for 1.54.0 [SVN r84496] --- hash/doc/changes.qbk | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hash/doc/changes.qbk b/hash/doc/changes.qbk index 2334b15..4ca0814 100644 --- a/hash/doc/changes.qbk +++ b/hash/doc/changes.qbk @@ -155,4 +155,9 @@ overloads. * Fix undefined behaviour when using the binary float hash (Thomas Heller). +[h2 Boost 1.54.0] + +* [@https://svn.boost.org/trac/boost/ticket/7957 Ticket 7957]: + Fixed a typo. + [endsect] From f0476bf7b7a62546fab9ea2972ce29519f644f4b Mon Sep 17 00:00:00 2001 From: Daniel James Date: Thu, 30 May 2013 08:27:46 +0000 Subject: [PATCH 17/32] Some typos. [SVN r84550] --- factory/doc/factory.qbk | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/factory/doc/factory.qbk b/factory/doc/factory.qbk index 2f92f69..7aa3faf 100644 --- a/factory/doc/factory.qbk +++ b/factory/doc/factory.qbk @@ -131,18 +131,18 @@ but the approach remains inflexible: * finally we might want to use customized memory management. Experience has shown that using function objects and generic Boost components -for their composition, Design Patterns that describe callback mechasisms +for their composition, Design Patterns that describe callback mechanisms (typically requiring a high percentage of boilerplate code with pure Object Oriented methodology) become implementable with just few code lines and without extra classes. Factories are callback mechanisms for constructors, so we provide two class -templates, __boost__value_factory__ and __boost__factory__, that encasulate +templates, __boost__value_factory__ and __boost__factory__, that encapsulate object construction via direct application of the constructor and the `new` operator, respectively. We let the function objects forward their arguments to the construction -expressions they encapsulate. Overthis __boost__factory__ optionally allows +expressions they encapsulate. Over this __boost__factory__ optionally allows the use of smart pointers and __std_allocators__. Compile-time polymorphism can be used where appropriate, @@ -158,7 +158,7 @@ Compile-time polymorphism can be used where appropriate, // [...] } -Now, to allow inhomogenous signaturs for the constructors of the types passed +Now, to allow inhomogeneous signatures for the constructors of the types passed in for `T` we can use __value_factory__ and __boost__bind__ to normalize between them. @@ -301,7 +301,7 @@ constructor, such as __boost__shared_ptr__). If a third template argument is `factory_passes_alloc_to_smart_pointer`, the allocator itself is used for the third constructor argument of `Pointer` (__boost__shared_ptr__ then uses the allocator to manage the memory of its -seperately allocated reference counter). +separately allocated reference counter). [heading Header] #include From e22bf89f4751a9fe25f584f8d49d9b8657867898 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Thu, 30 May 2013 17:54:40 +0000 Subject: [PATCH 18/32] Remove generated documentation from forward and factory. Will add to the build. [SVN r84558] --- factory/doc/html/boostbook.css | 528 --------------------------- factory/doc/html/index.html | 630 +-------------------------------- forward/doc/html/boostbook.css | 528 --------------------------- forward/doc/html/index.html | 574 +----------------------------- 4 files changed, 26 insertions(+), 2234 deletions(-) delete mode 100644 factory/doc/html/boostbook.css delete mode 100644 forward/doc/html/boostbook.css diff --git a/factory/doc/html/boostbook.css b/factory/doc/html/boostbook.css deleted file mode 100644 index 858d43c..0000000 --- a/factory/doc/html/boostbook.css +++ /dev/null @@ -1,528 +0,0 @@ -/*============================================================================= - Copyright (c) 2004 Joel de Guzman - http://spirit.sourceforge.net/ - - Use, modification and distribution is 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) -=============================================================================*/ - -/*============================================================================= - Body defaults -=============================================================================*/ - - body - { - margin: 1em; - font-family: sans-serif; - } - -/*============================================================================= - Paragraphs -=============================================================================*/ - - p - { - text-align: left; - font-size: 10pt; - line-height: 1.15; - } - -/*============================================================================= - Program listings -=============================================================================*/ - - /* Code on paragraphs */ - p tt.computeroutput - { - font-size: 9pt; - } - - pre.synopsis - { - font-size: 90%; - margin: 1pc 4% 0pc 4%; - padding: 0.5pc 0.5pc 0.5pc 0.5pc; - } - - .programlisting, - .screen - { - font-size: 9pt; - display: block; - margin: 1pc 4% 0pc 4%; - padding: 0.5pc 0.5pc 0.5pc 0.5pc; - } - - /* Program listings in tables don't get borders */ - td .programlisting, - td .screen - { - margin: 0pc 0pc 0pc 0pc; - padding: 0pc 0pc 0pc 0pc; - } - -/*============================================================================= - Headings -=============================================================================*/ - - h1, h2, h3, h4, h5, h6 - { - text-align: left; - margin: 1em 0em 0.5em 0em; - font-weight: bold; - } - - h1 { font: 140% } - h2 { font: bold 140% } - h3 { font: bold 130% } - h4 { font: bold 120% } - h5 { font: italic 110% } - h6 { font: italic 100% } - - /* Top page titles */ - title, - h1.title, - h2.title - h3.title, - h4.title, - h5.title, - h6.title, - .refentrytitle - { - font-weight: bold; - margin-bottom: 1pc; - } - - h1.title { font-size: 140% } - h2.title { font-size: 140% } - h3.title { font-size: 130% } - h4.title { font-size: 120% } - h5.title { font-size: 110% } - h6.title { font-size: 100% } - - .section h1 - { - margin: 0em 0em 0.5em 0em; - font-size: 140%; - } - - .section h2 { font-size: 140% } - .section h3 { font-size: 130% } - .section h4 { font-size: 120% } - .section h5 { font-size: 110% } - .section h6 { font-size: 100% } - - /* Code on titles */ - h1 tt.computeroutput { font-size: 140% } - h2 tt.computeroutput { font-size: 140% } - h3 tt.computeroutput { font-size: 130% } - h4 tt.computeroutput { font-size: 120% } - h5 tt.computeroutput { font-size: 110% } - h6 tt.computeroutput { font-size: 100% } - -/*============================================================================= - Author -=============================================================================*/ - - h3.author - { - font-size: 100% - } - -/*============================================================================= - Lists -=============================================================================*/ - - li - { - font-size: 10pt; - line-height: 1.3; - } - - /* Unordered lists */ - ul - { - text-align: left; - } - - /* Ordered lists */ - ol - { - text-align: left; - } - -/*============================================================================= - Links -=============================================================================*/ - - a - { - text-decoration: none; /* no underline */ - } - - a:hover - { - text-decoration: underline; - } - -/*============================================================================= - Spirit style navigation -=============================================================================*/ - - .spirit-nav - { - text-align: right; - } - - .spirit-nav a - { - color: white; - padding-left: 0.5em; - } - - .spirit-nav img - { - border-width: 0px; - } - -/*============================================================================= - Table of contents -=============================================================================*/ - - .toc - { - margin: 1pc 4% 0pc 4%; - padding: 0.1pc 1pc 0.1pc 1pc; - font-size: 80%; - line-height: 1.15; - } - - .boost-toc - { - float: right; - padding: 0.5pc; - } - -/*============================================================================= - Tables -=============================================================================*/ - - .table-title, - div.table p.title - { - margin-left: 4%; - padding-right: 0.5em; - padding-left: 0.5em; - } - - .informaltable table, - .table table - { - width: 92%; - margin-left: 4%; - margin-right: 4%; - } - - div.informaltable table, - div.table table - { - padding: 4px; - } - - /* Table Cells */ - div.informaltable table tr td, - div.table table tr td - { - padding: 0.5em; - text-align: left; - font-size: 9pt; - } - - div.informaltable table tr th, - div.table table tr th - { - padding: 0.5em 0.5em 0.5em 0.5em; - border: 1pt solid white; - font-size: 80%; - } - -/*============================================================================= - Blurbs -=============================================================================*/ - - div.note, - div.tip, - div.important, - div.caution, - div.warning, - div.sidebar - { - font-size: 9pt; /* A little bit smaller than the main text */ - line-height: 1.2; - display: block; - margin: 1pc 4% 0pc 4%; - padding: 0.5pc 0.5pc 0.0pc 0.5pc; - } - - div.sidebar img - { - padding: 1pt; - } - -/*============================================================================= - Callouts -=============================================================================*/ - .line_callout_bug img - { - float: left; - position:relative; - left: 4px; - top: -12px; - clear: left; - margin-left:-22px; - } - - .callout_bug img - { - } - -/*============================================================================= - Variable Lists -=============================================================================*/ - - /* Make the terms in definition lists bold */ - div.variablelist dl dt, - span.term - { - font-weight: bold; - font-size: 10pt; - } - - div.variablelist table tbody tr td - { - text-align: left; - vertical-align: top; - padding: 0em 2em 0em 0em; - font-size: 10pt; - margin: 0em 0em 0.5em 0em; - line-height: 1; - } - - div.variablelist dl dt - { - margin-bottom: 0.2em; - } - - div.variablelist dl dd - { - margin: 0em 0em 0.5em 2em; - font-size: 10pt; - } - - div.variablelist table tbody tr td p, - div.variablelist dl dd p - { - margin: 0em 0em 0.5em 0em; - line-height: 1; - } - -/*============================================================================= - Misc -=============================================================================*/ - - /* Title of books and articles in bibliographies */ - span.title - { - font-style: italic; - } - - span.underline - { - text-decoration: underline; - } - - span.strikethrough - { - text-decoration: line-through; - } - - /* Copyright, Legal Notice */ - div div.legalnotice p - { - text-align: left - } - -/*============================================================================= - Colors -=============================================================================*/ - - @media screen - { - /* Links */ - a - { - color: #005a9c; - } - - a:visited - { - color: #9c5a9c; - } - - h1 a, h2 a, h3 a, h4 a, h5 a, h6 a, - h1 a:hover, h2 a:hover, h3 a:hover, h4 a:hover, h5 a:hover, h6 a:hover, - h1 a:visited, h2 a:visited, h3 a:visited, h4 a:visited, h5 a:visited, h6 a:visited - { - text-decoration: none; /* no underline */ - color: #000000; - } - - /* Syntax Highlighting */ - .keyword { color: #0000AA; } - .identifier { color: #000000; } - .special { color: #707070; } - .preprocessor { color: #402080; } - .char { color: teal; } - .comment { color: #800000; } - .string { color: teal; } - .number { color: teal; } - .white_bkd { background-color: #FFFFFF; } - .dk_grey_bkd { background-color: #999999; } - - /* Copyright, Legal Notice */ - .copyright - { - color: #666666; - font-size: small; - } - - div div.legalnotice p - { - color: #666666; - } - - /* Program listing */ - pre.synopsis - { - border: 1px solid #DCDCDC; - } - - .programlisting, - .screen - { - border: 1px solid #DCDCDC; - } - - td .programlisting, - td .screen - { - border: 0px solid #DCDCDC; - } - - /* Blurbs */ - div.note, - div.tip, - div.important, - div.caution, - div.warning, - div.sidebar - { - border: 1px solid #DCDCDC; - } - - /* Table of contents */ - .toc - { - border: 1px solid #DCDCDC; - } - - /* Tables */ - div.informaltable table tr td, - div.table table tr td - { - border: 1px solid #DCDCDC; - } - - div.informaltable table tr th, - div.table table tr th - { - background-color: #F0F0F0; - border: 1px solid #DCDCDC; - } - - /* Misc */ - span.highlight - { - color: #00A000; - } - } - - @media print - { - /* Links */ - a - { - color: black; - } - - a:visited - { - color: black; - } - - .spirit-nav - { - display: none; - } - - /* Program listing */ - pre.synopsis - { - border: 1px solid gray; - } - - .programlisting, - .screen - { - border: 1px solid gray; - } - - td .programlisting, - td .screen - { - border: 0px solid #DCDCDC; - } - - /* Table of contents */ - .toc - { - border: 1px solid gray; - } - - .informaltable table, - .table table - { - border: 1px solid gray; - border-collapse: collapse; - } - - /* Tables */ - div.informaltable table tr td, - div.table table tr td - { - border: 1px solid gray; - } - - div.informaltable table tr th, - div.table table tr th - { - border: 1px solid gray; - } - - /* Misc */ - span.highlight - { - font-weight: bold; - } - } diff --git a/factory/doc/html/index.html b/factory/doc/html/index.html index 9b9542a..83a3266 100644 --- a/factory/doc/html/index.html +++ b/factory/doc/html/index.html @@ -1,620 +1,16 @@ + - - -Chapter 1. Boost.Functional/Factory 1.0 - - - - - - - - - - - - -
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
-
-
-
-
-

-Chapter 1. Boost.Functional/Factory 1.0

-

-Tobias Schwinger -

-
-
-

- 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) -

-
-
- -
- -

- The template boost::factory lets you encapsulate a new expression as a function object, boost::value_factory - encapsulates a constructor invocation without new. -

-
boost::factory<T*>()(arg1,arg2,arg3) 
-// same as new T(arg1,arg2,arg3)
-
-boost::value_factory<T>()(arg1,arg2,arg3)
-// same as T(arg1,arg2,arg3)
-
-

- For technical reasons the arguments to the function objects have to be LValues. - A factory that also accepts RValues can be composed using the boost::forward_adapter - or boost::bind. -

-
-
- -

- In traditional Object Oriented Programming a Factory is an object implementing - an interface of one or more methods that construct objects conforming to known - interfaces. -

-
// assuming a_concrete_class and another_concrete_class are derived
-// from an_abstract_class
-
-class a_factory
-{
-  public:
-    virtual an_abstract_class* create() const = 0;
-    virtual ~a_factory() { }
-};
+  
+  
+    Redirect to generated documentation
+    
+  
+  
+    Automatic redirection failed, please go to
+    http://boost-sandbox.sourceforge.net/libs/functional/factory/doc/html/
+  
 
diff --git a/forward/doc/html/boostbook.css b/forward/doc/html/boostbook.css
deleted file mode 100644
index 858d43c..0000000
--- a/forward/doc/html/boostbook.css
+++ /dev/null
@@ -1,528 +0,0 @@
-/*=============================================================================
-    Copyright (c) 2004 Joel de Guzman
-    http://spirit.sourceforge.net/
-
-    Use, modification and distribution is 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)
-=============================================================================*/
-
-/*=============================================================================
-    Body defaults
-=============================================================================*/
-
-    body
-    {
-        margin: 1em;
-        font-family: sans-serif;
-    }
-
-/*=============================================================================
-    Paragraphs
-=============================================================================*/
-
-    p
-    {
-        text-align: left;
-        font-size: 10pt;
-        line-height: 1.15;
-    }
-
-/*=============================================================================
-    Program listings
-=============================================================================*/
-
-    /* Code on paragraphs */
-    p tt.computeroutput
-    {
-        font-size: 9pt;
-    }
-
-    pre.synopsis
-    {
-        font-size: 90%;
-        margin: 1pc 4% 0pc 4%;
-        padding: 0.5pc 0.5pc 0.5pc 0.5pc;
-    }
-
-    .programlisting,
-    .screen
-    {
-        font-size: 9pt;
-        display: block;
-        margin: 1pc 4% 0pc 4%;
-        padding: 0.5pc 0.5pc 0.5pc 0.5pc;
-    }
-
-    /* Program listings in tables don't get borders */
-    td .programlisting,
-    td .screen
-    {
-        margin: 0pc 0pc 0pc 0pc;
-        padding:  0pc 0pc 0pc 0pc;
-    }
-
-/*=============================================================================
-    Headings
-=============================================================================*/
-
-    h1, h2, h3, h4, h5, h6
-    {
-        text-align: left;
-        margin: 1em 0em 0.5em 0em;
-        font-weight: bold;
-    }
-
-    h1 { font: 140% }
-    h2 { font: bold 140% }
-    h3 { font: bold 130% }
-    h4 { font: bold 120% }
-    h5 { font: italic 110% }
-    h6 { font: italic 100% }
-
-    /* Top page titles */
-    title,
-    h1.title,
-    h2.title
-    h3.title,
-    h4.title,
-    h5.title,
-    h6.title,
-    .refentrytitle
-    {
-        font-weight: bold;
-        margin-bottom: 1pc;
-    }
-
-    h1.title { font-size: 140% }
-    h2.title { font-size: 140% }
-    h3.title { font-size: 130% }
-    h4.title { font-size: 120% }
-    h5.title { font-size: 110% }
-    h6.title { font-size: 100% }
-
-    .section h1
-    {
-        margin: 0em 0em 0.5em 0em;
-        font-size: 140%;
-    }
-
-    .section h2 { font-size: 140% }
-    .section h3 { font-size: 130% }
-    .section h4 { font-size: 120% }
-    .section h5 { font-size: 110% }
-    .section h6 { font-size: 100% }
-
-    /* Code on titles */
-    h1 tt.computeroutput { font-size: 140% }
-    h2 tt.computeroutput { font-size: 140% }
-    h3 tt.computeroutput { font-size: 130% }
-    h4 tt.computeroutput { font-size: 120% }
-    h5 tt.computeroutput { font-size: 110% }
-    h6 tt.computeroutput { font-size: 100% }
-
-/*=============================================================================
-    Author
-=============================================================================*/
-
-    h3.author
-    {
-        font-size: 100%
-    }
-
-/*=============================================================================
-    Lists
-=============================================================================*/
-
-    li
-    {
-        font-size: 10pt;
-        line-height: 1.3;
-    }
-
-    /* Unordered lists */
-    ul
-    {
-        text-align: left;
-    }
-
-    /* Ordered lists */
-    ol
-    {
-        text-align: left;
-    }
-
-/*=============================================================================
-    Links
-=============================================================================*/
-
-    a
-    {
-        text-decoration: none; /* no underline */
-    }
-
-    a:hover
-    {
-        text-decoration: underline;
-    }
-
-/*=============================================================================
-    Spirit style navigation
-=============================================================================*/
-
-    .spirit-nav
-    {
-        text-align: right;
-    }
-
-    .spirit-nav a
-    {
-        color: white;
-        padding-left: 0.5em;
-    }
-
-    .spirit-nav img
-    {
-        border-width: 0px;
-    }
-
-/*=============================================================================
-    Table of contents
-=============================================================================*/
-
-    .toc
-    {
-       margin: 1pc 4% 0pc 4%;
-       padding: 0.1pc 1pc 0.1pc 1pc;
-       font-size: 80%;
-       line-height: 1.15;
-    }
-
-    .boost-toc
-    {
-       float: right;
-       padding: 0.5pc;
-    }
-
-/*=============================================================================
-    Tables
-=============================================================================*/
-
-    .table-title,
-    div.table p.title
-    {
-        margin-left: 4%;
-        padding-right: 0.5em;
-        padding-left: 0.5em;
-    }
-
-    .informaltable table,
-    .table table
-    {
-        width: 92%;
-        margin-left: 4%;
-        margin-right: 4%;
-    }
-
-    div.informaltable table,
-    div.table table
-    {
-        padding: 4px;
-    }
-
-    /* Table Cells */
-    div.informaltable table tr td,
-    div.table table tr td
-    {
-        padding: 0.5em;
-        text-align: left;
-        font-size: 9pt;
-    }
-
-    div.informaltable table tr th,
-    div.table table tr th
-    {
-        padding: 0.5em 0.5em 0.5em 0.5em;
-        border: 1pt solid white;
-        font-size: 80%;
-    }
-
-/*=============================================================================
-    Blurbs
-=============================================================================*/
-
-    div.note,
-    div.tip,
-    div.important,
-    div.caution,
-    div.warning,
-    div.sidebar
-    {
-        font-size: 9pt; /* A little bit smaller than the main text */
-        line-height: 1.2;
-        display: block;
-        margin: 1pc 4% 0pc 4%;
-        padding: 0.5pc 0.5pc 0.0pc 0.5pc;
-    }
-
-    div.sidebar img
-    {
-        padding: 1pt;
-    }
-
-/*=============================================================================
-    Callouts
-=============================================================================*/
-    .line_callout_bug img
-    {
-        float: left;
-        position:relative;
-        left: 4px;
-        top: -12px;
-        clear: left;
-        margin-left:-22px;
-    }
-
-    .callout_bug img
-    {
-    }
-
-/*=============================================================================
-    Variable Lists
-=============================================================================*/
-
-    /* Make the terms in definition lists bold */
-    div.variablelist dl dt,
-    span.term
-    {
-        font-weight: bold;
-        font-size: 10pt;
-    }
-
-    div.variablelist table tbody tr td
-    {
-        text-align: left;
-        vertical-align: top;
-        padding: 0em 2em 0em 0em;
-        font-size: 10pt;
-        margin: 0em 0em 0.5em 0em;
-        line-height: 1;
-    }
-
-    div.variablelist dl dt
-    {
-        margin-bottom: 0.2em;
-    }
-
-    div.variablelist dl dd
-    {
-        margin: 0em 0em 0.5em 2em;
-        font-size: 10pt;
-    }
-
-    div.variablelist table tbody tr td p,
-    div.variablelist dl dd p
-    {
-        margin: 0em 0em 0.5em 0em;
-        line-height: 1;
-    }
-
-/*=============================================================================
-    Misc
-=============================================================================*/
-
-    /* Title of books and articles in bibliographies */
-    span.title
-    {
-        font-style: italic;
-    }
-
-    span.underline
-    {
-        text-decoration: underline;
-    }
-
-    span.strikethrough
-    {
-        text-decoration: line-through;
-    }
-
-    /* Copyright, Legal Notice */
-    div div.legalnotice p
-    {
-        text-align: left
-    }
-
-/*=============================================================================
-    Colors
-=============================================================================*/
-
-    @media screen
-    {
-    /* Links */
-        a
-        {
-            color: #005a9c;
-        }
-
-        a:visited
-        {
-            color: #9c5a9c;
-        }
-
-        h1 a, h2 a, h3 a, h4 a, h5 a, h6 a,
-        h1 a:hover, h2 a:hover, h3 a:hover, h4 a:hover, h5 a:hover, h6 a:hover,
-        h1 a:visited, h2 a:visited, h3 a:visited, h4 a:visited, h5 a:visited, h6 a:visited
-        {
-            text-decoration: none; /* no underline */
-            color: #000000;
-        }
-
-    /* Syntax Highlighting */
-        .keyword        { color: #0000AA; }
-        .identifier     { color: #000000; }
-        .special        { color: #707070; }
-        .preprocessor   { color: #402080; }
-        .char           { color: teal; }
-        .comment        { color: #800000; }
-        .string         { color: teal; }
-        .number         { color: teal; }
-        .white_bkd      { background-color: #FFFFFF; }
-        .dk_grey_bkd    { background-color: #999999; }
-
-    /* Copyright, Legal Notice */
-        .copyright
-        {
-            color: #666666;
-            font-size: small;
-        }
-
-        div div.legalnotice p
-        {
-            color: #666666;
-        }
-
-    /* Program listing */
-        pre.synopsis
-        {
-            border: 1px solid #DCDCDC;
-        }
-
-        .programlisting,
-        .screen
-        {
-            border: 1px solid #DCDCDC;
-        }
-
-        td .programlisting,
-        td .screen
-        {
-            border: 0px solid #DCDCDC;
-        }
-
-    /* Blurbs */
-        div.note,
-        div.tip,
-        div.important,
-        div.caution,
-        div.warning,
-        div.sidebar
-        {
-            border: 1px solid #DCDCDC;
-        }
-
-    /* Table of contents */
-        .toc
-        {
-            border: 1px solid #DCDCDC;
-        }
-
-    /* Tables */
-        div.informaltable table tr td,
-        div.table table tr td
-        {
-            border: 1px solid #DCDCDC;
-        }
-
-        div.informaltable table tr th,
-        div.table table tr th
-        {
-            background-color: #F0F0F0;
-            border: 1px solid #DCDCDC;
-        }
-
-    /* Misc */
-        span.highlight
-        {
-            color: #00A000;
-        }
-    }
-
-    @media print
-    {
-    /* Links */
-        a
-        {
-            color: black;
-        }
-
-        a:visited
-        {
-            color: black;
-        }
-
-        .spirit-nav
-        {
-            display: none;
-        }
-
-    /* Program listing */
-        pre.synopsis
-        {
-            border: 1px solid gray;
-        }
-
-        .programlisting,
-        .screen
-        {
-            border: 1px solid gray;
-        }
-
-        td .programlisting,
-        td .screen
-        {
-            border: 0px solid #DCDCDC;
-        }
-
-    /* Table of contents */
-        .toc
-        {
-            border: 1px solid gray;
-        }
-
-        .informaltable table,
-        .table table
-        {
-            border: 1px solid gray;
-            border-collapse: collapse;
-        }
-
-    /* Tables */
-        div.informaltable table tr td,
-        div.table table tr td
-        {
-            border: 1px solid gray;
-        }
-
-        div.informaltable table tr th,
-        div.table table tr th
-        {
-            border: 1px solid gray;
-        }
-
-    /* Misc */
-        span.highlight
-        {
-            font-weight: bold;
-        }
-    }
diff --git a/forward/doc/html/index.html b/forward/doc/html/index.html
index e82fe81..0e7fad9 100644
--- a/forward/doc/html/index.html
+++ b/forward/doc/html/index.html
@@ -1,564 +1,16 @@
+
 
-
-
-Chapter 1. Boost.Functional/Forward 1.0
-
-
-
-
-
-
-
-
-
-
-
-
-
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
-
-
-
-
-

-Chapter 1. Boost.Functional/Forward 1.0

-

-Tobias Schwinger -

-
-
-

- 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) -

-
-
- -
- -

- boost::forward_adapter provides a reusable adapter - template for function objects. It forwards RValues as references to const, - while leaving LValues as-is. -

-
struct g // function object that only accept LValues
-{
-    template< typename T0, typename T1, typename T2 >
-    void operator()(T0 & t0, T1 & t1, T2 & t2) const;
+  
+  
+    Redirect to generated documentation
+    
+  
+  
+    Automatic redirection failed, please go to
+    http://boost-sandbox.sourceforge.net/libs/functional/forward/doc/html/
+  
 

From 670e7b3736d8c7cba1cb640d98dc7d9b1f023788 Mon Sep 17 00:00:00 2001
From: Daniel James 
Date: Thu, 8 Aug 2013 20:30:04 +0000
Subject: [PATCH 19/32] Simpler test for appropriate floats for binary hashing.
 Refs #8822.

No idea if this will actually fix it.

[SVN r85246]
---
 .../functional/hash/detail/hash_float.hpp     | 31 ++++++++-----------
 1 file changed, 13 insertions(+), 18 deletions(-)

diff --git a/include/boost/functional/hash/detail/hash_float.hpp b/include/boost/functional/hash/detail/hash_float.hpp
index a98cd70..2ac22da 100644
--- a/include/boost/functional/hash/detail/hash_float.hpp
+++ b/include/boost/functional/hash/detail/hash_float.hpp
@@ -90,15 +90,20 @@ namespace boost
             return seed;
         }
 
+        template 
+        struct enable_binary_hash
+        {
+            BOOST_STATIC_CONSTANT(bool, value =
+                std::numeric_limits::is_iec559 &&
+                std::numeric_limits::digits == digits &&
+                std::numeric_limits::radix == 2 &&
+                std::numeric_limits::max_exponent == max_exponent);
+        };
+
         template 
         inline std::size_t float_hash_impl(Float v,
             BOOST_DEDUCED_TYPENAME boost::enable_if_c<
-                std::numeric_limits::is_iec559 &&
-                std::numeric_limits::digits == 24 &&
-                std::numeric_limits::radix == 2 &&
-                std::numeric_limits::max_exponent == 128,
-                int>::type
-            )
+                enable_binary_hash::value, int>::type)
         {
             return hash_binary((char*) &v, 4);
         }
@@ -107,12 +112,7 @@ namespace boost
         template 
         inline std::size_t float_hash_impl(Float v,
             BOOST_DEDUCED_TYPENAME boost::enable_if_c<
-                std::numeric_limits::is_iec559 &&
-                std::numeric_limits::digits == 53 &&
-                std::numeric_limits::radix == 2 &&
-                std::numeric_limits::max_exponent == 1024,
-                int>::type
-            )
+                enable_binary_hash::value, int>::type)
         {
             return hash_binary((char*) &v, 8);
         }
@@ -120,12 +120,7 @@ namespace boost
         template 
         inline std::size_t float_hash_impl(Float v,
             BOOST_DEDUCED_TYPENAME boost::enable_if_c<
-                std::numeric_limits::is_iec559 &&
-                std::numeric_limits::digits == 64 &&
-                std::numeric_limits::radix == 2 &&
-                std::numeric_limits::max_exponent == 16384,
-                int>::type
-            )
+                enable_binary_hash::value, int>::type)
         {
             return hash_binary((char*) &v, 10);
         }

From b1790e463e0120713604274e1dfda39f7d84ad76 Mon Sep 17 00:00:00 2001
From: Daniel James 
Date: Thu, 8 Aug 2013 22:01:18 +0000
Subject: [PATCH 20/32] Fix Visual C++ warning in hash. Refs #8568.

I changed this a little from the patch on #8568. I moved the pragmas to the
start and end of the file because I don't like to little the body of the code
with them (this does mean I've disabled a potentially useful warning, but the
code is pretty stable nowadays).

I also removed the version checks, as the warning should be present in later
versions.


[SVN r85248]
---
 include/boost/functional/hash/hash.hpp | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/include/boost/functional/hash/hash.hpp b/include/boost/functional/hash/hash.hpp
index aa4e49f..0adf9c9 100644
--- a/include/boost/functional/hash/hash.hpp
+++ b/include/boost/functional/hash/hash.hpp
@@ -27,6 +27,13 @@
 #include 
 #endif
 
+#if defined(BOOST_MSVC)
+#pragma warning(push)
+#pragma warning(disable:6295) // Ill-defined for-loop : 'unsigned int' values
+                              // are always of range '0' to '4294967295'.
+                              // Loop executes infinitely.
+#endif
+
 #if BOOST_WORKAROUND(__GNUC__, < 3) \
     && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)
 #define BOOST_HASH_CHAR_TRAITS string_char_traits
@@ -518,6 +525,10 @@ namespace boost
 
 #undef BOOST_HASH_CHAR_TRAITS
 
+#if defined(BOOST_MSVC)
+#pragma warning(pop)
+#endif
+
 #endif // BOOST_FUNCTIONAL_HASH_HASH_HPP
 
 // Include this outside of the include guards in case the file is included

From 29d746897993a64a23a8926a13a54ea93724a15d Mon Sep 17 00:00:00 2001
From: Stephen Kelly 
Date: Thu, 26 Sep 2013 13:02:51 +0000
Subject: [PATCH 21/32] Remove obsolete MSVC check from pragma guard

 git grep -h -B1 "^#\s*pragma once" | grep -v pragma | sort | uniq

is now clean.

[SVN r85952]
---
 include/boost/functional/hash/detail/float_functions.hpp | 2 +-
 include/boost/functional/hash/detail/hash_float.hpp      | 2 +-
 include/boost/functional/hash/detail/limits.hpp          | 2 +-
 include/boost/functional/hash/extensions.hpp             | 2 +-
 include/boost/functional/hash/hash_fwd.hpp               | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/boost/functional/hash/detail/float_functions.hpp b/include/boost/functional/hash/detail/float_functions.hpp
index 4b8374d..648b433 100644
--- a/include/boost/functional/hash/detail/float_functions.hpp
+++ b/include/boost/functional/hash/detail/float_functions.hpp
@@ -9,7 +9,7 @@
 #include 
 #include 
 
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+#if defined(_MSC_VER)
 # pragma once
 #endif
 
diff --git a/include/boost/functional/hash/detail/hash_float.hpp b/include/boost/functional/hash/detail/hash_float.hpp
index 2ac22da..7e71aa0 100644
--- a/include/boost/functional/hash/detail/hash_float.hpp
+++ b/include/boost/functional/hash/detail/hash_float.hpp
@@ -6,7 +6,7 @@
 #if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_HEADER)
 #define BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_HEADER
 
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+#if defined(_MSC_VER)
 # pragma once
 #endif
 
diff --git a/include/boost/functional/hash/detail/limits.hpp b/include/boost/functional/hash/detail/limits.hpp
index f5b520e..e48b950 100644
--- a/include/boost/functional/hash/detail/limits.hpp
+++ b/include/boost/functional/hash/detail/limits.hpp
@@ -9,7 +9,7 @@
 #if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_LIMITS_HEADER)
 #define BOOST_FUNCTIONAL_HASH_DETAIL_LIMITS_HEADER
 
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+#if defined(_MSC_VER)
 # pragma once
 #endif
 
diff --git a/include/boost/functional/hash/extensions.hpp b/include/boost/functional/hash/extensions.hpp
index 998c08e..76b7d51 100644
--- a/include/boost/functional/hash/extensions.hpp
+++ b/include/boost/functional/hash/extensions.hpp
@@ -32,7 +32,7 @@
 #   include 
 #endif
 
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+#if defined(_MSC_VER)
 # pragma once
 #endif
 
diff --git a/include/boost/functional/hash/hash_fwd.hpp b/include/boost/functional/hash/hash_fwd.hpp
index 1d51b07..0422efd 100644
--- a/include/boost/functional/hash/hash_fwd.hpp
+++ b/include/boost/functional/hash/hash_fwd.hpp
@@ -10,7 +10,7 @@
 #if !defined(BOOST_FUNCTIONAL_HASH_FWD_HPP)
 #define BOOST_FUNCTIONAL_HASH_FWD_HPP
 
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+#if defined(_MSC_VER)
 # pragma once
 #endif
 

From e887c416a6aba0aaf7f98ca933ee678909604a24 Mon Sep 17 00:00:00 2001
From: Stephen Kelly 
Date: Mon, 30 Sep 2013 11:22:29 +0000
Subject: [PATCH 22/32] Functional: Remove obsolete MSVC version checks.

[SVN r86051]
---
 include/boost/functional/hash/extensions.hpp | 62 --------------------
 include/boost/functional/hash/hash.hpp       | 45 --------------
 include/boost/functional/hash/hash_fwd.hpp   |  4 --
 3 files changed, 111 deletions(-)

diff --git a/include/boost/functional/hash/extensions.hpp b/include/boost/functional/hash/extensions.hpp
index 76b7d51..8b60076 100644
--- a/include/boost/functional/hash/extensions.hpp
+++ b/include/boost/functional/hash/extensions.hpp
@@ -40,10 +40,6 @@
 #include 
 #endif
 
-#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
-#include 
-#endif
-
 namespace boost
 {
     template 
@@ -232,11 +228,7 @@ namespace boost
             template 
             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);
@@ -298,8 +290,6 @@ namespace boost
         template 
         struct hash_impl;
 
-#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
-
         template <>
         struct hash_impl
         {
@@ -320,58 +310,6 @@ namespace boost
 #endif
             };
         };
-
-#else // Visual C++ 6.5
-
-        // Visual C++ 6.5 has problems with nested member functions and
-        // applying const to const types in templates. So we get this:
-
-        template 
-        struct hash_impl_msvc
-        {
-            template 
-            struct inner
-                : public std::unary_function
-            {
-                std::size_t operator()(T const& val) const
-                {
-                    return hash_detail::call_hash::call(val);
-                }
-
-                std::size_t operator()(T& val) const
-                {
-                    return hash_detail::call_hash::call(val);
-                }
-            };
-        };
-
-        template <>
-        struct hash_impl_msvc
-        {
-            template 
-            struct inner
-                : public std::unary_function
-            {
-                std::size_t operator()(T& val) const
-                {
-                    return hash_detail::call_hash::call(val);
-                }
-            };
-        };
-        
-        template 
-        struct hash_impl_msvc2
-            : public hash_impl_msvc::value>
-                    ::BOOST_NESTED_TEMPLATE inner {};
-        
-        template <>
-        struct hash_impl
-        {
-            template 
-            struct inner : public hash_impl_msvc2 {};
-        };
-
-#endif // Visual C++ 6.5
     }
 #endif  // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
 }
diff --git a/include/boost/functional/hash/hash.hpp b/include/boost/functional/hash/hash.hpp
index 0adf9c9..d8ea415 100644
--- a/include/boost/functional/hash/hash.hpp
+++ b/include/boost/functional/hash/hash.hpp
@@ -244,13 +244,8 @@ namespace boost
 #endif
 #endif
 
-#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
-    template 
-    inline void hash_combine(std::size_t& seed, T& v)
-#else
     template 
     inline void hash_combine(std::size_t& seed, T const& v)
-#endif
     {
         boost::hash hasher;
         seed ^= hasher(v) + 0x9e3779b9 + (seed<<6) + (seed>>2);
@@ -358,7 +353,6 @@ namespace boost
     //
     // These are undefined later.
 
-#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
 #define BOOST_HASH_SPECIALIZE(type) \
     template <> struct hash \
          : public std::unary_function \
@@ -378,45 +372,6 @@ namespace boost
             return boost::hash_value(v); \
         } \
     };
-#else
-#define BOOST_HASH_SPECIALIZE(type) \
-    template <> struct hash \
-         : public std::unary_function \
-    { \
-        std::size_t operator()(type v) const \
-        { \
-            return boost::hash_value(v); \
-        } \
-    }; \
-    \
-    template <> struct hash \
-         : public std::unary_function \
-    { \
-        std::size_t operator()(const type v) const \
-        { \
-            return boost::hash_value(v); \
-        } \
-    };
-
-#define BOOST_HASH_SPECIALIZE_REF(type) \
-    template <> struct hash \
-         : public std::unary_function \
-    { \
-        std::size_t operator()(type const& v) const \
-        { \
-            return boost::hash_value(v); \
-        } \
-    }; \
-    \
-    template <> struct hash \
-         : public std::unary_function \
-    { \
-        std::size_t operator()(type const& v) const \
-        { \
-            return boost::hash_value(v); \
-        } \
-    };
-#endif
 
     BOOST_HASH_SPECIALIZE(bool)
     BOOST_HASH_SPECIALIZE(char)
diff --git a/include/boost/functional/hash/hash_fwd.hpp b/include/boost/functional/hash/hash_fwd.hpp
index 0422efd..74dbaf8 100644
--- a/include/boost/functional/hash/hash_fwd.hpp
+++ b/include/boost/functional/hash/hash_fwd.hpp
@@ -22,11 +22,7 @@ namespace boost
 {
     template  struct hash;
 
-#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
-    template  void hash_combine(std::size_t& seed, T& v);
-#else
     template  void hash_combine(std::size_t& seed, T const& v);
-#endif
 
     template  std::size_t hash_range(It, It);
     template  void hash_range(std::size_t&, It, It);

From 6d25b771bda4dcf67b7087e821df5660169c7b3a Mon Sep 17 00:00:00 2001
From: Stephen Kelly 
Date: Tue, 1 Oct 2013 08:46:45 +0000
Subject: [PATCH 23/32] Functional: Remove obsolete GCC version checks.

[SVN r86112]
---
 include/boost/functional/hash/hash.hpp | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/include/boost/functional/hash/hash.hpp b/include/boost/functional/hash/hash.hpp
index d8ea415..0a43139 100644
--- a/include/boost/functional/hash/hash.hpp
+++ b/include/boost/functional/hash/hash.hpp
@@ -34,13 +34,6 @@
                               // Loop executes infinitely.
 #endif
 
-#if BOOST_WORKAROUND(__GNUC__, < 3) \
-    && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)
-#define BOOST_HASH_CHAR_TRAITS string_char_traits
-#else
-#define BOOST_HASH_CHAR_TRAITS char_traits
-#endif
-
 namespace boost
 {
     namespace hash_detail
@@ -135,7 +128,7 @@ namespace boost
 
     template 
     std::size_t hash_value(
-        std::basic_string, A> const&);
+        std::basic_string, A> const&);
 
     template 
     typename boost::hash_detail::float_numbers::type hash_value(T);
@@ -319,7 +312,7 @@ namespace boost
 
     template 
     inline std::size_t hash_value(
-        std::basic_string, A> const& v)
+        std::basic_string, A> const& v)
     {
         return hash_range(v.begin(), v.end());
     }
@@ -478,8 +471,6 @@ namespace boost
 #endif
 }
 
-#undef BOOST_HASH_CHAR_TRAITS
-
 #if defined(BOOST_MSVC)
 #pragma warning(pop)
 #endif

From 92e607de3493179b38a70e686bac305911fc9110 Mon Sep 17 00:00:00 2001
From: Daniel James 
Date: Sun, 6 Oct 2013 08:02:35 +0000
Subject: [PATCH 24/32] Simplify SFINAE for largest float overload. Refs #8822.

I accidentally missed it out. Also fix the return values.

[SVN r86172]
---
 .../boost/functional/hash/detail/hash_float.hpp | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/include/boost/functional/hash/detail/hash_float.hpp b/include/boost/functional/hash/detail/hash_float.hpp
index 7e71aa0..b2866f8 100644
--- a/include/boost/functional/hash/detail/hash_float.hpp
+++ b/include/boost/functional/hash/detail/hash_float.hpp
@@ -103,7 +103,8 @@ namespace boost
         template 
         inline std::size_t float_hash_impl(Float v,
             BOOST_DEDUCED_TYPENAME boost::enable_if_c<
-                enable_binary_hash::value, int>::type)
+                enable_binary_hash::value,
+                std::size_t>::type)
         {
             return hash_binary((char*) &v, 4);
         }
@@ -112,7 +113,8 @@ namespace boost
         template 
         inline std::size_t float_hash_impl(Float v,
             BOOST_DEDUCED_TYPENAME boost::enable_if_c<
-                enable_binary_hash::value, int>::type)
+                enable_binary_hash::value,
+                std::size_t>::type)
         {
             return hash_binary((char*) &v, 8);
         }
@@ -120,7 +122,8 @@ namespace boost
         template 
         inline std::size_t float_hash_impl(Float v,
             BOOST_DEDUCED_TYPENAME boost::enable_if_c<
-                enable_binary_hash::value, int>::type)
+                enable_binary_hash::value,
+                std::size_t>::type)
         {
             return hash_binary((char*) &v, 10);
         }
@@ -128,12 +131,8 @@ namespace boost
         template 
         inline std::size_t float_hash_impl(Float v,
             BOOST_DEDUCED_TYPENAME boost::enable_if_c<
-                std::numeric_limits::is_iec559 &&
-                std::numeric_limits::digits == 113 &&
-                std::numeric_limits::radix == 2 &&
-                std::numeric_limits::max_exponent == 16384,
-                int>::type
-            )
+                enable_binary_hash::value,
+                std::size_t>::type)
         {
             return hash_binary((char*) &v, 16);
         }

From 234384dbf084543b7ea59925935c35c0a46cd821 Mon Sep 17 00:00:00 2001
From: Daniel James 
Date: Sun, 6 Oct 2013 08:03:12 +0000
Subject: [PATCH 25/32] Change log.

[SVN r86173]
---
 hash/doc/changes.qbk | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/hash/doc/changes.qbk b/hash/doc/changes.qbk
index 4ca0814..c824e1a 100644
--- a/hash/doc/changes.qbk
+++ b/hash/doc/changes.qbk
@@ -3,6 +3,8 @@
  / 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) ]
 
+[template ticket[number]''''''#[number]'''''']
+
 [section:changes Change Log]
 
 [h2 Boost 1.33.0]
@@ -160,4 +162,11 @@
 * [@https://svn.boost.org/trac/boost/ticket/7957 Ticket 7957]:
   Fixed a typo.
 
+[h2 Boost 1.55.0]
+
+* Simplify a SFINAE check so that it will hopefully work on Sun 5.9
+  ([ticket 8822]).
+* Suppress Visual C++ infinite loop warning ([ticket 8568]).
+
+
 [endsect]

From 3ac96347ba5e6d1497d057f6881690a6ef04b3b6 Mon Sep 17 00:00:00 2001
From: Stephen Kelly 
Date: Fri, 11 Oct 2013 23:13:10 +0000
Subject: [PATCH 26/32] Remove BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION

Process #ifdef...#endif blocks.

[SVN r86243]
---
 include/boost/functional/hash/hash.hpp | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/include/boost/functional/hash/hash.hpp b/include/boost/functional/hash/hash.hpp
index 0a43139..6376706 100644
--- a/include/boost/functional/hash/hash.hpp
+++ b/include/boost/functional/hash/hash.hpp
@@ -19,9 +19,6 @@
 #include 
 #include 
 
-#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
-#include 
-#endif
 
 #if !defined(BOOST_NO_CXX11_HDR_TYPEINDEX)
 #include 

From dd73970b1ee8ab81bbe0adf9d9e9c1aa926978cc Mon Sep 17 00:00:00 2001
From: Stephen Kelly 
Date: Fri, 11 Oct 2013 23:17:48 +0000
Subject: [PATCH 27/32] Remove BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION

Process #ifndef...#else...#endif blocks.

[SVN r86245]
---
 include/boost/functional.hpp                 | 26 ------------
 include/boost/functional/hash/extensions.hpp | 34 ----------------
 include/boost/functional/hash/hash.hpp       | 43 --------------------
 3 files changed, 103 deletions(-)

diff --git a/include/boost/functional.hpp b/include/boost/functional.hpp
index b618485..c0cf503 100644
--- a/include/boost/functional.hpp
+++ b/include/boost/functional.hpp
@@ -18,7 +18,6 @@
 
 namespace boost
 {
-#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
     // --------------------------------------------------------------------------
     // The following traits classes allow us to avoid the need for ptr_fun
     // because the types of arguments and the result of a function can be 
@@ -116,31 +115,6 @@ namespace boost
         typedef A1 first_argument_type;
         typedef A2 second_argument_type;
     };
-#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
-    // --------------------------------------------------------------------------
-    // If we have no partial specialisation available, decay to a situation
-    // that is no worse than in the Standard, i.e., ptr_fun will be required.
-    // --------------------------------------------------------------------------
-
-    template 
-    struct unary_traits
-    {
-        typedef Operation                         function_type;
-        typedef const Operation&                  param_type;
-        typedef typename Operation::result_type   result_type;
-        typedef typename Operation::argument_type argument_type;
-    }; 
-    
-    template 
-    struct binary_traits
-    {
-        typedef Operation                                function_type;
-        typedef const Operation &                        param_type;
-        typedef typename Operation::result_type          result_type;
-        typedef typename Operation::first_argument_type  first_argument_type;
-        typedef typename Operation::second_argument_type second_argument_type;
-    };    
-#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
     
     // --------------------------------------------------------------------------
     // unary_negate, not1
diff --git a/include/boost/functional/hash/extensions.hpp b/include/boost/functional/hash/extensions.hpp
index 8b60076..e591f99 100644
--- a/include/boost/functional/hash/extensions.hpp
+++ b/include/boost/functional/hash/extensions.hpp
@@ -250,7 +250,6 @@ namespace boost
     //
 
 
-#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
 
     template  struct hash
         : std::unary_function
@@ -279,39 +278,6 @@ namespace boost
     };
 #endif
 
-#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
-
-    // On compilers without partial specialization, boost::hash
-    // has already been declared to deal with pointers, so just
-    // need to supply the non-pointer version of hash_impl.
-
-    namespace hash_detail
-    {
-        template 
-        struct hash_impl;
-
-        template <>
-        struct hash_impl
-        {
-            template 
-            struct inner
-                : std::unary_function
-            {
-#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::call(val);
-                }
-#endif
-            };
-        };
-    }
-#endif  // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
 }
 
 #endif
diff --git a/include/boost/functional/hash/hash.hpp b/include/boost/functional/hash/hash.hpp
index 6376706..593fde0 100644
--- a/include/boost/functional/hash/hash.hpp
+++ b/include/boost/functional/hash/hash.hpp
@@ -405,7 +405,6 @@ namespace boost
 
 // Specializing boost::hash for pointers.
 
-#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
 
     template 
     struct hash
@@ -424,48 +423,6 @@ namespace boost
         }
     };
 
-#else
-
-    // For compilers without partial specialization, we define a
-    // boost::hash for all remaining types. But hash_impl is only defined
-    // for pointers in 'extensions.hpp' - so when BOOST_HASH_NO_EXTENSIONS
-    // is defined there will still be a compile error for types not supported
-    // in the standard.
-
-    namespace hash_detail
-    {
-        template 
-        struct hash_impl;
-
-        template <>
-        struct hash_impl
-        {
-            template 
-            struct inner
-                : public std::unary_function
-            {
-                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(
-                        reinterpret_cast(val));
-
-                    return x + (x >> 3);
-#endif
-                }
-            };
-        };
-    }
-
-    template  struct hash
-        : public boost::hash_detail::hash_impl::value>
-            ::BOOST_NESTED_TEMPLATE inner
-    {
-    };
-
-#endif
 }
 
 #if defined(BOOST_MSVC)

From d0a7446c6ea8d71d9ed9b614410a5e7d0e13899e Mon Sep 17 00:00:00 2001
From: Michel Morin 
Date: Wed, 30 Oct 2013 12:51:24 +0000
Subject: [PATCH 28/32] Correct broken links to C++ standard papers. Refs
 #9212.

[SVN r86524]
---
 binders.html  | 2 +-
 index.html    | 2 +-
 mem_fun.html  | 2 +-
 negators.html | 2 +-
 ptr_fun.html  | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/binders.html b/binders.html
index 30c2c4b..c3443fe 100644
--- a/binders.html
+++ b/binders.html
@@ -121,7 +121,7 @@ public:
   be std::ostream&&. Since you cannot have a reference to a
   reference, at this point we should get a compilation error because
   references to references are illegal in C++ (but see C++
+  "http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#106">C++
   Standard core language active issues list).

The binders in this library avoid this problem by using the Boost diff --git a/index.html b/index.html index 86d8bac..f4315a0 100644 --- a/index.html +++ b/index.html @@ -228,7 +228,7 @@ std::for_each(c.begin(), c.end(),

  • The Standard Committee has recognised the problem of references to references occurring during template instantiation and has moved to fix the standard (see the C++ + "http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#106">C++ standard core language active issues list).
  • diff --git a/mem_fun.html b/mem_fun.html index 23dc102..54d3aee 100644 --- a/mem_fun.html +++ b/mem_fun.html @@ -151,7 +151,7 @@ public: declaring the argument as const A&, then if A were a reference type, we would have a reference to a reference, which is currently illegal (but see C++ core + "http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#106">C++ core language issue number 106)

    So the way in which we want to declare the second argument for diff --git a/negators.html b/negators.html index 9d31750..5af3c54 100644 --- a/negators.html +++ b/negators.html @@ -99,7 +99,7 @@ public:

    Note that if the Predicate's argument_type is a reference, the type of operator()'s argument would be a reference to a reference. Currently this is illegal in C++ (but see the C++ + "http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#106">C++ standard core language active issues list).

    However, if we instead defined operator() to accept Predicate's diff --git a/ptr_fun.html b/ptr_fun.html index 0dc62b4..a8ba265 100644 --- a/ptr_fun.html +++ b/ptr_fun.html @@ -108,7 +108,7 @@ public: declaring the argument as const Arg&, then if Arg were a reference type, we would have a reference to a reference, which is currently illegal (but see C++ core + "http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#106">C++ core language issue number 106)

    So the way in which we want to declare the argument for From b0c83ab93c29d697b5d5ef09bd71c12774c23447 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sun, 10 Nov 2013 23:25:54 +0000 Subject: [PATCH 29/32] Link to archived copy of Thomas Wang's integer hash function. His site's no longer on the web, so use web.archive.org instead. [SVN r86607] --- hash/doc/rationale.qbk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hash/doc/rationale.qbk b/hash/doc/rationale.qbk index 8621081..76ff6d1 100644 --- a/hash/doc/rationale.qbk +++ b/hash/doc/rationale.qbk @@ -34,7 +34,7 @@ For other use cases, if you do need a higher quality hash function, then neither the standard hash function or `boost::hash` are appropriate. There are several options available. One is to use a second hash on the output of this hash -function, such as [@http://www.concentric.net/~ttwang/tech/inthash.htm +function, such as [@http://web.archive.org/web/20121102023700/http://www.concentric.net/~Ttwang/tech/inthash.htm Thomas Wang's hash function]. This this may not work as well as a hash algorithm tailored for the input. From 3f4d17c5e784bc2cc4cef02ca0782c55f7fbe1e2 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Tue, 12 Nov 2013 22:09:42 +0000 Subject: [PATCH 30/32] Only use Visual C++ pragma for appropriate versions. [SVN r86671] --- include/boost/functional/hash/hash.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/boost/functional/hash/hash.hpp b/include/boost/functional/hash/hash.hpp index 593fde0..e1aa245 100644 --- a/include/boost/functional/hash/hash.hpp +++ b/include/boost/functional/hash/hash.hpp @@ -26,11 +26,15 @@ #if defined(BOOST_MSVC) #pragma warning(push) + +#if BOOST_MSVC >= 1400 #pragma warning(disable:6295) // Ill-defined for-loop : 'unsigned int' values // are always of range '0' to '4294967295'. // Loop executes infinitely. #endif +#endif + namespace boost { namespace hash_detail From 612861ab0df0634df16b33fcec3b47eb522628bb Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sat, 16 Nov 2013 20:13:24 +0000 Subject: [PATCH 31/32] Use `BOOST_HAS_PRAGMA_ONCE`. Remembering to first include config, so that it'll actually be defined. [SVN r86726] --- include/boost/functional/hash/detail/float_functions.hpp | 8 ++++---- include/boost/functional/hash/detail/hash_float.hpp | 6 +++--- include/boost/functional/hash/detail/limits.hpp | 5 +++-- include/boost/functional/hash/extensions.hpp | 9 +++++---- include/boost/functional/hash/hash_fwd.hpp | 6 +++--- include/boost/functional/hash_fwd.hpp | 6 +++++- 6 files changed, 23 insertions(+), 17 deletions(-) diff --git a/include/boost/functional/hash/detail/float_functions.hpp b/include/boost/functional/hash/detail/float_functions.hpp index 648b433..f3db52f 100644 --- a/include/boost/functional/hash/detail/float_functions.hpp +++ b/include/boost/functional/hash/detail/float_functions.hpp @@ -7,12 +7,12 @@ #define BOOST_FUNCTIONAL_HASH_DETAIL_FLOAT_FUNCTIONS_HPP #include -#include - -#if defined(_MSC_VER) -# pragma once +#if defined(BOOST_HAS_PRAGMA_ONCE) +#pragma once #endif +#include + // Set BOOST_HASH_CONFORMANT_FLOATS to 1 for libraries known to have // sufficiently good floating point support to not require any // workarounds. diff --git a/include/boost/functional/hash/detail/hash_float.hpp b/include/boost/functional/hash/detail/hash_float.hpp index b2866f8..ee0ee87 100644 --- a/include/boost/functional/hash/detail/hash_float.hpp +++ b/include/boost/functional/hash/detail/hash_float.hpp @@ -6,11 +6,11 @@ #if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_HEADER) #define BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_HEADER -#if defined(_MSC_VER) -# pragma once +#include +#if defined(BOOST_HAS_PRAGMA_ONCE) +#pragma once #endif -#include #include #include #include diff --git a/include/boost/functional/hash/detail/limits.hpp b/include/boost/functional/hash/detail/limits.hpp index e48b950..4a971a6 100644 --- a/include/boost/functional/hash/detail/limits.hpp +++ b/include/boost/functional/hash/detail/limits.hpp @@ -9,8 +9,9 @@ #if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_LIMITS_HEADER) #define BOOST_FUNCTIONAL_HASH_DETAIL_LIMITS_HEADER -#if defined(_MSC_VER) -# pragma once +#include +#if defined(BOOST_HAS_PRAGMA_ONCE) +#pragma once #endif #include diff --git a/include/boost/functional/hash/extensions.hpp b/include/boost/functional/hash/extensions.hpp index e591f99..ba34ca5 100644 --- a/include/boost/functional/hash/extensions.hpp +++ b/include/boost/functional/hash/extensions.hpp @@ -13,6 +13,11 @@ #if !defined(BOOST_FUNCTIONAL_HASH_EXTENSIONS_HPP) #define BOOST_FUNCTIONAL_HASH_EXTENSIONS_HPP +#include +#if defined(BOOST_HAS_PRAGMA_ONCE) +#pragma once +#endif + #include #include #include @@ -32,10 +37,6 @@ # include #endif -#if defined(_MSC_VER) -# pragma once -#endif - #if defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) #include #endif diff --git a/include/boost/functional/hash/hash_fwd.hpp b/include/boost/functional/hash/hash_fwd.hpp index 74dbaf8..01fe012 100644 --- a/include/boost/functional/hash/hash_fwd.hpp +++ b/include/boost/functional/hash/hash_fwd.hpp @@ -10,11 +10,11 @@ #if !defined(BOOST_FUNCTIONAL_HASH_FWD_HPP) #define BOOST_FUNCTIONAL_HASH_FWD_HPP -#if defined(_MSC_VER) -# pragma once +#include +#if defined(BOOST_HAS_PRAGMA_ONCE) +#pragma once #endif -#include #include #include diff --git a/include/boost/functional/hash_fwd.hpp b/include/boost/functional/hash_fwd.hpp index b640988..eea9073 100644 --- a/include/boost/functional/hash_fwd.hpp +++ b/include/boost/functional/hash_fwd.hpp @@ -3,5 +3,9 @@ // 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) -#include +#include +#if defined(BOOST_HAS_PRAGMA_ONCE) +#pragma once +#endif +#include From b5e667855321a5eace85dc6adeff09b1c5809549 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Tue, 10 Dec 2013 23:16:40 +0000 Subject: [PATCH 32/32] Revert changes to develop branch. Simplest way to merge to master. --- include/boost/functional.hpp | 26 +++++ .../hash/detail/float_functions.hpp | 8 +- .../functional/hash/detail/hash_float.hpp | 6 +- .../boost/functional/hash/detail/limits.hpp | 5 +- include/boost/functional/hash/extensions.hpp | 105 +++++++++++++++++- include/boost/functional/hash/hash.hpp | 104 ++++++++++++++++- include/boost/functional/hash/hash_fwd.hpp | 10 +- include/boost/functional/hash_fwd.hpp | 6 +- 8 files changed, 245 insertions(+), 25 deletions(-) diff --git a/include/boost/functional.hpp b/include/boost/functional.hpp index c0cf503..b618485 100644 --- a/include/boost/functional.hpp +++ b/include/boost/functional.hpp @@ -18,6 +18,7 @@ namespace boost { +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION // -------------------------------------------------------------------------- // The following traits classes allow us to avoid the need for ptr_fun // because the types of arguments and the result of a function can be @@ -115,6 +116,31 @@ namespace boost typedef A1 first_argument_type; typedef A2 second_argument_type; }; +#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + // -------------------------------------------------------------------------- + // If we have no partial specialisation available, decay to a situation + // that is no worse than in the Standard, i.e., ptr_fun will be required. + // -------------------------------------------------------------------------- + + template + struct unary_traits + { + typedef Operation function_type; + typedef const Operation& param_type; + typedef typename Operation::result_type result_type; + typedef typename Operation::argument_type argument_type; + }; + + template + struct binary_traits + { + typedef Operation function_type; + typedef const Operation & param_type; + typedef typename Operation::result_type result_type; + typedef typename Operation::first_argument_type first_argument_type; + typedef typename Operation::second_argument_type second_argument_type; + }; +#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION // -------------------------------------------------------------------------- // unary_negate, not1 diff --git a/include/boost/functional/hash/detail/float_functions.hpp b/include/boost/functional/hash/detail/float_functions.hpp index f3db52f..4b8374d 100644 --- a/include/boost/functional/hash/detail/float_functions.hpp +++ b/include/boost/functional/hash/detail/float_functions.hpp @@ -7,12 +7,12 @@ #define BOOST_FUNCTIONAL_HASH_DETAIL_FLOAT_FUNCTIONS_HPP #include -#if defined(BOOST_HAS_PRAGMA_ONCE) -#pragma once -#endif - #include +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + // Set BOOST_HASH_CONFORMANT_FLOATS to 1 for libraries known to have // sufficiently good floating point support to not require any // workarounds. diff --git a/include/boost/functional/hash/detail/hash_float.hpp b/include/boost/functional/hash/detail/hash_float.hpp index ee0ee87..7c3de31 100644 --- a/include/boost/functional/hash/detail/hash_float.hpp +++ b/include/boost/functional/hash/detail/hash_float.hpp @@ -6,11 +6,11 @@ #if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_HEADER) #define BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_HEADER -#include -#if defined(BOOST_HAS_PRAGMA_ONCE) -#pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once #endif +#include #include #include #include diff --git a/include/boost/functional/hash/detail/limits.hpp b/include/boost/functional/hash/detail/limits.hpp index 4a971a6..f5b520e 100644 --- a/include/boost/functional/hash/detail/limits.hpp +++ b/include/boost/functional/hash/detail/limits.hpp @@ -9,9 +9,8 @@ #if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_LIMITS_HEADER) #define BOOST_FUNCTIONAL_HASH_DETAIL_LIMITS_HEADER -#include -#if defined(BOOST_HAS_PRAGMA_ONCE) -#pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once #endif #include diff --git a/include/boost/functional/hash/extensions.hpp b/include/boost/functional/hash/extensions.hpp index ba34ca5..998c08e 100644 --- a/include/boost/functional/hash/extensions.hpp +++ b/include/boost/functional/hash/extensions.hpp @@ -13,11 +13,6 @@ #if !defined(BOOST_FUNCTIONAL_HASH_EXTENSIONS_HPP) #define BOOST_FUNCTIONAL_HASH_EXTENSIONS_HPP -#include -#if defined(BOOST_HAS_PRAGMA_ONCE) -#pragma once -#endif - #include #include #include @@ -37,10 +32,18 @@ # include #endif +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + #if defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) #include #endif +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) +#include +#endif + namespace boost { template @@ -229,7 +232,11 @@ namespace boost template 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); @@ -251,6 +258,7 @@ namespace boost // +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) template struct hash : std::unary_function @@ -279,6 +287,93 @@ namespace boost }; #endif +#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + + // On compilers without partial specialization, boost::hash + // has already been declared to deal with pointers, so just + // need to supply the non-pointer version of hash_impl. + + namespace hash_detail + { + template + struct hash_impl; + +#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) + + template <> + struct hash_impl + { + template + struct inner + : std::unary_function + { +#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::call(val); + } +#endif + }; + }; + +#else // Visual C++ 6.5 + + // Visual C++ 6.5 has problems with nested member functions and + // applying const to const types in templates. So we get this: + + template + struct hash_impl_msvc + { + template + struct inner + : public std::unary_function + { + std::size_t operator()(T const& val) const + { + return hash_detail::call_hash::call(val); + } + + std::size_t operator()(T& val) const + { + return hash_detail::call_hash::call(val); + } + }; + }; + + template <> + struct hash_impl_msvc + { + template + struct inner + : public std::unary_function + { + std::size_t operator()(T& val) const + { + return hash_detail::call_hash::call(val); + } + }; + }; + + template + struct hash_impl_msvc2 + : public hash_impl_msvc::value> + ::BOOST_NESTED_TEMPLATE inner {}; + + template <> + struct hash_impl + { + template + struct inner : public hash_impl_msvc2 {}; + }; + +#endif // Visual C++ 6.5 + } +#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION } #endif diff --git a/include/boost/functional/hash/hash.hpp b/include/boost/functional/hash/hash.hpp index e1aa245..42ea019 100644 --- a/include/boost/functional/hash/hash.hpp +++ b/include/boost/functional/hash/hash.hpp @@ -19,6 +19,9 @@ #include #include +#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) +#include +#endif #if !defined(BOOST_NO_CXX11_HDR_TYPEINDEX) #include @@ -35,6 +38,13 @@ #endif +#if BOOST_WORKAROUND(__GNUC__, < 3) \ + && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) +#define BOOST_HASH_CHAR_TRAITS string_char_traits +#else +#define BOOST_HASH_CHAR_TRAITS char_traits +#endif + namespace boost { namespace hash_detail @@ -129,7 +139,7 @@ namespace boost template std::size_t hash_value( - std::basic_string, A> const&); + std::basic_string, A> const&); template typename boost::hash_detail::float_numbers::type hash_value(T); @@ -238,8 +248,13 @@ namespace boost #endif #endif +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) + template + inline void hash_combine(std::size_t& seed, T& v) +#else template inline void hash_combine(std::size_t& seed, T const& v) +#endif { boost::hash hasher; seed ^= hasher(v) + 0x9e3779b9 + (seed<<6) + (seed>>2); @@ -313,7 +328,7 @@ namespace boost template inline std::size_t hash_value( - std::basic_string, A> const& v) + std::basic_string, A> const& v) { return hash_range(v.begin(), v.end()); } @@ -347,6 +362,7 @@ namespace boost // // These are undefined later. +#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) #define BOOST_HASH_SPECIALIZE(type) \ template <> struct hash \ : public std::unary_function \ @@ -366,6 +382,45 @@ namespace boost return boost::hash_value(v); \ } \ }; +#else +#define BOOST_HASH_SPECIALIZE(type) \ + template <> struct hash \ + : public std::unary_function \ + { \ + std::size_t operator()(type v) const \ + { \ + return boost::hash_value(v); \ + } \ + }; \ + \ + template <> struct hash \ + : public std::unary_function \ + { \ + std::size_t operator()(const type v) const \ + { \ + return boost::hash_value(v); \ + } \ + }; + +#define BOOST_HASH_SPECIALIZE_REF(type) \ + template <> struct hash \ + : public std::unary_function \ + { \ + std::size_t operator()(type const& v) const \ + { \ + return boost::hash_value(v); \ + } \ + }; \ + \ + template <> struct hash \ + : public std::unary_function \ + { \ + std::size_t operator()(type const& v) const \ + { \ + return boost::hash_value(v); \ + } \ + }; +#endif BOOST_HASH_SPECIALIZE(bool) BOOST_HASH_SPECIALIZE(char) @@ -409,6 +464,7 @@ namespace boost // Specializing boost::hash for pointers. +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) template struct hash @@ -427,8 +483,52 @@ namespace boost } }; +#else + + // For compilers without partial specialization, we define a + // boost::hash for all remaining types. But hash_impl is only defined + // for pointers in 'extensions.hpp' - so when BOOST_HASH_NO_EXTENSIONS + // is defined there will still be a compile error for types not supported + // in the standard. + + namespace hash_detail + { + template + struct hash_impl; + + template <> + struct hash_impl + { + template + struct inner + : public std::unary_function + { + 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( + reinterpret_cast(val)); + + return x + (x >> 3); +#endif + } + }; + }; + } + + template struct hash + : public boost::hash_detail::hash_impl::value> + ::BOOST_NESTED_TEMPLATE inner + { + }; + +#endif } +#undef BOOST_HASH_CHAR_TRAITS + #if defined(BOOST_MSVC) #pragma warning(pop) #endif diff --git a/include/boost/functional/hash/hash_fwd.hpp b/include/boost/functional/hash/hash_fwd.hpp index 01fe012..1d51b07 100644 --- a/include/boost/functional/hash/hash_fwd.hpp +++ b/include/boost/functional/hash/hash_fwd.hpp @@ -10,11 +10,11 @@ #if !defined(BOOST_FUNCTIONAL_HASH_FWD_HPP) #define BOOST_FUNCTIONAL_HASH_FWD_HPP -#include -#if defined(BOOST_HAS_PRAGMA_ONCE) -#pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once #endif +#include #include #include @@ -22,7 +22,11 @@ namespace boost { template struct hash; +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) + template void hash_combine(std::size_t& seed, T& v); +#else template void hash_combine(std::size_t& seed, T const& v); +#endif template std::size_t hash_range(It, It); template void hash_range(std::size_t&, It, It); diff --git a/include/boost/functional/hash_fwd.hpp b/include/boost/functional/hash_fwd.hpp index eea9073..b640988 100644 --- a/include/boost/functional/hash_fwd.hpp +++ b/include/boost/functional/hash_fwd.hpp @@ -3,9 +3,5 @@ // 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) -#include -#if defined(BOOST_HAS_PRAGMA_ONCE) -#pragma once -#endif - #include +