]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: Refactor Hashtable erasure
authorJonathan Wakely <jwakely@redhat.com>
Thu, 31 Oct 2024 19:53:55 +0000 (19:53 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Wed, 13 Nov 2024 20:21:39 +0000 (20:21 +0000)
commit73676cfb201e988bc086a8aeb63223f66f7b6252
tree62bb55308ad4969c75736be7d7392c482e048357
parentce2cf1f03295b7992a8e3eae3c703845f045db27
libstdc++: Refactor Hashtable erasure

This reworks the internal member functions for erasure from
unordered containers, similarly to the earlier commit doing it for
insertion.

Instead of multiple overloads of _M_erase which are selected via tag
dispatching, the erase(const key_type&) member can use 'if constexpr' to
choose an appropriate implementation (returning after erasing a single
element for unique keys, or continuing to erase all equivalent elements
for non-unique keys).

libstdc++-v3/ChangeLog:

* include/bits/hashtable.h (_Hashtable::_M_erase): Remove
overloads for erasing by key, moving logic to ...
(_Hashtable::erase): ... here.

Reviewed-by: François Dumont <fdumont@gcc.gnu.org>
libstdc++-v3/include/bits/hashtable.h