[PATCH] D25404: [ADT] Let MapVector handle non-copyable values.
Justin Lebar via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 10 09:25:21 PDT 2016
jlebar marked 3 inline comments as done.
jlebar added inline comments.
================
Comment at: llvm/include/llvm/ADT/MapVector.h:117
+ }
+ return std::make_pair(begin() + I, false);
+ }
----------------
timshen wrote:
> Do you want to static_assert on random_access_iterator_tag in the class?
I think that should be a separate change -- it's the same as the other insert() function.
================
Comment at: llvm/include/llvm/ADT/MapVector.h:159
size_t Index = Next - Vector.begin();
for (auto &I : Map) {
assert(I.second != Index && "Index was already erased!");
----------------
timshen wrote:
> This O(n) behavior is unfortunate. It could have been O(1), by swapping the to-be-erased element with back(), then pop_back().
>
> Just a comment, no change required. :)
Except that wouldn't preserve order.
https://reviews.llvm.org/D25404
More information about the llvm-commits
mailing list