Remove some flags backed out from earlier attempts at getting MING32W
[oota-llvm.git] / include / llvm / ADT / SetVector.h
index 6135e53286121496dc1f96b1ee2abbc1813dddad..f8b37c591838d4cd34c40febd4b751c44b5504da 100644 (file)
@@ -1,13 +1,13 @@
 //===- llvm/ADT/SetVector.h - Set with insert order iteration ---*- C++ -*-===//
-// 
+//
 //                     The LLVM Compiler Infrastructure
 //
 // This file was developed by Reid Spencer and is distributed under
 // the University of Illinois Open Source License. See LICENSE.TXT for details.
-// 
+//
 //===----------------------------------------------------------------------===//
 //
-// This file implements a set that has insertion order iteration 
+// This file implements a set that has insertion order iteration
 // characteristics. This is useful for keeping a set of things that need to be
 // visited later but in a deterministic order (insertion order). The interface
 // is purposefully minimal.
 #include <set>
 #include <vector>
 #include <cassert>
+#include <algorithm>
 
 namespace llvm {
 
-/// This class provides a way to keep a set of things that also has the 
+/// This class provides a way to keep a set of things that also has the
 /// property of a deterministic iteration order. The order of iteration is the
 /// order of insertion.
 /// @brief A vector that has set insertion semantics.
@@ -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 = std::find(vector_.begin(),vector_.end(),X);
+      assert(I != vector_.end() && "Corrupted SetVector instances!");
+      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 {