When using directly __gnu_debug::vector the std::erase_if is called with a
reference to the std::vector base class and so is missing the invalidation
of the iterators implied by this operation.
To fix this provide a std::erase_if overload dedicated to __gnu_debug::vector.
Doing so we can cleanup the implementation dedicated to std::vector from any
_GLIBCXX_DEBUG consideration.
libstdc++-v3/ChangeLog:
* include/debug/vector (std::erase_if, std::erase): New overloads for
std::__debug::vector instances.
* include/std/vector (std::erase_if, std::erase): Make overloads specific
to normal std::vector implementation.
* testsuite/23_containers/vector/debug/erase.cc: New test case.
* testsuite/23_containers/vector/debug/invalidation/erase.cc: New test case.