On Thu, 7 Oct 2021 at 15:02, Jonathan Wakely wrote: > > The solution is simple: > > erase_if(set<_Key, _Compare, _Alloc>& __cont, _Predicate __pred) > - { return __detail::__erase_nodes_if(__cont, __pred); } > + { > + _GLIBCXX_STD_C::set<_Key, _Compare, _Alloc>& __c = __cont; > + return __detail::__erase_nodes_if(__c, __pred); > + } > > > i.e. just bind a reference to the non-debug container type. For > non-debug mode, that is a no-op. For debug mode it binds to the base, > and the rest of the function works directly on the base, without safe > iterators. > > I'm testing the patch now. Tested on powerpc64le-linux and pushed to trunk now.