29 Aug
2012
29 Aug
'12
6:50 p.m.
CCompany Company;
CProcessor Processor;
// Compiler error: the signal sends an instance of CPerson, // not the result of CPerson::GetAge(). Too bad because // CProcessor does not have know about CPerson // // Company.BossHired.connect( // boost::bind(&CProcessor::f, &Processor, _1));
// So we use an ugly facade instead Company.BossHired.connect( boost::bind(ProcessorFacade, boost::ref(Processor), _1));
Although this is not an answer to your question, but if you have c++11 compiler, you can make a lambda: Company.BossHired.connect([&Processor](const CPerson& Person) { Processor.f(Person.GetAge()); });