Implement the remove method for deleting entries from the SetVector.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16283 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Reid Spencer 2004-09-11 04:25:58 +00:00
parent 57a0efa322
commit 0bdc620c16

View File

@ -20,6 +20,7 @@
#include <set>
#include <vector>
#include <cassert>
#include <algorithm>
namespace llvm {
@ -108,6 +109,16 @@ public:
vector_.push_back(*Start);
}
/// @brief Remove an item from the set vector.
void remove(const value_type& X) {
if (0 < set_.erase(X)) {
iterator I = find(vector_.begin(),vector_.end(),X);
if (I != vector_.end())
vector_.erase(I);
}
}
/// @returns 0 if the element is not in the SetVector, 1 if it is.
/// @brief Count the number of elements of a given key in the SetVector.
size_type count(const key_type &key) const {