unordered_set比unoredered_map更小
时间: 2023-10-15 14:26:02 浏览: 80
map和set的异同
unordered_set比unordered_map更小的原因是unordered_set只存储键,而unordered_map存储键值对。在unordered_set中,每个元素只有一个键,而在unordered_map中,每个元素有一个键和一个值。因此,unordered_set在存储相同数量的元素时,会比unordered_map占用更少的内存空间。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* *3* [unordered_set和unordered_map用法详解](https://blog.csdn.net/weixin_43679037/article/details/118833261)[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: 100%"]
[ .reference_list ]
阅读全文