[PATCH] D18281: [SetVector] Add erase() method

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 24 13:41:24 PDT 2016


dblaikie added inline comments.

================
Comment at: include/llvm/ADT/SetVector.h:159-165
@@ +158,9 @@
+  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.");
+    assert(set_.count(V) && "Corrupted SetVector instances!");
+    set_.erase(V);
+    return vector_.erase(VI);
+  }
----------------
Ah, right - I've fixed SmallVector (in r264330) to match C++11's spec here, where the iterators to erase are const_iterators. That should help.


http://reviews.llvm.org/D18281





More information about the llvm-commits mailing list