Libsigc++


libsigc++ is a C++ library for typesafe callbacks.
libsigc++ implements a callback system for use in abstract interfaces and general programming. libsigc++ is one of the earliest implementations of the signals and slots concept implemented using C++ template metaprogramming. It was created as an alternative to the use of a meta compiler such as found in the signals and slots implementation in Qt. libsigc++ originated as part of the gtkmm project in 1997 and later was rewritten to be a standalone library. Each signal has a particular function profile which designates the number of arguments and argument type associated with the callback. Functions and methods are then wrapped using template calls to produce function objects which can be bound to a signal. Each signal can be connected to multiple functors thus creating an observer pattern through which a message can be distributed to multiple anonymous listener objects. Reference counting based object lifespan tracking was used to disconnect the functors from signals as objects are deleted. The use of templates allowed for compile time typesafe verification of connections. The addition of this strict compile time checking required the addition of template typecasting adapters which convert the functor callback profile to match the required signal pattern.
libsigc++ was a natural expansion of the C++ standard library functors to the tracking of objects necessary to implement the observer pattern. It inspired multiple C++ template based signal and slot implementations including the signal implementation used in the boost C++ libraries.
libsigc++ is released as free software under the GNU Lesser General Public License.