From 8b77644ea005ace9ee5af08a6f82aa8e235e2710 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sat, 20 Jan 2018 17:30:33 +0000 Subject: [PATCH 01/20] Support std::string_view --- include/boost/container_hash/hash/hash.hpp | 55 ++++++++++++++++++++++ test/hash_string_test.cpp | 37 +++++++++++++++ 2 files changed, 92 insertions(+) diff --git a/include/boost/container_hash/hash/hash.hpp b/include/boost/container_hash/hash/hash.hpp index 21296f3..c1b873e 100644 --- a/include/boost/container_hash/hash/hash.hpp +++ b/include/boost/container_hash/hash/hash.hpp @@ -58,6 +58,33 @@ # define BOOST_FUNCTIONAL_HASH_ROTL32(x, r) (x << r) | (x >> (32 - r)) #endif +// Detect whether standard library has . + +#if !defined(BOOST_HASH_HAS_STRING_VIEW) && defined(__has_include) +# if __has_include() +# if defined(BOOST_MSVC) + // On Visual C++ the header exists, but causes an + // error if it isn't in C++17 mode. +# if defined(_HAS_CXX17) && _HAS_CXX17 +# define BOOST_HASH_HAS_STRING_VIEW 1 +# include +# endif +# else +# include +# if defined(__cpp_lib_string_view) && __cpp_lib_string_view >= 201603 +# define BOOST_HASH_HAS_STRING_VIEW 1 +# endif +# endif +# endif +#endif + +#if !defined(BOOST_HASH_HAS_STRING_VIEW) +# define BOOST_HASH_HAS_STRING_VIEW 0 +#endif + +#if BOOST_HASH_HAS_STRING_VIEW +#endif + namespace boost { namespace hash_detail @@ -176,6 +203,12 @@ namespace boost std::size_t hash_value( std::basic_string, A> const&); +#if BOOST_HASH_HAS_STRING_VIEW + template + std::size_t hash_value( + std::basic_string_view > const&); +#endif + template typename boost::hash_detail::float_numbers::type hash_value(T); @@ -410,6 +443,15 @@ namespace boost return hash_range(v.begin(), v.end()); } +#if BOOST_HASH_HAS_STRING_VIEW + template + inline std::size_t hash_value( + std::basic_string_view > const& v) + { + return hash_range(v.begin(), v.end()); + } +#endif + template typename boost::hash_detail::float_numbers::type hash_value(T v) { @@ -494,6 +536,19 @@ namespace boost BOOST_HASH_SPECIALIZE_REF(std::basic_string) #endif +#if BOOST_HASH_HAS_STRING_VIEW + BOOST_HASH_SPECIALIZE_REF(std::string_view) +# if !defined(BOOST_NO_STD_WSTRING) && !defined(BOOST_NO_INTRINSIC_WCHAR_T) + BOOST_HASH_SPECIALIZE_REF(std::wstring_view) +# endif +# if !defined(BOOST_NO_CXX11_CHAR16_T) + BOOST_HASH_SPECIALIZE_REF(std::basic_string_view) +# endif +# if !defined(BOOST_NO_CXX11_CHAR32_T) + BOOST_HASH_SPECIALIZE_REF(std::basic_string_view) +# endif +#endif + #if !defined(BOOST_NO_LONG_LONG) BOOST_HASH_SPECIALIZE(boost::long_long_type) BOOST_HASH_SPECIALIZE(boost::ulong_long_type) diff --git a/test/hash_string_test.cpp b/test/hash_string_test.cpp index f84eb74..712c639 100644 --- a/test/hash_string_test.cpp +++ b/test/hash_string_test.cpp @@ -130,6 +130,37 @@ void u32string_tests() } #endif +template +void generic_string_tests(StringType*) +{ + std::string x1(1, '\0'); + std::string x2(2, '\0'); + std::string x3(3, '\0'); + std::string x4(10, '\0'); + std::string x5 = x2 + "hello" + x2; + + StringType strings[] = { + "", + "hello", + x1, + x2, + x3, + x4, + x5 + }; + + std::size_t const strings_length = sizeof(strings) / sizeof(StringType); + boost::hash hash; + + for (std::size_t i = 0; i < strings_length; ++i) { + std::size_t hash_i = hash(strings[i]); + for (std::size_t j = 0; j < strings_length; ++j) { + std::size_t hash_j = hash(strings[j]); + BOOST_TEST((hash_i == hash_j) == (i == j)); + } + } +} + int main() { string_tests(); @@ -143,5 +174,11 @@ int main() #if !defined(BOOST_NO_CXX11_CHAR32_T) u32string_tests(); #endif + + generic_string_tests((std::string*) 0); +#if BOOST_HASH_HAS_STRING_VIEW + generic_string_tests((std::string_view*) 0); +#endif + return boost::report_errors(); } From 3521c417b59b657e9f845f41b4f844fd0d462e3a Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sat, 20 Jan 2018 17:30:58 +0000 Subject: [PATCH 02/20] Small program to write out hash config info --- test/Jamfile.v2 | 1 + test/hash_info.cpp | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 test/hash_info.cpp diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index dd2b977..ed2fc49 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -20,6 +20,7 @@ project hash-tests test-suite container_hash/hash : + [ run hash_info.cpp : : : always_show_run_output ] [ compile check_float_funcs.cpp ] [ run hash_fwd_test_1.cpp ] [ run hash_fwd_test_2.cpp ] diff --git a/test/hash_info.cpp b/test/hash_info.cpp new file mode 100644 index 0000000..25b942a --- /dev/null +++ b/test/hash_info.cpp @@ -0,0 +1,15 @@ + +// Copyright 2017 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) + +// Not a test, just a small program to write out configuration info + +#include +#include + +int main() { + std::cout << "BOOST_HASH_HAS_STRING_VIEW: " + << BOOST_HASH_HAS_STRING_VIEW + << std::endl; +} From def7a785a546e25600c90782b8984e1adde9709b Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sat, 20 Jan 2018 18:39:46 +0000 Subject: [PATCH 03/20] Remove some pointless code --- include/boost/container_hash/hash/hash.hpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/include/boost/container_hash/hash/hash.hpp b/include/boost/container_hash/hash/hash.hpp index c1b873e..961dda9 100644 --- a/include/boost/container_hash/hash/hash.hpp +++ b/include/boost/container_hash/hash/hash.hpp @@ -82,9 +82,6 @@ # define BOOST_HASH_HAS_STRING_VIEW 0 #endif -#if BOOST_HASH_HAS_STRING_VIEW -#endif - namespace boost { namespace hash_detail From b5c3b5d00afcae83db1b669591caeeecc109eff6 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sat, 20 Jan 2018 21:53:03 +0000 Subject: [PATCH 04/20] Write out __cplusplus in hash_info --- test/hash_info.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/hash_info.cpp b/test/hash_info.cpp index 25b942a..83f74a1 100644 --- a/test/hash_info.cpp +++ b/test/hash_info.cpp @@ -9,6 +9,11 @@ #include int main() { +#if defined(__cplusplus) + std::cout << "__cplusplus: " + << __cplusplus + << std::endl; +#endif std::cout << "BOOST_HASH_HAS_STRING_VIEW: " << BOOST_HASH_HAS_STRING_VIEW << std::endl; From 5c4edf4d7d6dc36917a150298499158a4c20ae99 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sat, 20 Jan 2018 21:53:36 +0000 Subject: [PATCH 05/20] Fix string_view include on gcc 7.2 If it's included in anything earlier than c++-1z it errors. --- include/boost/container_hash/hash/hash.hpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/include/boost/container_hash/hash/hash.hpp b/include/boost/container_hash/hash/hash.hpp index 961dda9..f648205 100644 --- a/include/boost/container_hash/hash/hash.hpp +++ b/include/boost/container_hash/hash/hash.hpp @@ -69,11 +69,9 @@ # define BOOST_HASH_HAS_STRING_VIEW 1 # include # endif -# else +# elif defined(__cplusplus) && __cplusplus >= 201703 # include -# if defined(__cpp_lib_string_view) && __cpp_lib_string_view >= 201603 -# define BOOST_HASH_HAS_STRING_VIEW 1 -# endif +# define BOOST_HASH_HAS_STRING_VIEW 1 # endif # endif #endif From f81ee167c5c10d418cdefcf10e4f43ea69be32e4 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sun, 21 Jan 2018 11:10:03 +0000 Subject: [PATCH 06/20] Add Visual C++ info to hash_info --- test/hash_info.cpp | 61 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/test/hash_info.cpp b/test/hash_info.cpp index 83f74a1..21425c3 100644 --- a/test/hash_info.cpp +++ b/test/hash_info.cpp @@ -7,8 +7,69 @@ #include #include +#include + +#if defined(BOOST_MSVC) + +struct msvc_version { + std::size_t version; + char const* description; + + bool operator<(std::size_t v) const { + return version < v; + } + friend bool operator<(std::size_t v1, msvc_version const& v2) { + return v1 < v2.version; + } +}; + +void write_compiler_info() { + // From: + // https://en.wikipedia.org/wiki/Microsoft_Visual_C%2B%2B + // https://blogs.msdn.microsoft.com/vcblog/2017/11/15/side-by-side-minor-version-msvc-toolsets-in-visual-studio-2017/ + msvc_version versions[] = { + {0, "Old Visual C++"}, + {1000, "Visual C++ 4.x, VS4.0?"}, + {1100, "Visual C++ 5.0, VS97"}, + {1200, "Visual C++ 6.0, VS6.0"}, + {1300, "Visual C++ 7.0, VS.NET 2002"}, + {1310, "Visual C++ 7.1, VS.NET 2003"}, + {1400, "Visual C++ 8.0, VS2005"}, + {1500, "Visual C++ 9.0, VS2008"}, + {1600, "Visual C++ 10.0, VS2010"}, + {1700, "Visual C++ 11.0, VS2012"}, + {1800, "Visual C++ 12.0, VS2013"}, + {1900, "Visual C++ 14.00, VS2015"}, + {1910, "Visual C++ 14.10, VS2017 15.1/2"}, + {1911, "Visual C++ 14.11, VS2017 15.3/4"}, + {1912, "Visual C++ 14.12, VS2017 15.5"} + }; + + std::size_t msvc = BOOST_MSVC; + msvc_version* v = std::upper_bound(versions, + versions + sizeof(versions) / sizeof(*versions), + msvc) - 1; + std::size_t difference = BOOST_MSVC - v->version; + + std::cout << v->description << std::endl; + if (difference) { + std::cout << "+" << difference << std::endl; + } +#if defined(_HAS_CXX17) && _HAS_CXX17 + std::cout << "C++17 mode" << std::endl; +#endif +} + +#else + +void write_compiler_info() { +} + +#endif int main() { + write_compiler_info(); + #if defined(__cplusplus) std::cout << "__cplusplus: " << __cplusplus From 42bb81befac23361240e74b4857c98f635112bab Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sun, 21 Jan 2018 13:44:50 +0000 Subject: [PATCH 07/20] Support std::error_code and std::error_condition --- include/boost/container_hash/hash/hash.hpp | 31 ++++++++++-- test/Jamfile.v2 | 1 + test/hash_info.cpp | 13 +++++ test/hash_system_error_test.cpp | 55 ++++++++++++++++++++++ 4 files changed, 97 insertions(+), 3 deletions(-) create mode 100644 test/hash_system_error_test.cpp diff --git a/include/boost/container_hash/hash/hash.hpp b/include/boost/container_hash/hash/hash.hpp index f648205..f7cd21d 100644 --- a/include/boost/container_hash/hash/hash.hpp +++ b/include/boost/container_hash/hash/hash.hpp @@ -5,7 +5,7 @@ // Based on Peter Dimov's proposal // http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf -// issue 6.18. +// issue 6.18. // // This also contains public domain code from MurmurHash. From the // MurmurHash header: @@ -34,6 +34,10 @@ #include #endif +#if !defined(BOOST_NO_CXX11_HDR_SYSTEM_ERROR) +#include +#endif + #if defined(BOOST_MSVC) #pragma warning(push) @@ -211,6 +215,11 @@ namespace boost std::size_t hash_value(std::type_index); #endif +#if !defined(BOOST_NO_CXX11_HDR_SYSTEM_ERROR) + std::size_t hash_value(std::error_code const&); + std::size_t hash_value(std::error_condition const&); +#endif + // Implementation namespace hash_detail @@ -460,14 +469,30 @@ namespace boost } #endif +#if !defined(BOOST_NO_CXX11_HDR_SYSTEM_ERROR) + inline std::size_t hash_value(std::error_code const& v) { + std::size_t seed = 0; + hash_combine(seed, v.value()); + hash_combine(seed, &v.category()); + return seed; + } + + inline std::size_t hash_value(std::error_condition const& v) { + std::size_t seed = 0; + hash_combine(seed, v.value()); + hash_combine(seed, &v.category()); + return seed; + } +#endif + // // boost::hash // - + // Define the specializations required by the standard. The general purpose // boost::hash is defined later in extensions.hpp if // BOOST_HASH_NO_EXTENSIONS is not defined. - + // BOOST_HASH_SPECIALIZE - define a specialization for a type which is // passed by copy. // diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index ed2fc49..6b11b7f 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -44,6 +44,7 @@ test-suite container_hash/hash [ run hash_map_test.cpp ] [ run hash_complex_test.cpp ] [ run hash_type_index_test.cpp ] + [ run hash_system_error_test.cpp ] [ run hash_std_array_test.cpp ] [ run hash_std_tuple_test.cpp ] [ run hash_std_smart_ptr_test.cpp ] diff --git a/test/hash_info.cpp b/test/hash_info.cpp index 21425c3..8a906c3 100644 --- a/test/hash_info.cpp +++ b/test/hash_info.cpp @@ -78,4 +78,17 @@ int main() { std::cout << "BOOST_HASH_HAS_STRING_VIEW: " << BOOST_HASH_HAS_STRING_VIEW << std::endl; + +#if defined(BOOST_NO_CXX11_HDR_TYPEINDEX) + std::cout << "No " << std::endl; +#else + std::cout << "" << std::endl; +#endif + +#if defined(BOOST_NO_CXX11_HDR_SYSTEM_ERROR) + std::cout << "No " << std::endl; +#else + std::cout << "" << std::endl; +#endif + } diff --git a/test/hash_system_error_test.cpp b/test/hash_system_error_test.cpp new file mode 100644 index 0000000..71eb714 --- /dev/null +++ b/test/hash_system_error_test.cpp @@ -0,0 +1,55 @@ + +// Copyright 2018 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) + +#include "./config.hpp" + +#ifndef BOOST_HASH_TEST_STD_INCLUDES +# include +#endif +#include +#include + +#if !defined(BOOST_NO_CXX11_HDR_SYSTEM_ERROR) + +#include + +void test_error_code() +{ + std::error_code err1a = std::make_error_code(std::errc::address_family_not_supported); + std::error_code err1b = std::make_error_code(std::errc::address_family_not_supported); + std::error_code err2 = std::make_error_code(std::errc::address_in_use); + + boost::hash hasher; + + BOOST_TEST(hasher(err1a) == hasher(err1a)); + BOOST_TEST(hasher(err1a) == hasher(err1b)); + BOOST_TEST(hasher(err1a) != hasher(err2)); +} + +void test_error_condition() +{ + std::error_condition err1a = std::make_error_condition(std::errc::address_family_not_supported); + std::error_condition err1b = std::make_error_condition(std::errc::address_family_not_supported); + std::error_condition err2 = std::make_error_condition(std::errc::address_in_use); + + boost::hash hasher; + + BOOST_TEST(hasher(err1a) == hasher(err1a)); + BOOST_TEST(hasher(err1a) == hasher(err1b)); + BOOST_TEST(hasher(err1a) != hasher(err2)); +} + +#endif + +int main() +{ +#if !defined(BOOST_NO_CXX11_HDR_SYSTEM_ERROR) + test_error_code(); + test_error_condition(); +#else + BOOST_LIGHTWEIGHT_TEST_OSTREAM << " not available." << std::endl; +#endif + return boost::report_errors(); +} From b9ae7e7fb67e4c68ee9e106b517e16972cde5869 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sun, 21 Jan 2018 18:21:46 +0000 Subject: [PATCH 08/20] Clean up header detection for more headers + add optional --- include/boost/container_hash/hash/hash.hpp | 45 +++++++++++++++------- test/hash_info.cpp | 12 ++++-- 2 files changed, 41 insertions(+), 16 deletions(-) diff --git a/include/boost/container_hash/hash/hash.hpp b/include/boost/container_hash/hash/hash.hpp index f7cd21d..41cab8a 100644 --- a/include/boost/container_hash/hash/hash.hpp +++ b/include/boost/container_hash/hash/hash.hpp @@ -62,21 +62,28 @@ # define BOOST_FUNCTIONAL_HASH_ROTL32(x, r) (x << r) | (x >> (32 - r)) #endif -// Detect whether standard library has . +// Detect whether standard library has C++17 headers -#if !defined(BOOST_HASH_HAS_STRING_VIEW) && defined(__has_include) -# if __has_include() -# if defined(BOOST_MSVC) - // On Visual C++ the header exists, but causes an - // error if it isn't in C++17 mode. -# if defined(_HAS_CXX17) && _HAS_CXX17 -# define BOOST_HASH_HAS_STRING_VIEW 1 -# include -# endif -# elif defined(__cplusplus) && __cplusplus >= 201703 -# include -# define BOOST_HASH_HAS_STRING_VIEW 1 +#if !defined(BOOST_HASH_CXX17) +# if defined(BOOST_MSVC) +# if defined(_HAS_CXX17) && _HAS_CXX17 +# define BOOST_HASH_CXX17 1 # endif +# elif defined(__cplusplus) && __cplusplus >= 201703 +# define BOOST_HASH_CXX17 1 +# endif +#endif + +#if !defined(BOOST_HASH_CXX17) +# define BOOST_HASH_CXX17 0 +#endif + +#if BOOST_HASH_CXX17 && defined(__has_include) +# if !defined(BOOST_HASH_HAS_STRING_VIEW) && __has_include() +# define BOOST_HASH_HAS_STRING_VIEW 1 +# endif +# if !defined(BOOST_HASH_HAS_OPTIONAL) && __has_include() +# define BOOST_HASH_HAS_OPTIONAL 1 # endif #endif @@ -84,6 +91,18 @@ # define BOOST_HASH_HAS_STRING_VIEW 0 #endif +#if !defined(BOOST_HASH_HAS_OPTIONAL) +# define BOOST_HASH_HAS_OPTIONAL 0 +#endif + +#if BOOST_HASH_HAS_STRING_VIEW +# include +#endif + +#if BOOST_HASH_HAS_OPTIONAL +# include +#endif + namespace boost { namespace hash_detail diff --git a/test/hash_info.cpp b/test/hash_info.cpp index 8a906c3..c7b8ec8 100644 --- a/test/hash_info.cpp +++ b/test/hash_info.cpp @@ -55,9 +55,6 @@ void write_compiler_info() { if (difference) { std::cout << "+" << difference << std::endl; } -#if defined(_HAS_CXX17) && _HAS_CXX17 - std::cout << "C++17 mode" << std::endl; -#endif } #else @@ -75,10 +72,19 @@ int main() { << __cplusplus << std::endl; #endif + + std::cout << "BOOST_HASH_CXX17: " + << BOOST_HASH_CXX17 + << std::endl; + std::cout << "BOOST_HASH_HAS_STRING_VIEW: " << BOOST_HASH_HAS_STRING_VIEW << std::endl; + std::cout << "BOOST_HASH_HAS_OPTIONAL: " + << BOOST_HASH_HAS_OPTIONAL + << std::endl; + #if defined(BOOST_NO_CXX11_HDR_TYPEINDEX) std::cout << "No " << std::endl; #else From ddc05d17dff6cab3edac55ddd965853242c46868 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sun, 21 Jan 2018 18:38:35 +0000 Subject: [PATCH 09/20] std::optional support --- include/boost/container_hash/hash/hash.hpp | 34 +++++++++++ test/Jamfile.v2 | 1 + test/hash_optional_test.cpp | 70 ++++++++++++++++++++++ 3 files changed, 105 insertions(+) create mode 100644 test/hash_optional_test.cpp diff --git a/include/boost/container_hash/hash/hash.hpp b/include/boost/container_hash/hash/hash.hpp index 41cab8a..a524aa2 100644 --- a/include/boost/container_hash/hash/hash.hpp +++ b/include/boost/container_hash/hash/hash.hpp @@ -230,6 +230,11 @@ namespace boost template typename boost::hash_detail::float_numbers::type hash_value(T); +#if BOOST_HASH_HAS_OPTIONAL + template + std::size_t hash_value(std::optional const&); +#endif + #if !defined(BOOST_NO_CXX11_HDR_TYPEINDEX) std::size_t hash_value(std::type_index); #endif @@ -481,6 +486,19 @@ namespace boost return boost::hash_detail::float_hash_value(v); } +#if BOOST_HASH_HAS_OPTIONAL + template + inline std::size_t hash_value(std::optional const& v) { + if (!v) { + // Arbitray value for empty optional. + return 0x12345678; + } else { + boost::hash hf; + return hf(*v); + } + } +#endif + #if !defined(BOOST_NO_CXX11_HDR_TYPEINDEX) inline std::size_t hash_value(std::type_index v) { @@ -540,6 +558,16 @@ namespace boost } \ }; +#define BOOST_HASH_SPECIALIZE_TEMPLATE_REF(type) \ + struct hash \ + : public boost::hash_detail::hash_base \ + { \ + std::size_t operator()(type const& v) const \ + { \ + return boost::hash_value(v); \ + } \ + }; + BOOST_HASH_SPECIALIZE(bool) BOOST_HASH_SPECIALIZE(char) BOOST_HASH_SPECIALIZE(signed char) @@ -598,12 +626,18 @@ namespace boost BOOST_HASH_SPECIALIZE(boost::uint128_type) #endif +#if BOOST_HASH_HAS_OPTIONAL + template + BOOST_HASH_SPECIALIZE_TEMPLATE_REF(std::optional) +#endif + #if !defined(BOOST_NO_CXX11_HDR_TYPEINDEX) BOOST_HASH_SPECIALIZE(std::type_index) #endif #undef BOOST_HASH_SPECIALIZE #undef BOOST_HASH_SPECIALIZE_REF +#undef BOOST_HASH_SPECIALIZE_TEMPLATE_REF // Specializing boost::hash for pointers. diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 6b11b7f..96c3b67 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -43,6 +43,7 @@ test-suite container_hash/hash [ run hash_set_test.cpp ] [ run hash_map_test.cpp ] [ run hash_complex_test.cpp ] + [ run hash_optional_test.cpp ] [ run hash_type_index_test.cpp ] [ run hash_system_error_test.cpp ] [ run hash_std_array_test.cpp ] diff --git a/test/hash_optional_test.cpp b/test/hash_optional_test.cpp new file mode 100644 index 0000000..4469395 --- /dev/null +++ b/test/hash_optional_test.cpp @@ -0,0 +1,70 @@ + +// Copyright 2018 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) + +#include "./config.hpp" + +#ifndef BOOST_HASH_TEST_STD_INCLUDES +# include +#endif +#include +#include + +#if BOOST_HASH_HAS_OPTIONAL + +#include +#include + +void test_optional_int() +{ + std::optional x1a; + std::optional x1b; + std::optional x2a(10); + std::optional x2b(x2a); + std::optional x3(20); + + boost::hash > hasher; + + BOOST_TEST(hasher(x1a) == hasher(x1a)); + BOOST_TEST(hasher(x1a) == hasher(x1b)); + BOOST_TEST(hasher(x1a) != hasher(x2a)); + BOOST_TEST(hasher(x1a) != hasher(x3)); + BOOST_TEST(hasher(x2a) == hasher(x2a)); + BOOST_TEST(hasher(x2b) == hasher(x2b)); + BOOST_TEST(hasher(x2a) != hasher(x3)); + BOOST_TEST(hasher(x3) == hasher(x3)); +} + +void test_optional_string() +{ + std::optional x1a; + std::optional x1b; + std::optional x2a("10"); + std::optional x2b(x2a); + std::optional x3("20"); + + boost::hash > hasher; + + BOOST_TEST(hasher(x1a) == hasher(x1a)); + BOOST_TEST(hasher(x1a) == hasher(x1b)); + BOOST_TEST(hasher(x1a) != hasher(x2a)); + BOOST_TEST(hasher(x1a) != hasher(x3)); + BOOST_TEST(hasher(x2a) == hasher(x2a)); + BOOST_TEST(hasher(x2b) == hasher(x2b)); + BOOST_TEST(hasher(x2a) != hasher(x3)); + BOOST_TEST(hasher(x3) == hasher(x3)); +} + +#endif + +int main() +{ +#if BOOST_HASH_HAS_OPTIONAL + test_optional_int(); + test_optional_string(); +#else + BOOST_LIGHTWEIGHT_TEST_OSTREAM << " not available." << std::endl; +#endif + return boost::report_errors(); +} From 4d9f4388239f768fae1a6224c6541af7ec05c9d5 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sun, 21 Jan 2018 19:18:58 +0000 Subject: [PATCH 10/20] std::variant, std::monostate support --- include/boost/container_hash/hash/hash.hpp | 38 ++++++++ test/Jamfile.v2 | 1 + test/hash_info.cpp | 4 + test/hash_variant_test.cpp | 100 +++++++++++++++++++++ 4 files changed, 143 insertions(+) create mode 100644 test/hash_variant_test.cpp diff --git a/include/boost/container_hash/hash/hash.hpp b/include/boost/container_hash/hash/hash.hpp index a524aa2..4b10870 100644 --- a/include/boost/container_hash/hash/hash.hpp +++ b/include/boost/container_hash/hash/hash.hpp @@ -85,6 +85,9 @@ # if !defined(BOOST_HASH_HAS_OPTIONAL) && __has_include() # define BOOST_HASH_HAS_OPTIONAL 1 # endif +# if !defined(BOOST_HASH_HAS_VARIANT) && __has_include() +# define BOOST_HASH_HAS_VARIANT 1 +# endif #endif #if !defined(BOOST_HASH_HAS_STRING_VIEW) @@ -95,6 +98,10 @@ # define BOOST_HASH_HAS_OPTIONAL 0 #endif +#if !defined(BOOST_HASH_HAS_VARIANT) +# define BOOST_HASH_HAS_VARIANT 0 +#endif + #if BOOST_HASH_HAS_STRING_VIEW # include #endif @@ -103,6 +110,10 @@ # include #endif +#if BOOST_HASH_HAS_VARIANT +# include +#endif + namespace boost { namespace hash_detail @@ -235,6 +246,12 @@ namespace boost std::size_t hash_value(std::optional const&); #endif +#if BOOST_HASH_HAS_VARIANT + std::size_t hash_value(std::monostate); + template + std::size_t hash_value(std::variant const&); +#endif + #if !defined(BOOST_NO_CXX11_HDR_TYPEINDEX) std::size_t hash_value(std::type_index); #endif @@ -499,6 +516,21 @@ namespace boost } #endif +#if BOOST_HASH_HAS_VARIANT + std::size_t hash_value(std::monostate) { + return 0x87654321; + } + + template + inline std::size_t hash_value(std::variant const& v) { + std::size_t seed = 0; + hash_combine(seed, v.index()); + std::visit([&seed](auto&& x) { hash_combine(seed, x); }, v); + return seed; + } +#endif + + #if !defined(BOOST_NO_CXX11_HDR_TYPEINDEX) inline std::size_t hash_value(std::type_index v) { @@ -631,6 +663,12 @@ namespace boost BOOST_HASH_SPECIALIZE_TEMPLATE_REF(std::optional) #endif +#if !defined(BOOST_HASH_HAS_VARIANT) + template + BOOST_HASH_SPECIALIZE_TEMPLATE_REF(std::variant) + BOOST_HASH_SPECIALIZE(std::monostate) +#endif + #if !defined(BOOST_NO_CXX11_HDR_TYPEINDEX) BOOST_HASH_SPECIALIZE(std::type_index) #endif diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 96c3b67..a9dddfb 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -44,6 +44,7 @@ test-suite container_hash/hash [ run hash_map_test.cpp ] [ run hash_complex_test.cpp ] [ run hash_optional_test.cpp ] + [ run hash_variant_test.cpp ] [ run hash_type_index_test.cpp ] [ run hash_system_error_test.cpp ] [ run hash_std_array_test.cpp ] diff --git a/test/hash_info.cpp b/test/hash_info.cpp index c7b8ec8..7159d1f 100644 --- a/test/hash_info.cpp +++ b/test/hash_info.cpp @@ -85,6 +85,10 @@ int main() { << BOOST_HASH_HAS_OPTIONAL << std::endl; + std::cout << "BOOST_HASH_HAS_VARIANT: " + << BOOST_HASH_HAS_VARIANT + << std::endl; + #if defined(BOOST_NO_CXX11_HDR_TYPEINDEX) std::cout << "No " << std::endl; #else diff --git a/test/hash_variant_test.cpp b/test/hash_variant_test.cpp new file mode 100644 index 0000000..80f317a --- /dev/null +++ b/test/hash_variant_test.cpp @@ -0,0 +1,100 @@ + +// Copyright 2018 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) + +#include "./config.hpp" + +#ifndef BOOST_HASH_TEST_STD_INCLUDES +# include +#endif +#include +#include + +#if BOOST_HASH_HAS_VARIANT + +#include +#include + +void test_monostate() +{ + std::monostate x1; + std::monostate x2; + + boost::hash hasher; + + BOOST_TEST(hasher(x1) == hasher(x2)); +} + +void test_variant_int() +{ + std::variant x1a; + std::variant x1b; + std::variant x2a(10); + std::variant x2b(x2a); + std::variant x3(20); + + boost::hash > hasher; + + BOOST_TEST(hasher(x1a) == hasher(x1a)); + BOOST_TEST(hasher(x1a) == hasher(x1b)); + BOOST_TEST(hasher(x1a) != hasher(x2a)); + BOOST_TEST(hasher(x1a) != hasher(x3)); + BOOST_TEST(hasher(x2a) == hasher(x2a)); + BOOST_TEST(hasher(x2b) == hasher(x2b)); + BOOST_TEST(hasher(x2a) != hasher(x3)); + BOOST_TEST(hasher(x3) == hasher(x3)); +} + +struct custom1 { + int value; + friend std::size_t hash_value(custom1 v) { return v.value; } +}; + +struct custom2 { + int value; + friend std::size_t hash_value(custom2 v) { return v.value; } +}; + +void test_variant_unique_types() +{ + custom1 x11 = { 0 }; + custom1 x12 = { 1 }; + custom2 x21 = { 0 }; + custom2 x22 = { 1 }; + + boost::hash hasher1; + boost::hash hasher2; + + BOOST_TEST(hasher1(x11) == hasher2(x21)); + BOOST_TEST(hasher1(x11) != hasher2(x22)); + BOOST_TEST(hasher1(x12) != hasher2(x21)); + BOOST_TEST(hasher1(x12) == hasher2(x22)); + + typedef std::variant variant_type; + + variant_type y11(x11); + variant_type y12(x12); + variant_type y21(x21); + variant_type y22(x22); + + boost::hash hasher; + + BOOST_TEST(hasher(y11) != hasher(y21)); + BOOST_TEST(hasher(y11) != hasher(y22)); + BOOST_TEST(hasher(y12) != hasher(y21)); + BOOST_TEST(hasher(y12) != hasher(y22)); +} + +#endif + +int main() +{ +#if BOOST_HASH_HAS_VARIANT + test_variant_int(); + test_variant_unique_types(); +#else + BOOST_LIGHTWEIGHT_TEST_OSTREAM << " not available." << std::endl; +#endif + return boost::report_errors(); +} From 27b2732916ba73178ce58ab8fa5e0c9600b327fe Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sun, 21 Jan 2018 21:09:50 +0000 Subject: [PATCH 11/20] Make hash_value(monostate) inline --- include/boost/container_hash/hash/hash.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/container_hash/hash/hash.hpp b/include/boost/container_hash/hash/hash.hpp index 4b10870..1165977 100644 --- a/include/boost/container_hash/hash/hash.hpp +++ b/include/boost/container_hash/hash/hash.hpp @@ -517,7 +517,7 @@ namespace boost #endif #if BOOST_HASH_HAS_VARIANT - std::size_t hash_value(std::monostate) { + inline std::size_t hash_value(std::monostate) { return 0x87654321; } From cb6a0246dfa8de20f938dcd3320df54e83d1b059 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sun, 21 Jan 2018 21:09:50 +0000 Subject: [PATCH 12/20] Test members in compile_test, rather than inheritance Inheritance from unary_function is deprecated in recent C++. Better to check the member types. Could probably drop test altogether. --- test/compile_time.hpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/test/compile_time.hpp b/test/compile_time.hpp index db6bc59..d7631b8 100644 --- a/test/compile_time.hpp +++ b/test/compile_time.hpp @@ -5,14 +5,16 @@ #include #include -#include +#include template void compile_time_tests(T*) { -#if !defined(_HAS_AUTO_PTR_ETC) || _HAS_AUTO_PTR_ETC - BOOST_STATIC_ASSERT((boost::is_base_and_derived< - std::unary_function, BOOST_HASH_TEST_NAMESPACE::hash >::value)); -#endif + BOOST_STATIC_ASSERT((boost::is_same::argument_type + >::value)); + BOOST_STATIC_ASSERT((boost::is_same::result_type + >::value)); } From 0ad83592af44d8bd793500f7570de83c7825a96f Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sun, 21 Jan 2018 21:09:50 +0000 Subject: [PATCH 13/20] Test g++-7, and display output from hash_info --- .travis.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.travis.yml b/.travis.yml index 21f9e8f..644cb20 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,16 @@ matrix: env: | USER_CONFIG="using gcc : : g++-4.8 -Werror ;" CXXSTD=03,11 + - compiler: g++-7 + env: | + USER_CONFIG="using gcc : : g++-7 -Werror ;" + CXXSTD=11,14,17 + addons: + apt: + packages: + - g++-7 + sources: + - ubuntu-toolchain-r-test - compiler: clang env: | USER_CONFIG="using clang : : clang++ -Werror ;" @@ -64,4 +74,5 @@ before_script: script: - cd ${TRAVIS_BUILD_DIR}/test + - ${HOME}/opt/bin/b2 --verbose-test -j 3 cxxstd=$CXXSTD -q ${BJAM_TOOLSET} include=${BOOST_ROOT} include=${TRAVIS_BUILD_DIR}/include hash_info - ${HOME}/opt/bin/b2 -j 3 cxxstd=$CXXSTD -q ${BJAM_TOOLSET} include=${BOOST_ROOT} include=${TRAVIS_BUILD_DIR}/include From 8963c38770484d87574eee5a6cc46f1c926275b0 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Mon, 22 Jan 2018 11:56:43 +0000 Subject: [PATCH 14/20] Fix hash_info for older Visual C++ --- test/hash_info.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/test/hash_info.cpp b/test/hash_info.cpp index 7159d1f..db63df9 100644 --- a/test/hash_info.cpp +++ b/test/hash_info.cpp @@ -15,11 +15,8 @@ struct msvc_version { std::size_t version; char const* description; - bool operator<(std::size_t v) const { - return version < v; - } - friend bool operator<(std::size_t v1, msvc_version const& v2) { - return v1 < v2.version; + friend bool operator<(msvc_version const& v1, msvc_version const& v2) { + return v1.version < v2.version; } }; @@ -45,11 +42,11 @@ void write_compiler_info() { {1912, "Visual C++ 14.12, VS2017 15.5"} }; - std::size_t msvc = BOOST_MSVC; + msvc_version msvc = { BOOST_MSVC, "" }; msvc_version* v = std::upper_bound(versions, versions + sizeof(versions) / sizeof(*versions), msvc) - 1; - std::size_t difference = BOOST_MSVC - v->version; + std::size_t difference = msvc.version - v->version; std::cout << v->description << std::endl; if (difference) { From 17809c3cbc5cf1e5287574baa69108de74af11f0 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Mon, 22 Jan 2018 12:18:05 +0000 Subject: [PATCH 15/20] Add appveyor tests --- .appveyor.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .appveyor.yml diff --git a/.appveyor.yml b/.appveyor.yml new file mode 100644 index 0000000..76189c2 --- /dev/null +++ b/.appveyor.yml @@ -0,0 +1,33 @@ +# Copyright 2017 Daniel James +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) + +version: 1.0.{build}-{branch} + +shallow_clone: true + +environment: + matrix: + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013 + TOOLSET: msvc-10.0,msvc-11.0,msvc-12.0 + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 + TOOLSET: msvc-14.0 + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 + TOOLSET: msvc-14.1 + +install: + - cd c:\projects + - curl -sSL -o boost.7z https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.7z + - 7z x boost.7z + - set BOOST_ROOT=c:\projects\boost_1_66_0 + - rd /s /q %BOOST_ROOT%\boost\functional\hash + - cd %BOOST_ROOT%\tools\build + - cmd /c bootstrap + - cd %APPVEYOR_BUILD_FOLDER% + - echo. 2>Jamroot.jam + +build: off + +test_script: + - cd %APPVEYOR_BUILD_FOLDER%\test + - cmd /c %BOOST_ROOT%\tools\build\b2 -j 3 toolset=%TOOLSET% include=%APPVEYOR_BUILD_FOLDER%\include include=%BOOST_ROOT% From e01239286c87c5d14635be4b0e39cd6f4f7b7323 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Wed, 24 Jan 2018 12:56:14 +0000 Subject: [PATCH 16/20] Avoid conversion warning --- test/hash_variant_test.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/hash_variant_test.cpp b/test/hash_variant_test.cpp index 80f317a..31520f4 100644 --- a/test/hash_variant_test.cpp +++ b/test/hash_variant_test.cpp @@ -48,12 +48,12 @@ void test_variant_int() struct custom1 { int value; - friend std::size_t hash_value(custom1 v) { return v.value; } + friend std::size_t hash_value(custom1 v) { return boost::hash_value(v.value); } }; struct custom2 { int value; - friend std::size_t hash_value(custom2 v) { return v.value; } + friend std::size_t hash_value(custom2 v) { return boost::hash_value(v.value); } }; void test_variant_unique_types() From 8ea85f5ad21e486206e6e4223013fd6753ed41aa Mon Sep 17 00:00:00 2001 From: Daniel James Date: Wed, 24 Jan 2018 13:29:52 +0000 Subject: [PATCH 17/20] Use error codes that are hopefully present on mingw --- test/hash_system_error_test.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/hash_system_error_test.cpp b/test/hash_system_error_test.cpp index 71eb714..14228d1 100644 --- a/test/hash_system_error_test.cpp +++ b/test/hash_system_error_test.cpp @@ -17,9 +17,9 @@ void test_error_code() { - std::error_code err1a = std::make_error_code(std::errc::address_family_not_supported); - std::error_code err1b = std::make_error_code(std::errc::address_family_not_supported); - std::error_code err2 = std::make_error_code(std::errc::address_in_use); + std::error_code err1a = std::make_error_code(std::errc::argument_list_too_long); + std::error_code err1b = std::make_error_code(std::errc::argument_list_too_long); + std::error_code err2 = std::make_error_code(std::errc::bad_file_descriptor); boost::hash hasher; @@ -30,9 +30,9 @@ void test_error_code() void test_error_condition() { - std::error_condition err1a = std::make_error_condition(std::errc::address_family_not_supported); - std::error_condition err1b = std::make_error_condition(std::errc::address_family_not_supported); - std::error_condition err2 = std::make_error_condition(std::errc::address_in_use); + std::error_condition err1a = std::make_error_condition(std::errc::directory_not_empty); + std::error_condition err1b = std::make_error_condition(std::errc::directory_not_empty); + std::error_condition err2 = std::make_error_condition(std::errc::filename_too_long); boost::hash hasher; From 1e263669cbb3989379eb460b89742f7e5e2a56d6 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Wed, 24 Jan 2018 13:37:35 +0000 Subject: [PATCH 18/20] Use `unsigned` for version number in hash_info.cpp Was getting a `size_t` to `unsigned int` conversion when writing to stream, so just use `unsigned` from the start. --- test/hash_info.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/hash_info.cpp b/test/hash_info.cpp index db63df9..34378f5 100644 --- a/test/hash_info.cpp +++ b/test/hash_info.cpp @@ -12,7 +12,7 @@ #if defined(BOOST_MSVC) struct msvc_version { - std::size_t version; + unsigned version; char const* description; friend bool operator<(msvc_version const& v1, msvc_version const& v2) { @@ -46,7 +46,7 @@ void write_compiler_info() { msvc_version* v = std::upper_bound(versions, versions + sizeof(versions) / sizeof(*versions), msvc) - 1; - std::size_t difference = msvc.version - v->version; + unsigned difference = msvc.version - v->version; std::cout << v->description << std::endl; if (difference) { From d45e3986f3d8706ee19da7a8b3283cd3a9af1983 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sat, 27 Jan 2018 11:47:09 +0000 Subject: [PATCH 19/20] Remove forwarding headers in container_hash --- include/boost/container_hash/hash.hpp | 7 ------- include/boost/container_hash/hash_fwd.hpp | 11 ----------- 2 files changed, 18 deletions(-) delete mode 100644 include/boost/container_hash/hash.hpp delete mode 100644 include/boost/container_hash/hash_fwd.hpp diff --git a/include/boost/container_hash/hash.hpp b/include/boost/container_hash/hash.hpp deleted file mode 100644 index 4a06833..0000000 --- a/include/boost/container_hash/hash.hpp +++ /dev/null @@ -1,7 +0,0 @@ - -// Copyright 2005-2009 Daniel James. -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - -#include - diff --git a/include/boost/container_hash/hash_fwd.hpp b/include/boost/container_hash/hash_fwd.hpp deleted file mode 100644 index 5ff4801..0000000 --- a/include/boost/container_hash/hash_fwd.hpp +++ /dev/null @@ -1,11 +0,0 @@ - -// Copyright 2005-2009 Daniel James. -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - -#include -#if defined(BOOST_HAS_PRAGMA_ONCE) -#pragma once -#endif - -#include From d20a68efdb13df9461321047766798ffa265e194 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sat, 27 Jan 2018 11:48:59 +0000 Subject: [PATCH 20/20] Move headers into top level of container_hash directory --- .../container_hash/{hash => }/detail/float_functions.hpp | 0 .../boost/container_hash/{hash => }/detail/hash_float.hpp | 4 ++-- include/boost/container_hash/{hash => }/detail/limits.hpp | 0 include/boost/container_hash/{hash => }/extensions.hpp | 2 +- include/boost/container_hash/{hash => }/hash.hpp | 6 +++--- include/boost/container_hash/{hash => }/hash_fwd.hpp | 0 include/boost/functional/hash.hpp | 2 +- include/boost/functional/hash/extensions.hpp | 2 +- include/boost/functional/hash/hash.hpp | 2 +- include/boost/functional/hash/hash_fwd.hpp | 2 +- include/boost/functional/hash_fwd.hpp | 2 +- test/extensions_hpp_test.cpp | 6 +++--- test/hash_float_test.hpp | 4 ++-- test/hash_number_test.cpp | 2 +- 14 files changed, 17 insertions(+), 17 deletions(-) rename include/boost/container_hash/{hash => }/detail/float_functions.hpp (100%) rename include/boost/container_hash/{hash => }/detail/hash_float.hpp (98%) rename include/boost/container_hash/{hash => }/detail/limits.hpp (100%) rename include/boost/container_hash/{hash => }/extensions.hpp (99%) rename include/boost/container_hash/{hash => }/hash.hpp (99%) rename include/boost/container_hash/{hash => }/hash_fwd.hpp (100%) diff --git a/include/boost/container_hash/hash/detail/float_functions.hpp b/include/boost/container_hash/detail/float_functions.hpp similarity index 100% rename from include/boost/container_hash/hash/detail/float_functions.hpp rename to include/boost/container_hash/detail/float_functions.hpp diff --git a/include/boost/container_hash/hash/detail/hash_float.hpp b/include/boost/container_hash/detail/hash_float.hpp similarity index 98% rename from include/boost/container_hash/hash/detail/hash_float.hpp rename to include/boost/container_hash/detail/hash_float.hpp index d0f7f55..f763428 100644 --- a/include/boost/container_hash/hash/detail/hash_float.hpp +++ b/include/boost/container_hash/detail/hash_float.hpp @@ -11,8 +11,8 @@ #pragma once #endif -#include -#include +#include +#include #include #include #include diff --git a/include/boost/container_hash/hash/detail/limits.hpp b/include/boost/container_hash/detail/limits.hpp similarity index 100% rename from include/boost/container_hash/hash/detail/limits.hpp rename to include/boost/container_hash/detail/limits.hpp diff --git a/include/boost/container_hash/hash/extensions.hpp b/include/boost/container_hash/extensions.hpp similarity index 99% rename from include/boost/container_hash/hash/extensions.hpp rename to include/boost/container_hash/extensions.hpp index d8e34db..393b702 100644 --- a/include/boost/container_hash/hash/extensions.hpp +++ b/include/boost/container_hash/extensions.hpp @@ -18,7 +18,7 @@ #pragma once #endif -#include +#include #include #include #include diff --git a/include/boost/container_hash/hash/hash.hpp b/include/boost/container_hash/hash.hpp similarity index 99% rename from include/boost/container_hash/hash/hash.hpp rename to include/boost/container_hash/hash.hpp index 1165977..76de793 100644 --- a/include/boost/container_hash/hash/hash.hpp +++ b/include/boost/container_hash/hash.hpp @@ -16,9 +16,9 @@ #if !defined(BOOST_FUNCTIONAL_HASH_HASH_HPP) #define BOOST_FUNCTIONAL_HASH_HASH_HPP -#include +#include #include -#include +#include #include #include #include @@ -757,5 +757,5 @@ namespace boost #if !defined(BOOST_HASH_NO_EXTENSIONS) \ && !defined(BOOST_FUNCTIONAL_HASH_EXTENSIONS_HPP) -#include +#include #endif diff --git a/include/boost/container_hash/hash/hash_fwd.hpp b/include/boost/container_hash/hash_fwd.hpp similarity index 100% rename from include/boost/container_hash/hash/hash_fwd.hpp rename to include/boost/container_hash/hash_fwd.hpp diff --git a/include/boost/functional/hash.hpp b/include/boost/functional/hash.hpp index 6122b35..327a3ec 100644 --- a/include/boost/functional/hash.hpp +++ b/include/boost/functional/hash.hpp @@ -3,4 +3,4 @@ // 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 diff --git a/include/boost/functional/hash/extensions.hpp b/include/boost/functional/hash/extensions.hpp index bd436fb..ab14211 100644 --- a/include/boost/functional/hash/extensions.hpp +++ b/include/boost/functional/hash/extensions.hpp @@ -3,4 +3,4 @@ // 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 diff --git a/include/boost/functional/hash/hash.hpp b/include/boost/functional/hash/hash.hpp index 6122b35..327a3ec 100644 --- a/include/boost/functional/hash/hash.hpp +++ b/include/boost/functional/hash/hash.hpp @@ -3,4 +3,4 @@ // 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 diff --git a/include/boost/functional/hash/hash_fwd.hpp b/include/boost/functional/hash/hash_fwd.hpp index aeffad0..62bc23c 100644 --- a/include/boost/functional/hash/hash_fwd.hpp +++ b/include/boost/functional/hash/hash_fwd.hpp @@ -3,4 +3,4 @@ // 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 diff --git a/include/boost/functional/hash_fwd.hpp b/include/boost/functional/hash_fwd.hpp index aeffad0..62bc23c 100644 --- a/include/boost/functional/hash_fwd.hpp +++ b/include/boost/functional/hash_fwd.hpp @@ -3,4 +3,4 @@ // 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 diff --git a/test/extensions_hpp_test.cpp b/test/extensions_hpp_test.cpp index 54d1054..a388c23 100644 --- a/test/extensions_hpp_test.cpp +++ b/test/extensions_hpp_test.cpp @@ -3,14 +3,14 @@ // 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) -// Check that boost/container_hash/hash/extensions.hpp works okay. +// Check that boost/container_hash/extensions.hpp works okay. // -// It probably should be in boost/container_hash/hash/detail, but since it isn't it +// It probably should be in boost/container_hash/detail, but since it isn't it // should work. #include "./config.hpp" -#include +#include int main() { int x[2] = { 2, 3 }; diff --git a/test/hash_float_test.hpp b/test/hash_float_test.hpp index a73c31f..ab79a12 100644 --- a/test/hash_float_test.hpp +++ b/test/hash_float_test.hpp @@ -14,8 +14,8 @@ #include #include -#include -#include +#include +#include #include #include diff --git a/test/hash_number_test.cpp b/test/hash_number_test.cpp index c78783e..72ab626 100644 --- a/test/hash_number_test.cpp +++ b/test/hash_number_test.cpp @@ -14,7 +14,7 @@ #include #include -#include +#include #include #include "./compile_time.hpp"