Which C++ signals/slots library should I choose?

前端 未结 11 1399
隐瞒了意图╮
隐瞒了意图╮ 2020-12-01 00:10

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

  1. Connect two functions with any number of parameters
相关标签:
11条回答
  • 2020-12-01 00:33

    What about this alternative implementation that looks good: http://endl.ch/content/fastsig ?

    0 讨论(0)
  • 2020-12-01 00:34

    One more sig-slot implementation to consider:

    http://code.google.com/p/ting/wiki/SignalSlotUsage

    It does not pretend to be the best one, but, still, another one which has its right to exist.

    0 讨论(0)
  • 2020-12-01 00:37

    An another option can be YSignalSlot. I used it. I think it is pretty good.

    0 讨论(0)
  • 2020-12-01 00:39

    Very, very fast event library on Gamedev.net forms

    When profiling some code I'd been working on recently, I was surprised and dismayed to see boost::signals functions floating to the top. For those of you who are unaware, boost::signals is a wonderfully useful signal/slot library which can be used alongside boost::bind for delegate-based event handling such as one sees in C#. It is robust, featureful, and flexible. It is also, I have learned, incredibly, terrifyingly slow. For a lot of people who use boost::signals this is fine because they call events very seldom. I was calling several events per frame per object, with predictable results.

    So I wrote my own. Slightly less flexible and featureful. It's optimized for how everyone tends to actually use events. And event invocation is fifteen to eighty times faster than boost::signals.

    see link

    0 讨论(0)
  • 2020-12-01 00:47

    I have not used libsig++ but I've read up on it. My previous experience with signals and slots are from Qt and a little from Boost. If you don't have either of them available then you can try out my own signal and slots library (ksignals) that exist both for embedded code (no dynamic memory allocation) and "normal" c++ code (dynamic memory allocation when connecting).

    You can find it at : www.kjellkod.cc/signalandslots

    At the the page you can also find a comparison: KSignals Vs Boost signals.

    Speed vise ksignals is very fast and extremely lightweight code wise. It should be very easy to use, understand and if needed to modify it.

    Good luck Regards Kjell H

    0 讨论(0)
  • 2020-12-01 00:49

    The two you listed are the only two worth while that I'm aware of. Everything that I have seen has shown libsigc++ coming out on top performance wise. As you saw in the comparison, there are some instances where boost's syntax is a little prettier, but just a bit.

    I've personally used libsigc++ and am happy with it. Libsigc++ seems to be used by vastly more projects. A quick look in my package manager lists more than 100 projects dependant on libsigc++2. That alone is enough in my opinion to tilt the balance especially considering the performance advantage and the lack of other significant differences.

    I say libsigc++2.

    0 讨论(0)
提交回复
热议问题