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

      1. <tfoot id='8s8xe'></tfoot>

        • <bdo id='8s8xe'></bdo><ul id='8s8xe'></ul>

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

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

      2. boost 是否具有比 STL 更简单的集合操作数据类型?

        时间:2024-05-12
      3. <legend id='u90NZ'><style id='u90NZ'><dir id='u90NZ'><q id='u90NZ'></q></dir></style></legend>

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

          <bdo id='u90NZ'></bdo><ul id='u90NZ'></ul>
            <tbody id='u90NZ'></tbody>

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

              <tfoot id='u90NZ'></tfoot>
                  本文介绍了boost 是否具有比 STL 更简单的集合操作数据类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我发现 C++ STL 方法进行简单的集合操作使用起来非常笨拙.例如,求两个集合的差:

                  I find the C++ STL method of doing simple set operations quite clunky to use. For example, to find the difference between two sets:

                  std::set<int> newUserIds;
                  set_difference(currentUserIds.begin(), currentUserIds.end(), mPreviousUserIds.begin(), mPreviousUserIds.end(), std::inserter(newUserIds, newUserIds.end()));
                  std::set<int> missingUserIds;
                  set_difference(mPreviousUserIds.begin(), mPreviousUserIds.end(), currentUserIds.begin(), currentUserIds.end(), std::inserter(missingUserIds, missingUserIds.end()));
                  mPreviousUserIds = currentUserIds;
                  

                  boost 是否提供了一组替代类,可以将上述示例简化为如下所示:

                  Does boost offer an alternative set of classes that would reduce the above example to something like this:

                  set_type<int> newUserIds = currentUserIds.difference(mPreviousUserIds);
                  set_type<int> missingUserIds = mPreviousUserIds.difference(currentUserIds);
                  

                  (类似于 Qt 中的 QSet,它覆盖了 operator- 以这种方式.)

                  (Similar to QSet in Qt which overrides operator- in this way.)

                  推荐答案

                  参见 提升范围集算法.尽管如此,他们仍然希望有一个输出迭代器.

                  See Boost Range Set algorithms. They still expect an output iterator though.

                  这篇关于boost 是否具有比 STL 更简单的集合操作数据类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:矢量或地图,使用哪一个? 下一篇:多维 std::array

                  相关文章

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

                    <tfoot id='aHYw2'></tfoot>

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

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