map vs. hash_map in C++ -
I have a question in hash_map
and map
c ++ I understand that the map
is in STL, but hash_map
is not standard, what is the difference between the two?
These are implemented in a very different way.
hash_map
(use unordered_map
in TR1 and Boost; instead, use them) Use a hash table where the key is in a slot in the table The value is pushed and the value is stored in the list
Map
is applied as a balanced binary search tree (usually a red / black tree).
An unordered_map
should give slightly better performance to access the known elements of the archive, but there will be additional useful features in a map
(as it is sorted Is stored in order, which allows traversal ending from the beginning) will be faster on insert and delete from unordered_map
a map
.
Comments
Post a Comment