STL map/unordered_map with a Vector for the Key

Jimmy (xiaoke) Shen
3 min readJul 3, 2020

map uses vector as the key

Map in c++ is implemented by a Red Black tree, which is an essential balanced binary search tree. It is not a hash table, so it doesn't need that the key is hashable. However, it requires that the key support <, >, or == operations.

So for the map in c++, we can use a vector as key. [1]

unordered_map uses vector as the key

What about unordered_map?