unordered_map可以用vector吗
时间: 2023-10-18 19:27:59 浏览: 115
unordered_map可以使用vector作为值,但不能使用vector作为键。这是因为unordered_map的键必须具有可哈希性,而vector没有定义哈希函数。而对于值,可以使用vector作为unordered_map的值。 <span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [map、unordered_map和vector的初始化和底层机理的差别](https://blog.csdn.net/mrqiuwen/article/details/127183780)[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_2"}}] [.reference_item style="max-width: 50%"]
- *2* [slt中map中的一些细节(可能会持续更新)](https://blog.csdn.net/weixin_53475254/article/details/120252711)[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_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文