Files
Data-Structure/STL/STL-unordered_map/unordered_multimap.cpp
2025-08-13 17:54:58 +08:00

21 lines
598 B
C++

//Ó÷¨ºÍunordered_map - multimapÒ»ÖÂ
#include <unordered_map>
#include <iostream>
using namespace std;
int main(){
unordered_multimap<int, int> m;
m.insert({make_pair(1,111), make_pair(2,222), make_pair(3,333), make_pair(8,888), make_pair(6,666), make_pair(5,555)});
m.insert({make_pair(1,11), make_pair(2,22), make_pair(1,1)});
cout << m.count(1) << " " << m.find(1)->first << "," << m.find(1)->second << endl;
m.erase(m.find(1));
cout << m.count(1) << " " << m.find(1)->first << "," << m.find(1)->second << endl;
m.erase(1);
cout << m.count(1) << endl;
return 0;
}
/*
3 1,1
2 1,11
0
*/