[PATCH] D48896: [libcxx][c++17] P0083R5: Splicing Maps and Sets Part 2: merge

Erik Pilkington via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 3 13:59:41 PDT 2018


erik.pilkington created this revision.
erik.pilkington added reviewers: EricWF, mclow.lists.
Herald added subscribers: dexonsmith, ldionne, christof.

This was originally part of https://reviews.llvm.org/D46845, but I decided to split it out to clean up the diff. From that patch's description:

> In `__hash_table`, I split up the functions `__node_insert_unqiue` and `__node_insert_multi` into 2 parts in order to implement merge. The first part, `__node_insert_{multi,unique}_prepare` checks to see if a node already is present in the container (as needed), and rehashes the container. This function can forward exceptions, but doesn't mutate the node it's preparing to insert. the `__node_insert_{multi,unique}_perform` is noexcept, but mutates the pointers in the node to actually insert it into the container. This allows merge to call a `_prepare` function on a node while it is in the source container, without invalidating anything or losing nodes if an exception is thrown.

Thanks for taking a look!
Erik


Repository:
  rCXX libc++

https://reviews.llvm.org/D48896

Files:
  libcxx/include/__hash_table
  libcxx/include/__tree
  libcxx/include/map
  libcxx/include/set
  libcxx/include/unordered_map
  libcxx/include/unordered_set
  libcxx/test/std/containers/associative/map/map.modifiers/merge.pass.cpp
  libcxx/test/std/containers/associative/multimap/multimap.modifiers/merge.pass.cpp
  libcxx/test/std/containers/associative/multiset/merge.pass.cpp
  libcxx/test/std/containers/associative/set/merge.pass.cpp
  libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/merge.pass.cpp
  libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/merge.pass.cpp
  libcxx/test/std/containers/unord/unord.multiset/merge.pass.cpp
  libcxx/test/std/containers/unord/unord.set/merge.pass.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48896.153966.patch
Type: text/x-patch
Size: 60680 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180703/526f043d/attachment-0001.bin>


More information about the cfe-commits mailing list