![]() ![]() ![]() Unordered_map consumes extra memory for internal hashing, so if you are keeping millions and billions of data inside the map and want to consume less memory then choose std::map instead of std::unordered_map.Īs std::map internally use balanced BST, so all the elements inside it will be in sorted order based on the key. Unordered container and Custom Hasher When to choose map instead of unordered_map Using User defined class objects as keys in std::map Also we need to override = operator.Ĭheck following article for detailed explanation : To know more about hashing check following article, What is Hashing and Hash Table? Therefore, elements will not be stored in any sorted order. Std::unordered_map store elements using hash table. map vs unordered_map | When to choose one over another ?.Looking for Something Search for: Search Recent Posts ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |