E-MailRelay
|
A callback mechanism that isolates event sinks from event sources. More...
Classes | |
struct | Binder |
A functor class template that contains the target object pointer and method pointer, similar to c++20 bind_front(&T::fn,tp). More... | |
struct | Signal |
A slot holder, with connect() and emit() methods. More... | |
struct | SignalImp |
A slot/signal scoping class. | |
struct | Slot |
A slot class template that is parameterised only on the target method's signature (with an implicit void return) and not on the target class. More... | |
Functions | |
template<typename TSink , typename... Args> | |
Slot< Args... > | slot (TSink &sink, void(TSink::*method)(Args...)) |
A factory function for Slot objects. More... | |
A callback mechanism that isolates event sinks from event sources.
The slot/signal pattern has been used in several C++ libraries including libsigc++, Qt and boost, although it is largely redudant with modern C++. The pattern is completely unrelated to ANSI-C or POSIX signals (signal(), sigaction(2)).
Usage:
For comparison the equivalent modern C++ looks like this:
Slot methods should take parameters by value or const reference but beware of emit()ing references to data members of objects that might get deleted. Use temporaries in the emit() call if in doubt.