This patch series attempts to remove some unnecessary complexity in the internals of std::unordered_xxx containers. There is a lot of overloading, tag dispatching, and inheritance that can be removed by using modern C++ features (with appropriate pragmas to disable warnings for older -std modes).
Most of these commits were already pushed to https://forge.sourceware.org/gcc/gcc-TEST/pulls/15 which was linked to from https://inbox.sourceware.org/libstdc++/[email protected]/ but this is the first time I've posted most of the patches to gcc-patches. Since first linking to the forge pull request a week ago, I've pushed a couple of the smaller, independent changes that didn't depend on the rest of the series, made changes to the 03/12 "Refactor _Hashtable insertion" commit, and added the 12/12 "Add _Hashtable::_M_locate(const key_type&)" commit. N.B. Patch 11/12 was previously posted as https://inbox.sourceware.org/gcc-patches/cacb0b4nmy3fxujhjbkhiu4innxzn_vzmrmm1gzzqdz4gte5...@mail.gmail.com/T/#t but I've included it again in this series, because otherwise the last patch in the series won't apply cleanly and CI checks will fail. Tested powerpc64le-linux and x86_64-linux. Diffstat for the headers (where reducing the amount of code is good): libstdc++-v3/include/bits/hashtable.h | 1119 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------- libstdc++-v3/include/bits/hashtable_policy.h | 504 +++++----------------------------------------- libstdc++-v3/include/bits/unordered_map.h | 19 +- libstdc++-v3/include/bits/unordered_set.h | 19 +- 4 files changed, 722 insertions(+), 939 deletions(-) Diffstat for the tests (where adding code is good): libstdc++-v3/testsuite/23_containers/unordered_map/96088.cc | 21 +++++++---- libstdc++-v3/testsuite/23_containers/unordered_map/modifiers/merge.cc | 130 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ libstdc++-v3/testsuite/23_containers/unordered_multimap/modifiers/merge.cc | 119 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ libstdc++-v3/testsuite/23_containers/unordered_multiset/allocator/move_assign.cc | 5 +-- libstdc++-v3/testsuite/23_containers/unordered_multiset/modifiers/merge.cc | 121 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ libstdc++-v3/testsuite/23_containers/unordered_set/96088.cc | 14 ++++---- libstdc++-v3/testsuite/23_containers/unordered_set/allocator/move_assign.cc | 10 +++--- libstdc++-v3/testsuite/23_containers/unordered_set/modifiers/merge.cc | 128 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 528 insertions(+), 20 deletions(-)
