On Thu, 18 Nov 2021 at 22:05, François Dumont via Libstdc++ < libstd...@gcc.gnu.org> wrote:
> Hi > > Here is a proposal to limit performance impact of _GLIBCXX_DEBUG > mode on __erase_nodes_if. > > As you can see I am adding erase overloads on the Debug container > to accept base iterators. So it exposes an additional non-Standard > method, do you think it is any issue. > I think this is fine - I can't think of a way that this could make user code do the wrong thing. > > Note that I've started doing something similar for the vector/deque > adding this time erase(_Base_const_iterator, _Base_const_iterator) > overloads. But in this case it results in ambiguous erase calls, even if > I remove the _Safe_iterator cast operator to the base iterator. > > libstdc++: [_GLIBCXX_DEBUG] Reduce performance impact on std::erase_if > > Bypass the _GLIBCXX_DEBUG additional checks in > std::__detail::__erase_node_if used > by all implementations of std::erase_if for node based containers. > > libstdc++-v3/ChangeLog: > > * include/bits/erase_if.h (__erase_nodes_if): Add > _UnsafeContainer template > parameter. Use it to get iterators to work with. > * include/debug/macros.h (__glibcxx_check_erase2): New. > * include/debug/map.h (map<>::erase(_Base_const_iterator)): > New. > (map<>::erase(const_iterator)): Use latter. > * include/debug/multimap.h > (multimap<>::erase(_Base_const_iterator)): New. > (multimap<>::erase(const_iterator)): Use latter. > * include/debug/multiset.h > (multiset<>::erase(_Base_const_iterator)): New. > (multiset<>::erase(const_iterator)): Use latter. > * include/debug/set.h (set<>::erase(_Base_const_iterator)): > New. > (set<>::erase(const_iterator)): Use latter. > * include/debug/unordered_map > (unordered_map<>::erase(_Base_const_iterator)): New. > (unordered_multimap<>::erase(const_iterator)): New. > * include/debug/unordered_set > (unordered_set<>::erase(_Base_const_iterator)): New. > (unordered_multiset<>::erase(const_iterator)): New. > * include/experimental/map (erase_if): Adapt. > * include/experimental/set (erase_if): Adapt. > * include/experimental/unordered_map (erase_if): Adapt. > * include/experimental/unordered_set (erase_if): Adapt. > * include/std/map (erase_if): Adapt. > * include/std/set (erase_if): Adapt. > * include/std/unordered_map (erase_if): Adapt. > * include/std/unordered_set (erase_if): Adapt. > > Tested under Linux x86_64, > > Ok to commit ? > OK, thanks.