Title
Should flat adaptors use `insert_range` when available?
Status
new
Section
[flat.map] [flat.multimap] [flat.set] [flat.multiset]
Submitter
Jonathan Wakely

Created on 2025-09-05.00:00:00 last changed 1 week ago

Messages

Date: 2025-09-05.00:00:00

As specified in [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`.

History
Date User Action Args
2025-09-05 00:00:00admincreate