1.1 Features
- Associativity: retrieve value by key, not by absolute address (unlike sequential containers)
- Disorder: use hash table storage, internal disorder
- Map : each value corresponds to a key value
- Key Uniqueness: No two elements have the same key
- Dynamic memory management: use the memory management model to dynamically manage the required memory space
2.1 Iterators
The iterator of unordered_map is a pointer to this element, and its value is obtained through the iterator.
unordered_map<Key,T>::iterator it; (*it).first; // the key value (of type Key) (*it).second; // the mapped value (of type T) (*it);
Its keys are the first and second properties of the iterator, respectively
it->first; // same as (*it).first (the key value) it->second; // same as (*it).second (the mapped value)
So there is a difference between '.' and '->' : -> is an indirect address value operator; . is a direct address value operator.
Less runtime and occupancy compared to map
Reference article:
https://blog.csdn.net/hk2291976/article/details/51037095