In C++20 (N4849), there is no exception safety wording for associative containers' extract()
and insert(node_handle)
/insert(hint, node_handle)
methods.
But for merge()
, there is this wording though:
Throws: Nothing unless the comparison object throws.
Location:
22.2.6 Associative containers [associative.reqmts]
Table 78: Associative container requirements (in addition to container) [tab:container.assoc.req]
Page 799
Apparently the orignal proposal (P0083R3) intended to make it no-throw (page 5):
Exception safety
If the container’s Compare function is no-throw (which is very common), then removing a node, modifying it, and inserting it is no-throw unless modifying the value throws. And if modifying the value does throw, it does so outside of the containers involved.
But why is there no say in the proposed wording later in that proposal?
merge()
,extract()
has to copy the container's allocator. But the Allocator model requires that copying be noexcept. It does seem likeextract()
could be noexcept if the comparator is. – Sedate