22.允许重复的容器(unordered_multiset)

 1 #include <string>
 2 #include <iostream>
 3 #include <unordered_set>
 4 using namespace std;
 5 
 6 
 7 void main()
 8 {
 9     unordered_multiset<string> myset{ "pig", "pig", "pig" ,"chicken"};
10     /*for (auto i : myset)
11     {
12         cout << i << endl;
13     }*/
14 
15     auto it = myset.equal_range("pig");
16     
17     //输出所有重复数据
18     //it.first链表的起点 it.second链表的终点
19     for (auto ib = it.first, ie = it.second; ib != ie; ib++)
20     {
21         cout << *it.first << endl;
22     }
23 
24     cin.get();
25 }
原文地址:https://www.cnblogs.com/xiaochi/p/8635557.html