This is an archive of the discontinued LLVM Phabricator instance.

[ADT] Let MapVector handle non-copyable values.
ClosedPublic

Authored by jlebar on Oct 9 2016, 11:14 AM.

Details

Summary

The keys must still be copyable, because we store two copies of them.

Event Timeline

jlebar updated this revision to Diff 74075.Oct 9 2016, 11:14 AM
jlebar retitled this revision from to [ADT] Let MapVector handle non-copyable values..
jlebar updated this object.
jlebar added a reviewer: timshen.
jlebar added a subscriber: llvm-commits.
timshen added inline comments.Oct 10 2016, 1:33 AM
llvm/include/llvm/ADT/MapVector.h
113

std::move(KV)?

117

Do you want to static_assert on random_access_iterator_tag in the class?

159

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. :)

jlebar marked 3 inline comments as done.Oct 10 2016, 9:25 AM
jlebar added inline comments.
llvm/include/llvm/ADT/MapVector.h
117

I think that should be a separate change -- it's the same as the other insert() function.

159

Except that wouldn't preserve order.

jlebar accepted this revision.Oct 10 2016, 3:42 PM
jlebar added a reviewer: jlebar.
jlebar marked 2 inline comments as done.
This revision is now accepted and ready to land.Oct 10 2016, 3:42 PM