一个C++成员函数的问题
大脚板 2004-08-09 09:58:12 class CThreadPool
{
public:
template <class T>
static void Execute2(void(T::*funcptr)(void*)){}
class A
{
int i;
public:
void proc(void* param)
{
std::cout<<param;
}
void exec(void)
{
CThreadPool::Execute2(A::proc);
}
};
提示错误
error C2784: 'void __cdecl CThreadPool::Execute2(void (__thiscall T::*)(void *))' : could not deduce template argument for 'overloaded function type' from 'overloaded function type'
Error executing cl.exe.
如果将exec声明为静态,或者是全局函数,编译就可以通过,不解,望人指点迷津