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.

4374. flat_meow range insertion behavior is unclear if in-place merge cannot allocate additional memory

Section: 23.6.8.7 [flat.map.modifiers], 23.6.11.5 [flat.set.modifiers], 23.6.12.5 [flat.multiset.modifiers] Status: New Submitter: Tim Song Opened: 2025-09-09 Last modified: 2025-09-19

Priority: Not Prioritized

View other active issues in [flat.map.modifiers].

View all other issues in [flat.map.modifiers].

View all issues with New status.

Discussion:

The range insertion operations of flat_map/multimap/set/multiset have this Remarks: element:

Since this operation performs an in-place merge, it may allocate memory.

It is not clear what happens if that allocation fails. If the inplace_merge algorithm is used, it will fall back to a less efficient 𝒪(N log N) algorithm, but this is not reflected in the Complexity: element. Alternatively, if the allocation failure is reported by an exception, that should be called out in the spec.

Proposed resolution: