https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117404
--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Nathan Myers <[email protected]>: https://gcc.gnu.org/g:3f7905550483408a2c4c5096a1adc8d7e863eb12 commit r16-7292-g3f7905550483408a2c4c5096a1adc8d7e863eb12 Author: Nathan Myers <[email protected]> Date: Mon Sep 22 23:52:52 2025 -0400 libstdc++: container erasure overloads (P2077) [PR117404] Remaining to do: * Add new declarations in debug headers too. Implement C++23 P2077R3 "Heterogeneous erasure overloads for associative containers". Adds template overloads for members erase and extract to address elements using an alternative key type, such as string_view for a container of strings, without need to construct an actual key object. The new overloads enforce concept __heterogeneous_tree_key or __heterogeneous_hash_key to verify the function objects provided meet requirements, and that the key supplied is not an iterator or the native key. libstdc++-v3/ChangeLog: PR libstdc++/117404 * include/bits/version.def (associative_heterogeneous_erasure): Define. * include/bits/version.h: Regenerate. * include/std/map: Request new feature from version.h. * include/std/set: Same. * include/std/unordered_map: Same. * include/std/unordered_set: Same. * include/bits/stl_map.h (extract, erase): Define overloads. * include/bits/stl_set.h: Same. * include/bits/stl_multimap.h: Same. * include/bits/stl_multiset.h: Same. * include/bits/unordered_map.h: Same, 2x. * include/bits/unordered_set.h: Same, 2x. * include/bits/stl_function.h (concepts __not_container_iterator, __heterogeneous_key): Define. * include/bits/hashtable.h (_M_find_before_node, _M_locate, extract): Delegate to more-general _tr version. (_M_find_before_node_tr, _M_locate_tr, _M_extract_tr, _M_erase_tr): Add new members to support a heterogeneous key argument. (_M_erase_some): Add new helper function. (concept __heterogeneous_hash_key): Define. * include/bits/stl_tree.h (_M_lower_bound_tr, _M_upper_bound_tr, _M_erase_tr, _M_extract_tr): Add new members to support a heterogeneous key argument. (concept __heterogeneous_tree_key): Define. * testsuite/23_containers/map/modifiers/hetero/erase.cc: New test. * testsuite/23_containers/multimap/modifiers/hetero/erase.cc: Same. * testsuite/23_containers/multiset/modifiers/hetero/erase.cc: Same. * testsuite/23_containers/set/modifiers/hetero/erase.cc: Same. * testsuite/23_containers/unordered_map/modifiers/hetero/erase.cc: Same. * testsuite/23_containers/unordered_multimap/modifiers/hetero/erase.cc: Same. * testsuite/23_containers/unordered_multiset/modifiers/hetero/erase.cc: Same. * testsuite/23_containers/unordered_set/modifiers/hetero/erase.cc: Same.
