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: New Submitter: Jonathan Wakely Opened: 2025-09-05 Last modified: 2025-09-05
Priority: Not Prioritized
View other active issues in [flat.map].
View all other issues in [flat.map].
View all issues with New 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.
Proposed resolution: