From aa66e64f61fe71e91ca59f702cda57f394cdde59 Mon Sep 17 00:00:00 2001 From: greg7mdp Date: Sat, 1 Oct 2022 16:39:01 -0400 Subject: [PATCH] Update gtl::Hash so that std::hash can be overridden --- docs/new_release.md | 40 +++++++++++++++++++++++++++++++++++++ include/gtl/phmap.hpp | 4 +++- include/gtl/phmap_utils.hpp | 9 --------- 3 files changed, 43 insertions(+), 10 deletions(-) create mode 100644 docs/new_release.md diff --git a/docs/new_release.md b/docs/new_release.md new file mode 100644 index 0000000..22408da --- /dev/null +++ b/docs/new_release.md @@ -0,0 +1,40 @@ +- update version in gtl_config.hpp +- update version in comment on top of CMakeLists.txt and in README.md +- git commit +- git push +- create the new release on github (tag `v1.1.5` - use semantic versioning) +- download the tar.gz from github, and use `sha256sum gtl-1.1.5.tar.gz` on linux to get the sha256 + +## conan + +- fork and clone [conan-center repo](https://github.com/conan-io/conan-center-index) + (or sync + git pull) +- git checkout -b gtl_1.1.5 +- update: `recipes/gtl/all/conandata.yml` and `recipes/gtl/config.yml` +- sudo pip install conan -U +- cd recipes/gtl/all +- conan create conanfile.py gtl/1.1.5@ -pr:b=default -pr:h=default +- git diff +- git commit ... +- git push origin gtl_1.1.5 +- create PR like [this](https://github.com/conan-io/conan-center-index/pull/13161) + + +## vcpkg + +- fork and clone [vcpkg repo](https://github.com/microsoft/vcpkg) + (or sync + git pull) +- git checkout -b gtl_1.1.5 +- update ports/gtl/portfile.cmake and ports/gtl/vcpkg.json + +in windows, non-cygwin console + +- set VCPKG_ROOT= +- vcpkg install gtl --triplet x64-windows +- # update sha in portfile.cmake +- git diff +- git commit ... +- vcpkg x-add-version --all --overwrite-version ## (or ./vcpkg.exe --no-dry-run upgrade ) +- git diff +- git commit ... +- git push origin gtl_1.1.5 diff --git a/include/gtl/phmap.hpp b/include/gtl/phmap.hpp index 407a919..08427f7 100644 --- a/include/gtl/phmap.hpp +++ b/include/gtl/phmap.hpp @@ -4932,7 +4932,9 @@ struct HashEq using is_transparent = void; template size_t operator()(const U& ptr) const { - return gtl::Hash{}(HashEq::ToPtr(ptr)); + // we want phmap::Hash and not phmap::Hash + // so "struct std::hash " override works + return gtl::Hash{}((T*)(uintptr_t)HashEq::ToPtr(ptr)); } }; diff --git a/include/gtl/phmap_utils.hpp b/include/gtl/phmap_utils.hpp index 74d6ca0..a6921d7 100644 --- a/include/gtl/phmap_utils.hpp +++ b/include/gtl/phmap_utils.hpp @@ -166,15 +166,6 @@ struct Hash } }; -template -struct Hash -{ - inline size_t operator()(const T *val) const noexcept - { - return static_cast(reinterpret_cast(val)); - } -}; - template struct gtl_unary_function {