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

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

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

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

      为什么 C++ STL 不提供任何“树"?容器?

      时间:2023-06-04

            <tbody id='aEfTm'></tbody>
          <legend id='aEfTm'><style id='aEfTm'><dir id='aEfTm'><q id='aEfTm'></q></dir></style></legend>

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

                <tfoot id='aEfTm'></tfoot>

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

                本文介绍了为什么 C++ STL 不提供任何“树"?容器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                为什么 C++ STL 不提供任何树"容器,而最好使用什么?

                我想将对象的层次结构存储为树,而不是使用树作为性能增强...

                解决方案

                您可能想要使用树的原因有两个:

                您想使用树状结构来反映问题:
                为此,我们有 boost 图形库

                或者你想要一个具有树状访问特征的容器为此,我们有

                • std::map(和 std::multimap)
                • std::set(和 std::multiset)

                基本上这两个容器的特性是它们实际上必须使用树来实现(尽管这实际上不是必需的).

                另见这个问题:C 树实现

                Why does the C++ STL not provide any "tree" containers, and what's the best thing to use instead?

                I want to store a hierarchy of objects as a tree, rather than use a tree as a performance enhancement...

                解决方案

                There are two reasons you could want to use a tree:

                You want to mirror the problem using a tree-like structure:
                For this we have boost graph library

                Or you want a container that has tree like access characteristics For this we have

                • std::map (and std::multimap)
                • std::set (and std::multiset)

                Basically the characteristics of these two containers is such that they practically have to be implemented using trees (though this is not actually a requirement).

                See also this question: C tree Implementation

                这篇关于为什么 C++ STL 不提供任何“树"?容器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:重载括号运算符 [] 以获取和设置 下一篇:C++ struct 语法“a : b"是什么意思?意思是

                相关文章

                  <bdo id='5CE88'></bdo><ul id='5CE88'></ul>

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

                    <small id='5CE88'></small><noframes id='5CE88'>