<tfoot id='VWnTL'></tfoot>

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

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

      1. <i id='VWnTL'><tr id='VWnTL'><dt id='VWnTL'><q id='VWnTL'><span id='VWnTL'><b id='VWnTL'><form id='VWnTL'><ins id='VWnTL'></ins><ul id='VWnTL'></ul><sub id='VWnTL'></sub></form><legend id='VWnTL'></legend><bdo id='VWnTL'><pre id='VWnTL'><center id='VWnTL'></center></pre></bdo></b><th id='VWnTL'></th></span></q></dt></tr></i><div id='VWnTL'><tfoot id='VWnTL'></tfoot><dl id='VWnTL'><fieldset id='VWnTL'></fieldset></dl></div>
          <bdo id='VWnTL'></bdo><ul id='VWnTL'></ul>
      2. C++ 是否存在循环列表的标准实现?

        Does a standard implementation of a Circular List exist for C++?(C++ 是否存在循环列表的标准实现?)

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

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

            <tbody id='QwqPt'></tbody>
            <tfoot id='QwqPt'></tfoot>
              1. <i id='QwqPt'><tr id='QwqPt'><dt id='QwqPt'><q id='QwqPt'><span id='QwqPt'><b id='QwqPt'><form id='QwqPt'><ins id='QwqPt'></ins><ul id='QwqPt'></ul><sub id='QwqPt'></sub></form><legend id='QwqPt'></legend><bdo id='QwqPt'><pre id='QwqPt'><center id='QwqPt'></center></pre></bdo></b><th id='QwqPt'></th></span></q></dt></tr></i><div id='QwqPt'><tfoot id='QwqPt'></tfoot><dl id='QwqPt'><fieldset id='QwqPt'></fieldset></dl></div>
                  <bdo id='QwqPt'></bdo><ul id='QwqPt'></ul>
                  本文介绍了C++ 是否存在循环列表的标准实现?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想使用循环列表.

                  如果没有实现我自己的(像这个人所做的),我有什么选择?>

                  特别是我想做的是迭代对象列表.当我的迭代器到达列表的末尾时,它应该自动返回到开头.(是的,我意识到这可能很危险.)

                  参见 Vladimir 对 circular_iterator 的定义:circular_iterator 将永远不会与 CircularList::end() 相等,因此您始终可以取消引用此迭代器."

                  解决方案

                  没有标准的循环列表.

                  但是,有一个循环缓冲区 在 Boost 中,这可能会有所帮助.

                  如果您不需要任何花哨的东西,您可以考虑只使用 vector 并使用索引访问元素.你可以用向量的大小mod你的索引来实现与循环列表大致相同的事情.

                  I want to use a circular list.

                  Short of implementing my own (like this person did) what are my options?

                  Specifically what I want to do is iterate over a list of objects. When my iterator reaches the end of the list, it should automatically return to the beginning. (Yes, I realize this could be dangerous.)

                  See Vladimir's definition of a circular_iterator: "A circular_iterator will never be equal with CircularList::end(), thus you can always dereference this iterator."

                  解决方案

                  There's no standard circular list.

                  However, there is a circular buffer in Boost, which might be helpful.

                  If you don't need anything fancy, you might consider just using a vector and accessing the elements with an index. You can just mod your index with the size of the vector to achieve much the same thing as a circular list.

                  这篇关于C++ 是否存在循环列表的标准实现?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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='fg6Nx'></bdo><ul id='fg6Nx'></ul>
                        <tbody id='fg6Nx'></tbody>
                    • <tfoot id='fg6Nx'></tfoot>

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