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

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

    1. <small id='vyYKJ'></small><noframes id='vyYKJ'>

      <legend id='vyYKJ'><style id='vyYKJ'><dir id='vyYKJ'><q id='vyYKJ'></q></dir></style></legend>
      <tfoot id='vyYKJ'></tfoot>

        给定宽度和高度,如何调整对象的 2D 矢量大小

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

            <legend id='8j4st'><style id='8j4st'><dir id='8j4st'><q id='8j4st'></q></dir></style></legend>

            <small id='8j4st'></small><noframes id='8j4st'>

                  <bdo id='8j4st'></bdo><ul id='8j4st'></ul>

                • 本文介绍了给定宽度和高度,如何调整对象的 2D 矢量大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我的类 GameBoard 有一个成员变量,它是 Tile 类的对象的二维向量.GameBoard 构造函数将宽度和高度作为参数.

                  My class, GameBoard, has a member variable that is a 2D vector of an object of the class Tile. The GameBoard constructor takes width and height as parameters.

                  如何根据传递给构造函数的宽度和高度调整 Tile 对象的二维向量?我怎样才能用 Tile 对象填充它,以便我可以做这样的事情?

                  How can I get the 2D vector of Tile objects to resize according to the width and height passed to the constructor? How can I fill it with Tile objects so that I can do something like this?

                  myVector[i][j].getDisplayChar();
                  

                  代码片段

                  m_vvTiles.resize(iHeight);
                  
                  for(auto it = m_vvTiles.begin(); it != m_vvTiles.end(); it++ ){
                  
                      (*it).resize(iWidth,Tile(' '));
                  }
                  

                  推荐答案

                  您必须分别调整外向量和内向量的大小.

                  You have to resize the outer and inner vectors separately.

                  myVector.resize(n);
                  for (int i = 0; i < n; ++i)
                      myVector[i].resize(m);
                  

                  这篇关于给定宽度和高度,如何调整对象的 2D 矢量大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:嵌套的 std::arrays 中的数据是否保证是连续的? 下一篇:如何使用 std::valarray 存储/操作连续的二维数组

                  相关文章

                  最新文章

                    1. <legend id='alpzj'><style id='alpzj'><dir id='alpzj'><q id='alpzj'></q></dir></style></legend>

                      <tfoot id='alpzj'></tfoot>

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

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

                      • <bdo id='alpzj'></bdo><ul id='alpzj'></ul>