时,这是我尽量做到:成员函数指针语法声明一个模板
class MyClass
{
public:
template<typename T>
void whenEntering(const std::string& strState,
T& t,
void T::(*pMemberFunction)(void)) /// compilation fails here
{
t.(*pMemberFunction)(); // this line is only an example
}
}
它是一种回调系统的反应,一些事件我收到。
但是视觉2010,我下面的编译错误:
error C2589: '(' : illegal token on right side of '::'
我可能是错的指针到成员语法...但我也害怕我可能不会定义模板此方式...你有什么想法吗?
现在编译罚款! –