What is the most efficient way of obtaining lists (as a vector) of the keys and values from an unordered_map?
vector
unordered_map
For concreteness, suppose the
In STL there is no built-in method to get all keys or values from a map.
There is no different to iterate a unordered map or regular map, the best way is to iterate it and collect key or value to a vector.
You can write a template function to iterate any kind of map.