sigslot for c++

1073 단어 C++c.netC#


#include "stdafx.h"
//http://sigslot.sourceforge.net/
//#include "..\sigslot\sigslot.h"
#include "libjingle\libjingle-0.4.0\talk\base\sigslot.h"
//   sourceforge   sigslot.h    ,  libjingle     sigslot.h  

class Receiver : public sigslot::has_slots<>{
public:
	Receiver(std::string s){
		msg = s;
	}

	void Ondone(int a, std::string s){
		printf("
%s: %s", msg.c_str(), s.c_str()); } private: std::string msg; }; int main(int argc, char* argv[]) { Receiver r1("111"); Receiver r2("2222"); sigslot::signal2<int, std::string> signal1; signal1.connect(&r1, &Receiver::Ondone); signal1.connect(&r2, &Receiver::Ondone); //signal1.emit(1, "hello"); signal1(1, "hello"); return 0; }

그리고 하나
http://libsigc.sourceforge.net/

좋은 웹페이지 즐겨찾기