Index: include/llvm/ADT/SetVector.h =================================================================== --- include/llvm/ADT/SetVector.h +++ include/llvm/ADT/SetVector.h @@ -151,6 +151,21 @@ return false; } + /// \brief Erase a single element from the set vector. + /// \returns an iterator pointing to the next element that followed the + /// element erased. This is the end of the SetVector if the last element is + /// erased. + iterator erase(iterator I) { + const key_type &V = *I; + typename vector_type::iterator VI = + std::find(vector_.begin(), vector_.end(), V); + assert(VI != vector_.end() && "Iterator to erase is out of bounds."); + if (!set_.erase(V)) { + assert(false && "Corrupted SetVector instances!"); + } + return vector_.erase(VI); + } + /// \brief Remove items from the set vector based on a predicate function. /// /// This is intended to be equivalent to the following code, if we could