<bdo id='6qtwn'></bdo><ul id='6qtwn'></ul>

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

        <tfoot id='6qtwn'></tfoot>
      1. 我应该选择哪个 C++ 信号/插槽库?

        时间:2023-06-29
          <tbody id='hEwwX'></tbody>
        <legend id='hEwwX'><style id='hEwwX'><dir id='hEwwX'><q id='hEwwX'></q></dir></style></legend>

      2. <small id='hEwwX'></small><noframes id='hEwwX'>

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

            1. <tfoot id='hEwwX'></tfoot>

                  <i id='hEwwX'><tr id='hEwwX'><dt id='hEwwX'><q id='hEwwX'><span id='hEwwX'><b id='hEwwX'><form id='hEwwX'><ins id='hEwwX'></ins><ul id='hEwwX'></ul><sub id='hEwwX'></sub></form><legend id='hEwwX'></legend><bdo id='hEwwX'><pre id='hEwwX'><center id='hEwwX'></center></pre></bdo></b><th id='hEwwX'></th></span></q></dt></tr></i><div id='hEwwX'><tfoot id='hEwwX'></tfoot><dl id='hEwwX'><fieldset id='hEwwX'></fieldset></dl></div>
                • 本文介绍了我应该选择哪个 C++ 信号/插槽库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想在不使用 QT 的项目中使用信号/插槽库.我有非常基本的要求:

                  I want to use a signals/slots library in a project that doesn't use QT. I have pretty basic requirements:

                  1. 用任意数量的参数连接两个函数.
                  2. 信号可以连接到多个插槽.
                  3. 手动断开信号/插槽连接.
                  4. 不错的性能 - 应用程序是基于框架的(即不是基于事件的),我想在每个框架中使用连接.

                  我读过 libsigc++ 和 Boost.Signals 的比较.我还读过 Boost.Signals 性能不佳.但是,我知道还有其他库,但我仍然不确定应该选择哪个库.

                  I've read a comparison between libsigc++ and Boost.Signals. I've also read that Boost.Signals suffers from poor performance. However, I know there are other libraries and I'm still not sure which library should I choose.

                  对信号/插槽库有什么建议吗?

                  Are there any recommendations for a signals/slots library?

                  推荐答案

                  首先,无论如何都要尝试使用 boost::signal.在您尝试使用您的应用程序的特定情况之前,不要认为它不够快

                  First, try with boost::signal anyway. Don't assume it will not be fast enough until you try in your specific case that is your application

                  如果它不够高效,也许像 FastDelegate 之类的东西适合您需要?(我没有尝试,但听说在 boost::signal 似乎不适合的某些情况下这是一个不错的解决方案).

                  If it's not efficient enough, maybe something like FastDelegate will suit your needs? (i did'nt try it but heard it was a nice solution in some cases where boost::signal don't seem to suit).

                  无论如何,如果在您的应用程序中每帧都使用信号,那么用更简单的东西替换信号系统可能是值得的,例如一个容器,其中包含将被每帧调用的对象/函子.信号更多的是允许立即事件"管理,而不是使循环循环动态(允许更改每个帧调用的函数).(我有 我自己的解决方案(更新:它已经很旧了现在已经过时了)我在游戏中大量使用,例如我对性能没有问题,所以也许类似的东西会有所帮助).

                  Anyway, if in your application use the signal each frame, it may be worth to replace the signal system by something more simple, like a container that hold objects/functors that will be called each frame. Signal is more made to allow immediate "events" management than to make a loop cycle dynamic (allowing changing the functions called each frame). (I have my own solution (UPDATE: it's very old and archaic now) that i heavily use in a game and for instance i've no problem with the performance, so maybe something similar could help).

                  这篇关于我应该选择哪个 C++ 信号/插槽库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:使用 Boost 序列化和反序列化 JSON 下一篇:将流缓冲的内容复制到字符串

                  相关文章

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

                    <tfoot id='H3e7n'></tfoot>
                      <bdo id='H3e7n'></bdo><ul id='H3e7n'></ul>
                    1. <legend id='H3e7n'><style id='H3e7n'><dir id='H3e7n'><q id='H3e7n'></q></dir></style></legend>

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