#include <boost/bind.hpp>
#include <boost/signal.hpp>
#include <iostream>
using namespace std;
struct MYSTRUCT
{
void operator()()
{
std::cout<<"Hello,World!"<<std::endl;
}
void fun(const string& msg)
{
cout<<msg<<endl;
}
};
//////////////////////////////////////////////////////////////////////////
int main()
{
//exam 1
MYSTRUCT fun;
boost::signal< void(string) > sig;
boost::signal< void(string) >::slot_function_type slot;
slot = boost::bind(&MYSTRUCT::fun , &fun , _1);
sig.connect(slot);
////emit signal
sig("hello ori");
//exam 2
boost::signal<void()> sig2;
MYSTRUCT hello;
sig2.connect(hello);
sig2();
system("pause");
return 0;
}