unordered_map count
时间: 2023-10-12 18:07:07 浏览: 96
C++11 unordered_map与map(插入,遍历,Find)效率对比。
unordered的count函数用于查找指定键的个数。具体使用方法如下所示:
```
unordered_map<int, int> map;
map = 1;
if (map.count(0)) {
printf("这个map中含有键为0的键值对");
}
```
输出结果:
这个map中含有键为0的键值对
参考资料:<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [unordered_map的find和count函数使用总结](https://blog.csdn.net/qq_33634666/article/details/116279227)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [c++ unordered_map总结](https://blog.csdn.net/weixin_43239347/article/details/119686158)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文