Problem
In C ++ 17, associative containers in the standard library will have a member function insert_or_assign that will do what its name suggests. Unfortunately, it does not seem to have an iterator-based interface for bulk insert / assignment. I even tried to compile a small example, and from a compiler error the compiler could not find a suitable overload, and none of the candidates was close enough to the iterator based interface.
Question
Why doesn't C ++ 17 contain an insert_or_assign based insert_or_assign for bulk operations? Were there any technical reasons? Design issues?
My assumptions and ideas
I see no technical reasons not to add an add / add based on an iterator. It seems quite doable. He should still look for the key, so I do not see any violations of "Do not pay for what you do not use."
In fact, the lack of overload makes the standard library less consistent, rather than what happens against itself. Plain insert supports it, so I would expect insert_or_assign to support this too. I do not think that the lack of overload will make it "easier to use and harder to use incorrectly."
The only key to the left is the notification from cppreference:
insert_or_assign returns more information than the [] operator, and does not require default constructivity for the display type.
I'm not sure why this could be a limitation, since the associative container has access to all internal components and should not deal with operator[] .
Binary compatibility is not applicable here if I have not forgotten anything. The modification will be in the header, and everything will need to be recompiled anyway.
I also could not find the paper associated with it. The separation of maps and sets does not seem to mention this. This function looks like phantom.
The standard may include at least insert_assign_iterator , so you can write std::copy(input_first, input_last, insert_assign_iterator{map}); but the standard does not include any of them.