[PATCH] D61366: [libcxx] [test] Don't assert that moved-from containers with non-POCMA allocators are empty.

Arthur O'Dwyer via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 14 15:26:49 PDT 2019


Quuxplusone added a comment.

>> Are you not allowed to move the containers elements in this case?
> 
> Correct. The allocator is not POCMA and not equal, so it's functionally the same as doing `assign(make_move_iterator(begin()), make_move_iterator(end()))`.

In case the clarification helps some reader: When the allocator is not-POCMA-and-not-equal, then you are forbidden to //pilfer// the //pointer// from the source container, but you are indeed allowed to //move// the //elements//, and that's what Billy is describing. You could finish by having the source container destroy all its elements (those elements being now in a moved-from state) and become empty, but that's less efficient than keeping the moved-from elements around.

Unless of course you know that the element type is //trivially relocatable//... ;)


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61366/new/

https://reviews.llvm.org/D61366





More information about the cfe-commits mailing list