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

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

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

        缩小向量

        shrinking a vector(缩小向量)
      1. <i id='BV1CE'><tr id='BV1CE'><dt id='BV1CE'><q id='BV1CE'><span id='BV1CE'><b id='BV1CE'><form id='BV1CE'><ins id='BV1CE'></ins><ul id='BV1CE'></ul><sub id='BV1CE'></sub></form><legend id='BV1CE'></legend><bdo id='BV1CE'><pre id='BV1CE'><center id='BV1CE'></center></pre></bdo></b><th id='BV1CE'></th></span></q></dt></tr></i><div id='BV1CE'><tfoot id='BV1CE'></tfoot><dl id='BV1CE'><fieldset id='BV1CE'></fieldset></dl></div>
          <tbody id='BV1CE'></tbody>
          • <legend id='BV1CE'><style id='BV1CE'><dir id='BV1CE'><q id='BV1CE'></q></dir></style></legend>
          • <tfoot id='BV1CE'></tfoot>

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

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

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

                  问题描述

                  我的地形引擎有问题(使用 DirectX).

                  I've got a problem with my terrain engine (using DirectX).

                  我使用向量来保存细节块的顶点.当块的细节增加时,向量也会增加.

                  I'm using a vector to hold the vertices of a detail block. When the block increases in detail, so the vector does.

                  但是,当块减少其细节时,向量的大小不会缩小.

                  BUT, when the block decreases its detail, the vector doesn't shrink in size.

                  那么,我的问题是:有没有办法缩小向量的大小?我确实尝试过:

                  So, my question: is there a way to shrink the size of a vector? I did try this:

                  vertexvector.reserve(16);
                  

                  推荐答案

                  通常的技巧是用空向量交换:

                  The usual trick is to swap with an empty vector:

                  vector<vertex>(vertexvector.begin(), vertexvector.end()).swap(vertexvector);
                  

                  这篇关于缩小向量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  Consistent pseudo-random numbers across platforms(跨平台一致的伪随机数)
                  Vary range of uniform_int_distribution(改变uniform_int_distribution的范围)
                  What is a seed in terms of generating a random number?(就生成随机数而言,种子是什么?)
                  Is 1.0 a valid output from std::generate_canonical?(1.0 是 std::generate_canonical 的有效输出吗?)
                  Getting big random numbers in C/C++(在 C/C++ 中获取大随机数)
                  What is the best way to generate random numbers in C++?(在 C++ 中生成随机数的最佳方法是什么?)
                    • <bdo id='KbfS4'></bdo><ul id='KbfS4'></ul>

                          <tbody id='KbfS4'></tbody>

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