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

      <tfoot id='yrfJ9'></tfoot>
      • <bdo id='yrfJ9'></bdo><ul id='yrfJ9'></ul>
    1. <small id='yrfJ9'></small><noframes id='yrfJ9'>

      1. 对于 STL 或 !STL,这是个问题

        To STL or !STL, that is the question(对于 STL 或 !STL,这是个问题)

            <tbody id='siD1Z'></tbody>

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

              • <bdo id='siD1Z'></bdo><ul id='siD1Z'></ul>
                • <tfoot id='siD1Z'></tfoot>
                  <i id='siD1Z'><tr id='siD1Z'><dt id='siD1Z'><q id='siD1Z'><span id='siD1Z'><b id='siD1Z'><form id='siD1Z'><ins id='siD1Z'></ins><ul id='siD1Z'></ul><sub id='siD1Z'></sub></form><legend id='siD1Z'></legend><bdo id='siD1Z'><pre id='siD1Z'><center id='siD1Z'></center></pre></bdo></b><th id='siD1Z'></th></span></q></dt></tr></i><div id='siD1Z'><tfoot id='siD1Z'></tfoot><dl id='siD1Z'><fieldset id='siD1Z'></fieldset></dl></div>
                  <legend id='siD1Z'><style id='siD1Z'><dir id='siD1Z'><q id='siD1Z'></q></dir></style></legend>
                • 本文介绍了对于 STL 或 !STL,这是个问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  毫无疑问,我会选择将 STL 用于大多数 C++ 编程项目.然而,最近有人向我提出了这个问题,在某些情况下您不会使用 STL?"...

                  Unquestionably, I would choose to use the STL for most C++ programming projects. The question was presented to me recently however, "Are there any cases where you wouldn't use the STL?"...

                  我想得越多,我就越意识到,也许应该有我选择不使用 STL 的情况……例如,一个非常大的长期项目,其代码库预计将持续数年.. 也许一个完全符合项目需求的自定义容器解决方案值得最初的开销?你怎么看,有没有你会选择 NOT STL 的情况?

                  The more I thought about it, the more I realized that perhaps there SHOULD be cases where I choose not to use the STL... For example, a really large, long term project whose codebase is expected to last years... Perhaps a custom container solution that precisely fits the projects needs is worth the initial overhead? What do you think, are there any cases where you would choose NOT to STL?

                  推荐答案

                  具有严格内存要求的项目(例如嵌入式系统)可能不适合 STL,因为它可能难以控制和管理取自和返回的内容堆.正如 Evan 提到的,编写适当的分配器可以帮助解决这个问题,但如果您正在计算使用的每个字节或关注内存碎片,那么手动滚动针对您的特定问题量身定制的解决方案可能更明智,因为 STL 已经过优化用于最一般的用途.

                  Projects with strict memory requirements such as for embedded systems may not be suited for the STL, as it can be difficult to control and manage what's taken from and returned to the heap. As Evan mentioned, writing proper allocators can help with this, but if you're counting every byte used or concerned with memory fragmentation, it may be wiser to hand-roll a solution that's tailored for your specific problem, as the STL has been optimized for the most general usage.

                  您也可以选择在特定情况下不使用 STL,因为存在当前标准中没有的更多适用容器,例如 boost::array 或 boost::unordered_map.

                  You may also choose not to use STL for a particular case because more applicable containers exist that are not in the current standard, such as boost::array or boost::unordered_map.

                  这篇关于对于 STL 或 !STL,这是个问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  Unable to access non-const member functions of objects in C++ std::set(无法访问 C++ std::set 中对象的非常量成员函数)
                  Constructing std::function argument from lambda(从 lambda 构造 std::function 参数)
                  STL BigInt class implementation(STL BigInt 类实现)
                  Sync is unreliable using std::atomic and std::condition_variable(使用 std::atomic 和 std::condition_variable 同步不可靠)
                  Move list element to the end in STL(在 STL 中将列表元素移动到末尾)
                  Why is overloading operatoramp;() prohibited for classes stored in STL containers?(为什么禁止对存储在 STL 容器中的类重载 operatoramp;()?)

                  1. <legend id='3PRv0'><style id='3PRv0'><dir id='3PRv0'><q id='3PRv0'></q></dir></style></legend>
                    • <tfoot id='3PRv0'></tfoot>

                        <small id='3PRv0'></small><noframes id='3PRv0'>

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

                            <bdo id='3PRv0'></bdo><ul id='3PRv0'></ul>
                              <tbody id='3PRv0'></tbody>