From 83a874ed49f55336a95d8e264d36eee431cd949a Mon Sep 17 00:00:00 2001 From: Daniel James Date: Fri, 13 Apr 2018 09:31:18 +0100 Subject: [PATCH 1/6] More general purpose support for iterators with odd reference type (trac #13501) In the last release I added explicit support for `vector` which wasn't working with libc++ because the iterator's `operator*` returned a proxy reference type. Other implementations return a `bool` for const iterators, so they happened to work okay. This solves the problem in a more general purpose way by instantiating `hash_combine` for the iterator `value_type`. So the type returned by `operator*` will be implicitly casted to the correct type. --- include/boost/container_hash/extensions.hpp | 51 --------------------- include/boost/container_hash/hash.hpp | 5 +- 2 files changed, 3 insertions(+), 53 deletions(-) diff --git a/include/boost/container_hash/extensions.hpp b/include/boost/container_hash/extensions.hpp index 4eebb4b..393b702 100644 --- a/include/boost/container_hash/extensions.hpp +++ b/include/boost/container_hash/extensions.hpp @@ -22,7 +22,6 @@ #include #include #include -#include #if !defined(BOOST_NO_CXX11_HDR_ARRAY) # include @@ -71,56 +70,6 @@ namespace boost return seed; } - inline std::size_t hash_range( - std::vector::iterator first, - std::vector::iterator last) - { - std::size_t seed = 0; - - for(; first != last; ++first) - { - hash_combine(seed, *first); - } - - return seed; - } - - inline std::size_t hash_range( - std::vector::const_iterator first, - std::vector::const_iterator last) - { - std::size_t seed = 0; - - for(; first != last; ++first) - { - hash_combine(seed, *first); - } - - return seed; - } - - inline void hash_range( - std::size_t& seed, - std::vector::iterator first, - std::vector::iterator last) - { - for(; first != last; ++first) - { - hash_combine(seed, *first); - } - } - - inline void hash_range( - std::size_t& seed, - std::vector::const_iterator first, - std::vector::const_iterator last) - { - for(; first != last; ++first) - { - hash_combine(seed, *first); - } - } - template std::size_t hash_value(std::vector const& v) { diff --git a/include/boost/container_hash/hash.hpp b/include/boost/container_hash/hash.hpp index 76de793..fd814a2 100644 --- a/include/boost/container_hash/hash.hpp +++ b/include/boost/container_hash/hash.hpp @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -426,7 +427,7 @@ namespace boost for(; first != last; ++first) { - hash_combine(seed, *first); + hash_combine::value_type>(seed, *first); } return seed; @@ -437,7 +438,7 @@ namespace boost { for(; first != last; ++first) { - hash_combine(seed, *first); + hash_combine::value_type>(seed, *first); } } From f054fe932f4d5173bfd6dad5bcff5738a7aff0be Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sun, 15 Apr 2018 23:29:47 +0100 Subject: [PATCH 2/6] Fix appveyor build --- .appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index a1c6aed..2247248 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -18,9 +18,9 @@ environment: install: - cd c:\projects - - curl -sSL -o boost.7z https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_67_0.7z + - curl -sSL -o boost.7z https://dl.bintray.com/boostorg/release/1.67.0/source/boost_1_67_0.7z - 7z x boost.7z - - set BOOST_ROOT=c:\projects\boost_1_66_0 + - set BOOST_ROOT=c:\projects\boost_1_67_0 - rd /s /q %BOOST_ROOT%\boost\functional\hash - cd %BOOST_ROOT%\tools\build - cmd /c bootstrap From 81a65eb01cb187a166c92b68ad3c3e330ea1e2ad Mon Sep 17 00:00:00 2001 From: Mike Dev Date: Tue, 18 Sep 2018 13:19:15 +0200 Subject: [PATCH 3/6] [CMake] Add minimal cmake file Only supports "add_subdirectory" workflow and doesn't run unit-tests. It generates a INTERFACE cmake target that other libraries can use to express their dependency on Boost.ContainerHash and get usage requiremments, such as the include directory. --- CMakeLists.txt | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..76236f8 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,23 @@ +# Copyright 2018 Mike Dev +# 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 + +cmake_minimum_required(VERSION 3.5) +project(BoostContainerHash LANGUAGES CXX) + +add_library(boost_container_hash INTERFACE) +add_library(Boost::container_hash ALIAS boost_container_hash) + +target_include_directories(boost_container_hash INTERFACE include) + +target_link_libraries(boost_container_hash + INTERFACE + Boost::assert + Boost::config + Boost::core + Boost::detail + Boost::integer + Boost::static_assert + Boost::type_traits +) + From 90a0e3663875973909f77062dc274081bf32dc0d Mon Sep 17 00:00:00 2001 From: Andrey Date: Fri, 9 Aug 2019 17:23:16 +0300 Subject: [PATCH 4/6] Removed usage of std::unary_function for C++17 compliance --- include/boost/container_hash/hash.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/container_hash/hash.hpp b/include/boost/container_hash/hash.hpp index fd814a2..4846b5e 100644 --- a/include/boost/container_hash/hash.hpp +++ b/include/boost/container_hash/hash.hpp @@ -119,7 +119,7 @@ namespace boost { namespace hash_detail { -#if defined(_HAS_AUTO_PTR_ETC) && !_HAS_AUTO_PTR_ETC +#if defined(_HAS_AUTO_PTR_ETC) && !_HAS_AUTO_PTR_ETC || defined(BOOST_NO_CXX98_FUNCTION_BASE) template struct hash_base { From fd310d27065dbd54e27c3319385e94bea1d3b51d Mon Sep 17 00:00:00 2001 From: Andrey Date: Fri, 9 Aug 2019 17:23:16 +0300 Subject: [PATCH 5/6] Removed usage of std::unary_function for C++17 compliance --- include/boost/container_hash/hash.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/boost/container_hash/hash.hpp b/include/boost/container_hash/hash.hpp index 4846b5e..6192295 100644 --- a/include/boost/container_hash/hash.hpp +++ b/include/boost/container_hash/hash.hpp @@ -119,7 +119,11 @@ namespace boost { namespace hash_detail { +<<<<<<< HEAD #if defined(_HAS_AUTO_PTR_ETC) && !_HAS_AUTO_PTR_ETC || defined(BOOST_NO_CXX98_FUNCTION_BASE) +======= +#if defined(BOOST_NO_CXX98_FUNCTION_BASE) +>>>>>>> Removed usage of std::unary_function for C++17 compliance template struct hash_base { From 5f858645a02713906f98edbf5def3ffa95664520 Mon Sep 17 00:00:00 2001 From: Andrey Date: Fri, 9 Aug 2019 17:23:16 +0300 Subject: [PATCH 6/6] Removed usage of std::unary_function for C++17 compliance --- include/boost/container_hash/hash.hpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/include/boost/container_hash/hash.hpp b/include/boost/container_hash/hash.hpp index 6192295..7aac2fa 100644 --- a/include/boost/container_hash/hash.hpp +++ b/include/boost/container_hash/hash.hpp @@ -119,11 +119,7 @@ namespace boost { namespace hash_detail { -<<<<<<< HEAD -#if defined(_HAS_AUTO_PTR_ETC) && !_HAS_AUTO_PTR_ETC || defined(BOOST_NO_CXX98_FUNCTION_BASE) -======= #if defined(BOOST_NO_CXX98_FUNCTION_BASE) ->>>>>>> Removed usage of std::unary_function for C++17 compliance template struct hash_base {