This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of New status.

4046. Effects of inserting into or erasing from flat container adaptors when an exception is thrown need to be more permissive

Section: 23.2.7.2 [associative.reqmts.except], 23.6.8.1 [flat.map.overview], 23.6.9.1 [flat.multimap.overview], 23.6.11.1 [flat.set.overview], 23.6.12.1 [flat.multiset.overview] Status: New Submitter: Jiang An Opened: 2024-01-23 Last modified: 2024-03-15

Priority: 2

View all issues with New status.

Discussion:

The issue was originally discovered while implementing flat_(multi_)set in MSVC STL (microsoft/STL#4059).

Currently, the effects of inserting a single element into or erasing elements from a flat container adaptor when an exception is thrown, are implicitly specified in 23.2.7.2 [associative.reqmts.except].

However, given erasing elements from a vector or a deque generally needs to assign elements, which is not guaranteed to be non-throwing, it seems unreasonable to require erase of flat container adaptors not to throw in such a case. Likewise, as inserting a single value into deque is not guaranteed to be effectless when an exception is thrown, so flat container adaptors are unlike to provide such a guarantee.

Perhaps we should conditionally relax the requirements when the underlying containers can't provide them.

[2024-03-15; Reflector poll]

Set priority to 2 after reflector poll.

P2767 ยง3.5 is related/conflicting.

Proposed resolution: