In case of unordered_map
we define the hash
and pred
functors whenever we are using user-defined
keys.
The template syntax for a map is as follows:
template < class Key, // map::key_type
class T, // map::mapped_type
class Compare = less<Key>, // map::key_compare
class Alloc = allocator<pair<const Key,T> > // map::allocator_type
> class map;
In case of map there is no hash
and pred
functors option. Do we never have collisions in case of map
. If collisions happen then why don't we have the hash
and pred
functors as in unordered_map
?
Am I missing something here?