[llvm-commits] CVS: llvm/include/llvm/ADT/SetVector.h
Reid Spencer
reid at x10sys.com
Fri Sep 10 21:26:08 PDT 2004
Changes in directory llvm/include/llvm/ADT:
SetVector.h updated: 1.6 -> 1.7
---
Log message:
Implement the remove method for deleting entries from the SetVector.
---
Diffs of the changes: (+11 -0)
Index: llvm/include/llvm/ADT/SetVector.h
diff -u llvm/include/llvm/ADT/SetVector.h:1.6 llvm/include/llvm/ADT/SetVector.h:1.7
--- llvm/include/llvm/ADT/SetVector.h:1.6 Wed Sep 1 17:55:34 2004
+++ llvm/include/llvm/ADT/SetVector.h Fri Sep 10 23:25:58 2004
@@ -20,6 +20,7 @@
#include <set>
#include <vector>
#include <cassert>
+#include <algorithm>
namespace llvm {
@@ -108,6 +109,16 @@
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 {
More information about the llvm-commits
mailing list