<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++ 映射中的键

        Iterate keys in a C++ map(迭代 C++ 映射中的键)

        <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++ 映射中的键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  What is the past-the-end iterator in STL C++?(STL C++ 中的最后迭代器是什么?)
                  vector::at vs. vector::operator[](vector::at 与 vector::operator[])
                  C++ equivalent of StringBuffer/StringBuilder?(C++ 等效于 StringBuffer/StringBuilder?)
                  Adding types to the std namespace(将类型添加到 std 命名空间)
                  Is the C++ std::set thread-safe?(C++ std::set 线程安全吗?)
                  How to use std::find/std::find_if with a vector of custom class objects?(如何将 std::find/std::find_if 与自定义类对象的向量一起使用?)

                      <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>
                        <tbody id='UVHI0'></tbody>
                    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>
                      • <tfoot id='UVHI0'></tfoot>