3
我使用boost(信号+绑定)和C++来传递函数引用。下面是代码:绑定函数问题
#define CONNECT(FunctionPointer) \
connect(bind(FunctionPointer, this, _1));
我用这个像这样:
class SomeClass {
void test1() {}
void test2(int someArg) {}
SomeClass() {
CONNECT(&SomeClass::test1);
CONNECT(&SomeClass::test2);
}
};
二测功能结合作品(测试2),因为它至少有一个参数。第一次测试我有一个错误:
‘void (SomeClass::*)()’ is not a class, struct, or union type
为什么我不能没有参数传递函数?
好吧,我udnerstand。我知道宏是邪恶的,但我的宏的身体是巨大而丑陋的。当然,如果它像我的样本,我会用它。谢谢。 – Ockonal 2010-07-23 11:29:45