Signal/Slot implementation with a focus on automatic connection handling
Try online GitHub Github Releases Build Status Coverage Status
- Automatic connection handling
- when a
SignalorSlotgoes out of scope, the connection is severed - no need to implement an interface or inherit a base class
- when a
- Type-safe
- Header only
- Not thread-safe
- Not reentrant-safe
Slot<std::string> observer([](std::string s) { std::cout << s << std::endl; }); Signal<std::string> subject; subject.connect(observer); subject.emit("Hello World");
class Button { public: Signal<> pressed; private: void onMouseButtonDownInsideButtonArea() { pressed.emit(); } }; class Popup { public: const Slot<> show = Slot<>(this, &Popup::render); private: void render() { } }; Button button; Popup popup; button.pressed.connect(popup.show);