// signal.cpp : Defines the entry point for the console application. // #include #include #include struct fn_arity1 { typedef void result_type; template void operator()(const T1 _d1) const {std::cout << _d1 << std::endl;} }; struct fn_arity2 { typedef void result_type; template void operator()(const T1 _d1, const T2 _d2) const {std::cout << _d1 << " " << _d2 << std::endl;} }; int main(int argc, char* argv[]) { fn_arity1 fn1; fn_arity2 fn2; // unary to unary boost::signal s1; s1.connect(boost::bind(fn1, _1)); s1(1.1); // binary to binary boost::signal s2; s2.connect(boost::bind(fn2, _1, _2)); s2(1.1, 2.2); // binary to unary ??? boost::signal s3; s3.connect(boost::bind(fn1, _2)); s3(1.1, 2.2); return 0; }