aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/llvm/ADT/SetVector.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/llvm/ADT/SetVector.h b/include/llvm/ADT/SetVector.h
index 6135e53286..8d7382e056 100644
--- a/include/llvm/ADT/SetVector.h
+++ b/include/llvm/ADT/SetVector.h
@@ -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 {