For std::map, how will insert behave if it has to resize the container and the memory is not available?
insert, stdmap
Solution
STL map does not have to "resize" container. map (just like list) is a node based container; each insert allocates memory.
That said, out of memory situation is handled just like any other out-of-memory situation in C++: it throws a std::bad_alloc. STL containers with default allocators don't do anything fancy, they all end up allocating via standard new/delete operators somehow.
In STL map's case, it will throw exception and will otherwise behave as if it was not called. That is, the container will remain unmodified.
Problem
For std::map, how will insert behave if it has to resize the container and the memory is not available?