views:

344

answers:

2

Hi there,

I know that the question has already been asked and answered, but it was more than one year ago and it looks like there are new alternatives out there.

So I'm coding a game with the SFML library (which I'm starting to find pretty much cool actually) and I'm looking for a light and fast event/delegate library.

After doing some research and having put aside the classical ones (Boosts.Signals, libsigc++), I found "cpp-events". It does not look very popular right now — since it is a very recent library — but it seems worst to be tested. I would be very interested to know if someone here tried it and can give a little feedback.

Do you have other similar (or better) options to suggest? I look rather real projects (which will be maintained) than answers on forums.

Thank you !

A: 

My feeling is that http://www.codeproject.com/KB/cpp/ImpossiblyFastCppDelegate.aspx is a great implementation for games. No dynamic memory allocation, reasonable performance, simple to debug => great for games.

I have used similar delegates in the past, this implementation looks more efficient.

The one you suggested mentions thread safety, but I would not be comfortable with a delegate based interface being used between threads. That may work fine on a small project but if a team grows, so too does the potential for disaster. I would also question the performance implications of such a feature.

Dan O
+1  A: 

Also take a look at Boost.Signals2 which is the thread-safe version of Boost.Signals. I'm using it at work in a medium-sized project and I'm quite happy with it.

Tom
+1 I would use Signals2 even when thread-safety is not needed because it is also header-only.
Tronic