<legend id='AFk26'><style id='AFk26'><dir id='AFk26'><q id='AFk26'></q></dir></style></legend>
    <tfoot id='AFk26'></tfoot>
      <bdo id='AFk26'></bdo><ul id='AFk26'></ul>

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

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

        C++ STL 向量:从索引获取迭代器?

        时间:2023-09-15

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

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

            <legend id='LqbA1'><style id='LqbA1'><dir id='LqbA1'><q id='LqbA1'></q></dir></style></legend>
              <bdo id='LqbA1'></bdo><ul id='LqbA1'></ul>

                1. 本文介绍了C++ STL 向量:从索引获取迭代器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  所以,我写了一堆代码,通过 index[] 访问 stl 向量中的元素,但现在我只需要复制向量的一个块.看起来 vector.insert(pos, first, last) 是我想要的函数......除了我只有 first 和 last 作为整数.有什么好的方法可以获得这些值的迭代器吗?

                  So, I wrote a bunch of code that accesses elements in an stl vector by index[], but now I need to copy just a chunk of the vector. It looks like vector.insert(pos, first, last) is the function I want... except I only have first and last as ints. Is there any nice way I can get an iterator to these values?

                  推荐答案

                  试试这个:

                  vector<Type>::iterator nth = v.begin() + index;
                  

                  这篇关于C++ STL 向量:从索引获取迭代器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如果向量有足够的空间(通过保留创建),std::vec 下一篇:C++ 对象向量与指向对象的指针向量

                  相关文章

                  最新文章

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

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

                    1. <tfoot id='fAF3b'></tfoot>
                        <bdo id='fAF3b'></bdo><ul id='fAF3b'></ul>