If you’re a seasoned C++ developer, chances are you’ve come into contact with a signals/slots library at least once during your work, maybe you’re even using one right now.
If you haven’t heard of this before, let me give you a short introduction: a signals/slots
library is nothing more than a fancy callback system: A class, let’s think of a fictional
Button
class for now, can provide signals like Pushed
signal.
A signal is just a list of callbacks that can be invoked when the signal is triggered.
Now any party interested in getting notified when the button is pushed can subscribe itself to
the Pushed
signal and will be notified by means of a callback. Typically you can
bind any plain function, class method or functor to a signal.