STD: map, STD: multimap, STD: tr1: unordered_map difference-laptop-blog channel-csdn. net
STD: map, STD: multimap, STD: tr1: unordered_map difference Category: C/C ++ Read by 399 Comment (0) Favorites Report Treetable Both map and multimap are based on binary tree. The difference is:
Only one key can exist in a map, while multiple keys can have the same value in multimap.
Unordered_map is the hash_map we often call. Its key is unique,
So you should also see something called unordered_multimap.
STD: Set STD: Multiset STD: Map STD: multimap
These two things are based on binary trees, specifically the red and black trees.
Boost: unordered_set boost: unordered_multiset boost: unordered_map boost: unordered_multimap
These things are based on hash_table.
map and multimap are automatically sorted by key when inserting data.
unordered_map and unordered_multimap are not automatically sorted by key.
therefore, the efficiency of MAP and multimap during insertion is lower.