I inserted the elements to the unordered_map
with this code:
myMap.insert(std::make_pair(\"A\", 10));
myMap.insert(std::make_pair(\"B\", 11
Remarkably common request without too many clean,simple solutions. But here they are:
I might have a play with a simple template for a wrapper to tie the 2 STL containers together and post it here later...
I have put a proof of concept up for review here:
I went with std::list to store the order in the end, because I wanted efficient delete. But You might choose std::vector if you wanted random access by insertion order.
I used a a list of Pair pointers to avoid duplicate key storage.