<legend id='2Y2pJ'><style id='2Y2pJ'><dir id='2Y2pJ'><q id='2Y2pJ'></q></dir></style></legend>

      <small id='2Y2pJ'></small><noframes id='2Y2pJ'>

      • <bdo id='2Y2pJ'></bdo><ul id='2Y2pJ'></ul>
      <i id='2Y2pJ'><tr id='2Y2pJ'><dt id='2Y2pJ'><q id='2Y2pJ'><span id='2Y2pJ'><b id='2Y2pJ'><form id='2Y2pJ'><ins id='2Y2pJ'></ins><ul id='2Y2pJ'></ul><sub id='2Y2pJ'></sub></form><legend id='2Y2pJ'></legend><bdo id='2Y2pJ'><pre id='2Y2pJ'><center id='2Y2pJ'></center></pre></bdo></b><th id='2Y2pJ'></th></span></q></dt></tr></i><div id='2Y2pJ'><tfoot id='2Y2pJ'></tfoot><dl id='2Y2pJ'><fieldset id='2Y2pJ'></fieldset></dl></div>
    1. <tfoot id='2Y2pJ'></tfoot>
      1. C++ 中的 map 与 hash_map

        时间:2024-08-13

      2. <legend id='4R9JV'><style id='4R9JV'><dir id='4R9JV'><q id='4R9JV'></q></dir></style></legend>

            • <bdo id='4R9JV'></bdo><ul id='4R9JV'></ul>
                  <tbody id='4R9JV'></tbody>
                1. <tfoot id='4R9JV'></tfoot>
                2. <small id='4R9JV'></small><noframes id='4R9JV'>

                  <i id='4R9JV'><tr id='4R9JV'><dt id='4R9JV'><q id='4R9JV'><span id='4R9JV'><b id='4R9JV'><form id='4R9JV'><ins id='4R9JV'></ins><ul id='4R9JV'></ul><sub id='4R9JV'></sub></form><legend id='4R9JV'></legend><bdo id='4R9JV'><pre id='4R9JV'><center id='4R9JV'></center></pre></bdo></b><th id='4R9JV'></th></span></q></dt></tr></i><div id='4R9JV'><tfoot id='4R9JV'></tfoot><dl id='4R9JV'><fieldset id='4R9JV'></fieldset></dl></div>

                  本文介绍了C++ 中的 map 与 hash_map的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我对 C++ 中的 hash_mapmap 有疑问.我知道 map 在 STL 中,但 hash_map 不是标准.两者有什么区别?

                  I have a question with hash_map and map in C++. I understand that map is in STL, but hash_map is not a standard. What's the difference between the two?

                  推荐答案

                  它们以非常不同的方式实现.

                  They are implemented in very different ways.

                  hash_map(TR1 和 Boost 中的 unordered_map;使用这些代替)使用哈希表,其中键被哈希到表中的一个槽,值存储在与该键关联的列表.

                  hash_map (unordered_map in TR1 and Boost; use those instead) use a hash table where the key is hashed to a slot in the table and the value is stored in a list tied to that key.

                  map 实现为平衡二叉搜索树(通常是红/黑树).

                  map is implemented as a balanced binary search tree (usually a red/black tree).

                  unordered_map 应该在访问集合的已知元素时提供稍微更好的性能,但是 map 将具有其他有用的特性(例如,它以排序顺序存储,这允许从头到尾遍历).unordered_map 在插入和删除时会比 map 更快.

                  An unordered_map should give slightly better performance for accessing known elements of the collection, but a map will have additional useful characteristics (e.g. it is stored in sorted order, which allows traversal from start to finish). unordered_map will be faster on insert and delete than a map.

                  这篇关于C++ 中的 map 与 hash_map的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:unordered_map 真的是无序的吗? 下一篇:C ++中的简单哈希图实现

                  相关文章

                  <small id='qaCIZ'></small><noframes id='qaCIZ'>

                  <tfoot id='qaCIZ'></tfoot>

                3. <legend id='qaCIZ'><style id='qaCIZ'><dir id='qaCIZ'><q id='qaCIZ'></q></dir></style></legend>
                    <i id='qaCIZ'><tr id='qaCIZ'><dt id='qaCIZ'><q id='qaCIZ'><span id='qaCIZ'><b id='qaCIZ'><form id='qaCIZ'><ins id='qaCIZ'></ins><ul id='qaCIZ'></ul><sub id='qaCIZ'></sub></form><legend id='qaCIZ'></legend><bdo id='qaCIZ'><pre id='qaCIZ'><center id='qaCIZ'></center></pre></bdo></b><th id='qaCIZ'></th></span></q></dt></tr></i><div id='qaCIZ'><tfoot id='qaCIZ'></tfoot><dl id='qaCIZ'><fieldset id='qaCIZ'></fieldset></dl></div>
                      <bdo id='qaCIZ'></bdo><ul id='qaCIZ'></ul>