Is there any principle to choose one over another between hash_map and map in STL?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
hash_mapis useful if you are only looking elements by their key. A possible use-case for ahash_mapwould be a dictionary. If the elements need to be in ordermapis the container for that.And just for clarification (because of the usage of the word “STL”):
hash_mapisn’t yet part of the C++ Standard Library, but it has been implemented in several C++ compilers.unordered_mapwas proposed in the C++ Technical Report 1, and it will be defined in the next edition of the standard, C++0x.