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

    1. <tfoot id='0M3ol'></tfoot>

          <bdo id='0M3ol'></bdo><ul id='0M3ol'></ul>

        <small id='0M3ol'></small><noframes id='0M3ol'>

        <legend id='0M3ol'><style id='0M3ol'><dir id='0M3ol'><q id='0M3ol'></q></dir></style></legend>
      1. 二维向量的迭代器

        时间:2023-09-15
          <tbody id='Gey2R'></tbody>
        <i id='Gey2R'><tr id='Gey2R'><dt id='Gey2R'><q id='Gey2R'><span id='Gey2R'><b id='Gey2R'><form id='Gey2R'><ins id='Gey2R'></ins><ul id='Gey2R'></ul><sub id='Gey2R'></sub></form><legend id='Gey2R'></legend><bdo id='Gey2R'><pre id='Gey2R'><center id='Gey2R'></center></pre></bdo></b><th id='Gey2R'></th></span></q></dt></tr></i><div id='Gey2R'><tfoot id='Gey2R'></tfoot><dl id='Gey2R'><fieldset id='Gey2R'></fieldset></dl></div>

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

            • <tfoot id='Gey2R'></tfoot>

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

                  <bdo id='Gey2R'></bdo><ul id='Gey2R'></ul>

                  本文介绍了二维向量的迭代器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  如何为二维向量(向量的向量)创建迭代器?

                  How to create iterator/s for 2d vector (a vector of vectors)?

                  推荐答案

                  尽管您的问题不是很清楚,但我将假设您的意思是 2D 向量表示向量的向量:

                  Although your question is not very clear, I'm going to assume you mean a 2D vector to mean a vector of vectors:

                  vector< vector<int> > vvi;
                  

                  那么你需要使用两个迭代器来遍历它,第一个是行"的迭代器,第二个是该行"中列"的迭代器:

                  Then you need to use two iterators to traverse it, the first the iterator of the "rows", the second the iterators of the "columns" in that "row":

                  //assuming you have a "2D" vector vvi (vector of vector of int's)
                  vector< vector<int> >::iterator row;
                  vector<int>::iterator col;
                  for (row = vvi.begin(); row != vvi.end(); row++) {
                      for (col = row->begin(); col != row->end(); col++) {
                          // do stuff ...
                      }
                  }
                  

                  这篇关于二维向量的迭代器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:为什么将 C++ Vector 称为 Vector? 下一篇:从 c++ std::vector 中删除所有项目

                  相关文章

                  最新文章

                    <tfoot id='0bzPm'></tfoot>
                    1. <legend id='0bzPm'><style id='0bzPm'><dir id='0bzPm'><q id='0bzPm'></q></dir></style></legend>
                      • <bdo id='0bzPm'></bdo><ul id='0bzPm'></ul>

                    2. <small id='0bzPm'></small><noframes id='0bzPm'>

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