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

  • <tfoot id='JQVbc'></tfoot>
      <bdo id='JQVbc'></bdo><ul id='JQVbc'></ul>
  • <small id='JQVbc'></small><noframes id='JQVbc'>

        <legend id='JQVbc'><style id='JQVbc'><dir id='JQVbc'><q id='JQVbc'></q></dir></style></legend>
      1. 迭代 C++ 映射中的键

        时间:2024-05-11

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

            <legend id='uX342'><style id='uX342'><dir id='uX342'><q id='uX342'></q></dir></style></legend>

            • <tfoot id='uX342'></tfoot>
                <bdo id='uX342'></bdo><ul id='uX342'></ul>
                  <tbody id='uX342'></tbody>
              • <i id='uX342'><tr id='uX342'><dt id='uX342'><q id='uX342'><span id='uX342'><b id='uX342'><form id='uX342'><ins id='uX342'></ins><ul id='uX342'></ul><sub id='uX342'></sub></form><legend id='uX342'></legend><bdo id='uX342'><pre id='uX342'><center id='uX342'></center></pre></bdo></b><th id='uX342'></th></span></q></dt></tr></i><div id='uX342'><tfoot id='uX342'></tfoot><dl id='uX342'><fieldset id='uX342'></fieldset></dl></div>
                  本文介绍了迭代 C++ 映射中的键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  有没有办法迭代键而不是 C++ 映射对?

                  Is there a way to iterate over the keys, not the pairs of a C++ map?

                  推荐答案

                  如果您确实需要隐藏真实"迭代器返回的值(例如,因为您想使用具有标准算法的密钥迭代器,以便它们对键而不是对进行操作),然后看看 Boost 的 transform_iterator.

                  If you really need to hide the value that the "real" iterator returns (for example because you want to use your key-iterator with standard algorithms, so that they operate on the keys instead of the pairs), then take a look at Boost's transform_iterator.

                  [提示:查看新类的 Boost 文档时,请先阅读末尾的示例".然后,您就有机会弄清楚其余部分到底在谈论什么:-)]

                  [Tip: when looking at Boost documentation for a new class, read the "examples" at the end first. You then have a sporting chance of figuring out what on earth the rest of it is talking about :-)]

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

                  上一篇:C++ 容器的一般用例 下一篇:如何对 STL 向量进行排序?

                  相关文章

                    <i id='UVHI0'><tr id='UVHI0'><dt id='UVHI0'><q id='UVHI0'><span id='UVHI0'><b id='UVHI0'><form id='UVHI0'><ins id='UVHI0'></ins><ul id='UVHI0'></ul><sub id='UVHI0'></sub></form><legend id='UVHI0'></legend><bdo id='UVHI0'><pre id='UVHI0'><center id='UVHI0'></center></pre></bdo></b><th id='UVHI0'></th></span></q></dt></tr></i><div id='UVHI0'><tfoot id='UVHI0'></tfoot><dl id='UVHI0'><fieldset id='UVHI0'></fieldset></dl></div>
                  1. <small id='UVHI0'></small><noframes id='UVHI0'>

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

                      <bdo id='UVHI0'></bdo><ul id='UVHI0'></ul>
                  3. <tfoot id='UVHI0'></tfoot>