From e92eae9eb24c3ba066fc8c4b213608ea2d216d5a Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Tue, 20 Sep 2022 21:17:41 +0300 Subject: [PATCH] Treat char8_t and std::byte as char types in hash_range --- include/boost/container_hash/detail/hash_range.hpp | 8 ++++++++ test/hash_container_test.cpp | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/include/boost/container_hash/detail/hash_range.hpp b/include/boost/container_hash/detail/hash_range.hpp index 4388870..28fd239 100644 --- a/include/boost/container_hash/detail/hash_range.hpp +++ b/include/boost/container_hash/detail/hash_range.hpp @@ -27,6 +27,14 @@ template<> struct is_char_type: public boost::true_type {}; template<> struct is_char_type: public boost::true_type {}; template<> struct is_char_type: public boost::true_type {}; +#if defined(__cpp_char8_t) && __cpp_char8_t >= 201811L +template<> struct is_char_type: public boost::true_type {}; +#endif + +#if defined(__cpp_lib_byte) && __cpp_lib_byte >= 201603L +template<> struct is_char_type: public boost::true_type {}; +#endif + #endif template diff --git a/test/hash_container_test.cpp b/test/hash_container_test.cpp index f24c3d5..efb62f2 100644 --- a/test/hash_container_test.cpp +++ b/test/hash_container_test.cpp @@ -48,5 +48,13 @@ int main() test(); test(); +#if defined(__cpp_char8_t) && __cpp_char8_t >= 201811L + test(); +#endif + +#if defined(__cpp_lib_byte) && __cpp_lib_byte >= 201603L + test(); +#endif + return boost::report_errors(); }