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

4350. Should flat adaptors use insert_range when available?

Section: 23.6.8 [flat.map], 23.6.9 [flat.multimap], 23.6.11 [flat.set], 23.6.12 [flat.multiset] Status: LEWG Submitter: Jonathan Wakely Opened: 2025-09-05 Last modified: 2025-10-21

Priority: 2

View other active issues in [flat.map].

View all other issues in [flat.map].

View all issues with LEWG status.

Discussion:

As specified in 23.6.3.4 [queue.mod], std::queue::push_range is guaranteed to use c.append_range if that exists. For flat_map and its flat friends, we only ever use c.insert and never try to use c.insert_range, c.append_range, etc. LWG thinks the "as if by" wording allows implementations to use insert_range when the container type being adapted is std::vector but not for user-defined containers. Should the flat adaptors follow std::queue and guarantee that they will use the xxx_range member if they exist? That would mean that user containers need to ensure that any member functions with those names must behave as expected, but we already require that for std::queue.

[2025-10-21; Reflector poll. Status changed: New → LEWG.]

Set priority to 2 after reflector poll.

Use append_range to be consistent with other adapters. Send to LEWG for confirmation.

Proposed resolution: