Created on 2025-12-22.00:00:00 last changed 2 weeks ago
Proposed resolution:
This wording is relative to N5032.
Modify [flat.set.modifiers] as indicated:
template<container-compatible-range<value_type> R> constexpr void insert_range(R&& rg);-10- Effects: Adds elements to
cas if by:ranges::for_each(rg, [&](value_typeauto&&e) { c.insert(c.end(), std::movestd::forward<decltype(e)>(e)); });
Modify [flat.multiset.modifiers] as indicated:
template<container-compatible-range<value_type> R> void insert_range(R&& rg);-9- Effects: Adds elements to
cas if by:ranges::for_each(rg, [&](value_typeauto&&e) { c.insert(c.end(), std::movestd::forward<decltype(e)>(e)); });
[ 2026-02-20; LWG telecon; Status changed: New → Ready. ]
Implementations can optimize away the extra move for the case where the range's value type is already the same as the flat set's value type.
[ 2026-02-18; Reflector poll. ]
Set priority to 2 after reflector poll.
Pessimizing a very common case (matching type), for uncommon one.
The function adds elements via:
ranges::for_each(rg, [&](auto&& e) {
c.insert(c.end(), std::forward<decltype(e)>(e));
});
Here, `e` is an element of the input range.
However, this can lead to ambiguity when `e` can also be converted to `initializer_list`, as `vector::insert` has an overload ofinsert(const_iterator, initializer_list<T>).
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2026-02-20 20:39:01 | admin | set | messages: + msg15961 |
| 2026-02-20 20:39:01 | admin | set | status: new -> ready |
| 2026-02-18 14:59:59 | admin | set | messages: + msg15943 |
| 2025-12-22 14:27:41 | admin | set | messages: + msg15844 |
| 2025-12-22 00:00:00 | admin | create | |