21.hash_map(已被废弃不再使用 被unordered_map代替)

Posted 喵小喵~

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了21.hash_map(已被废弃不再使用 被unordered_map代替)相关的知识,希望对你有一定的参考价值。

 1 #include <string>
 2 //老版本的unordered_map(已经废弃不再使用)
 3 #include <hash_map>
 4 #include <iostream>
 5 using namespace std;
 6 
 7 
 8 void main()
 9 {
10     //允许重复的映射
11     hash_map<string, double>mymap{ { "a1",113 },{ "a2",143 },{ "a3",1123 } };
12 
13     mymap.insert(pair<string, double>("a4", 345));
14     mymap.insert(pair<string, double>("a4", 315));
15     mymap.insert(pair<string, double>("a4", 325));
16     mymap.insert(pair<string, double>("a4", 335));
17 
18     
19 
20     for (auto i : mymap)
21     {
22     cout << i.first << "  " << i.second << endl;
23     }
24 
25     cin.get();
26 }

 

以上是关于21.hash_map(已被废弃不再使用 被unordered_map代替)的主要内容,如果未能解决你的问题,请参考以下文章

BufferQueue 已被废弃:使用 TextureView 播放视频时

关于[废弃]

您的 iOS 开发证书已被吊销?

Swing 数据绑定框架

容器 | K8s宣布不再支持Docker了?

for each ……in