C++ STL :unordered_multimap
1、代码
#include<iostream> #include<unordered_map> using namespace std; int main() { unordered_multimap<int, int> myUnorderedMultiMap = { {2, 10},{1, 20},{3,30} }; //正向迭代器测试 cout << "正向迭代器遍历容器:"; for (auto it = myUnorderedMultiMap.begin(); it != myUnorderedMultiMap.end(); ++it) { cout << it->first << " -> " << it->second << ", "; } cout << endl; //正向常迭代器测试 cout << "正向常迭代器遍历容器:"; for (auto cit = myUnorderedMultiMap.cbegin(); cit != myUnorderedMultiMap.cend(); ++cit) { cout << cit->first << " -> " << cit->second << ", "; } cout << endl; return 0; }
参考:https://blog.csdn.net/qq_41855420/article/details/89792468
长风破浪会有时,直挂云帆济沧海!
可通过下方链接找到博主
https://www.cnblogs.com/judes/p/10875138.html