Skip to content

Commit aa66e64

Browse files
committed
Update gtl::Hash so that std::hash<Foo*> can be overridden
1 parent 47fe779 commit aa66e64

File tree

3 files changed

+43
-10
lines changed

3 files changed

+43
-10
lines changed

docs/new_release.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
- update version in gtl_config.hpp
2+
- update version in comment on top of CMakeLists.txt and in README.md
3+
- git commit
4+
- git push
5+
- create the new release on github (tag `v1.1.5` - use semantic versioning)
6+
- download the tar.gz from github, and use `sha256sum gtl-1.1.5.tar.gz` on linux to get the sha256
7+
8+
## conan
9+
10+
- fork and clone [conan-center repo](https://github.com/conan-io/conan-center-index)
11+
(or sync + git pull)
12+
- git checkout -b gtl_1.1.5
13+
- update: `recipes/gtl/all/conandata.yml` and `recipes/gtl/config.yml`
14+
- sudo pip install conan -U
15+
- cd recipes/gtl/all
16+
- conan create conanfile.py gtl/1.1.5@ -pr:b=default -pr:h=default
17+
- git diff
18+
- git commit ...
19+
- git push origin gtl_1.1.5
20+
- create PR like [this](https://github.com/conan-io/conan-center-index/pull/13161)
21+
22+
23+
## vcpkg
24+
25+
- fork and clone [vcpkg repo](https://github.com/microsoft/vcpkg)
26+
(or sync + git pull)
27+
- git checkout -b gtl_1.1.5
28+
- update ports/gtl/portfile.cmake and ports/gtl/vcpkg.json
29+
30+
in windows, non-cygwin console
31+
32+
- set VCPKG_ROOT=
33+
- vcpkg install gtl --triplet x64-windows
34+
- # update sha in portfile.cmake
35+
- git diff
36+
- git commit ...
37+
- vcpkg x-add-version --all --overwrite-version ## (or ./vcpkg.exe --no-dry-run upgrade )
38+
- git diff
39+
- git commit ...
40+
- git push origin gtl_1.1.5

include/gtl/phmap.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4932,7 +4932,9 @@ struct HashEq<T*>
49324932
using is_transparent = void;
49334933
template <class U>
49344934
size_t operator()(const U& ptr) const {
4935-
return gtl::Hash<const T*>{}(HashEq::ToPtr(ptr));
4935+
// we want phmap::Hash<T*> and not phmap::Hash<const T*>
4936+
// so "struct std::hash<T*> " override works
4937+
return gtl::Hash<T*>{}((T*)(uintptr_t)HashEq::ToPtr(ptr));
49364938
}
49374939
};
49384940

include/gtl/phmap_utils.hpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -166,15 +166,6 @@ struct Hash
166166
}
167167
};
168168

169-
template <class T>
170-
struct Hash<T *>
171-
{
172-
inline size_t operator()(const T *val) const noexcept
173-
{
174-
return static_cast<size_t>(reinterpret_cast<const uintptr_t>(val));
175-
}
176-
};
177-
178169
template<class ArgumentType, class ResultType>
179170
struct gtl_unary_function
180171
{

0 commit comments

Comments
 (0)