I looked at this question: boost::flat_map and its performance compared to map and unordered_map and discovered that v.oddou's answer shows iterator plots for std::map versus other containers and I discovered that std::map is very slow at iterating over all the elements. What puzzled me about this is I assume the reason std::map is slow at iterating is because it presents all elements in key order. I believe that if std::map was constructed as an array and using the special index formula (I do not remember where its referenced) for keeping track of the binary tree structure, then you could iterate quick through the array sequentially, but the keys will be presented unordered. However, I have been unable to find a standard container that does this in c++. The only bottleneck for an array like map is that dynamic resizing will be expensive, however if you are only interested in doubling the array size each time you hit the size limit, you can achieve N*log(N) average insertion time over a long computation. I looked at the pseudo code that explains the construction of nodal pointers that have tree association directions (parent, left child, right child) and I was unable to determine if this nodal structure can be modified to add a one-dimensional unordered associativity.
Is there a c++ standard library container of size N that has log(N) insertion and search yet has N iteration instead N*log(N)?
Edit:
There appears to be confusion regarding insertion complexity, where some have suggested its N and not N*log(N) for ordered maps. In my OP I did not make it clear, but I was thinking of insertion of one element at a time where you do not know what the next element will be. I believe that if you have all of the elements at once you could probably do it N time. My source is map::insert.