[PATCH] D49030: Add OrderedSet, with constant-time insertion and removal, and random access iteration.

Mandeep Singh Grang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 6 11:09:08 PDT 2018


mgrang added a comment.

Some nits.



================
Comment at: include/llvm/ADT/OrderedSet.h:35
+  // present. Return a pair indicating its position in the vector
+  // and the whether the insertion happend or not.
+  std::pair<iterator, bool> insert(ValueT value) {
----------------
happend -> happened


================
Comment at: include/llvm/ADT/OrderedSet.h:40
+      Vec.push_back(value);
+      return { Vec.end()-1, true };
+    }
----------------
Space needed around arithmetic operator.


================
Comment at: include/llvm/ADT/OrderedSet.h:42
+    }
+    return { Vec.begin()+SetIns.first->second, false };
+  }
----------------
Space needed around arithmetic operator.


================
Comment at: include/llvm/ADT/OrderedSet.h:71
+      Map.erase(MapFind);
+      if (Index != Vec.size()-1) {
+        std::swap(Vec[Index], Vec.back());
----------------
Space needed around arithmetic operator.


https://reviews.llvm.org/D49030





More information about the llvm-commits mailing list