STD: map, STD: multimap, STD: tr1: unordered_map difference-laptop-blog channel-csdn. net

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.