sigslot is a head only signal slot lib,written by Sarah Thompson.
原始仓库是 http://sourceforge.net/projects/sigslot/
文档是 http://sigslot.sourceforge.net/sigslot.pdf
a Patched version of Sarah Thompson‘s sigslot implementation. Works with VS 2013 on Windows 7 using C++11.
https://github.com/arvidsson/sigslot
使用方式很简单,include头文件siglslot.h, 所有类在sigslot namespace中。
#include <iostream> #include "sigslot.h" using namespace std; using namespace sigslot; class window { public: signal0<> _lclicksig; signal1<int> _paintsig; }; class foo : public has_slots<> { public: void lbuttondown() { cout<<"left button clicked"<<endl; } void paint(int i) { cout<<"i = "<<i<<endl; } }; int main() { window w; foo f; w._lclicksig.connect(&f, &foo::lbuttondown); w._paintsig.connect(&f, &foo::paint); w._lclicksig(); w._paintsig(100); return 0; }
sigslot,一个开源的c++signal slot库,布布扣,bubuko.com
时间: 2024-10-12 08:24:24