#include #include #include #include class TestBind { public: int counter; TestBind():counter(0){} void OnEventReceived(char b) { counter++; } }; int main(int argc, char* argv[]) { TestBind testBind; boost::function f = boost::bind(&TestBind::OnEventReceived,&testBind,_1); { boost::progress_timer timer; for(int i = 0; i < 10000000; i++) { f('a'); } } std::cout< sig; sig.connect(boost::bind(&TestBind::OnEventReceived,&testSignal,_1)); { boost::progress_timer timer; for(int i = 0; i < 10000000; i++) { sig('a'); } } std::cout << testSignal.counter << std::endl; }