Ebeworld’s Weblog

Trying to create

Boost signals

Much more like event handler in C# and still working on its difference with delegate, which is combinable.

#include <boost/signal.hpp> 
#include <iostream> 

void func() 
{ 
	std::cout << "Hello, world!" << std::endl; 
}

void func2(){
	std::cout<<"Me too!"<<std::endl;
}

int main() 
{ 
	boost::signal<void ()> s; 
	s.connect(func);
	s.connect(func2);
	s.connect(func);
	s.disconnect(func);
	s(); 
} 

March 21, 2011 - Posted by | Algorithms, CPP, Uncategorized

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.