【发布时间】:2015-01-06 02:31:54
【问题描述】:
我目前正在开发一个委托类,用于我的几个程序中。我的松散函数代码有效,但在绑定成员函数的代码中出现编译器错误。编译错误内容为
错误:在 '(' 标记之前应为 unqualified-id。
我看不出为什么会出现这种情况。我的代码,不包括编译良好的部分,如下:
template <typename T> class Delegate;
template <typename R, typename... Args>
class Delegate<R(Args)>
{
typedef void* InstancePtr;
//...
template <typename C, R (C::*classFunction)(Args...)>
static inline R MakeStubFunction(InstancePtr instance, Args... args)
{
// vvv error on this line vvv
return ( static_cast<C*>(instance)->(*classFunction) )(args...);
}
//...
};
谁能指出编译错误的来源?为了将来能够解决此类问题,“unqualified-id”是什么意思?
【问题讨论】:
-
"unqualified-id" 表示类似“某个名称”的意思,即字母,没有大括号等特殊字符,而是变量名称、类型名称、函数名称等。
标签: c++ c++11 void-pointers