1

我想转换int __stdcall A::(int, int)int __stdcall (A*, int, int).

我的代码是

class A {
public:
    int __stdcall B(int, int);
};

template<typename C, typename P1, typename P2>
struct Mem2Normal<int __stdcall C::(P1, P2)> {
    typedef int __stdcall (C*, P1, P2) type;
}; 

Mem2Normal<decltype(A::B)>::type

它导致了很多语法错误,如何修复它?

4

1 回答 1

3

对于函数指针,以下工作:

class A {
public:
    int __stdcall B(int, int);
};

template<typename>
struct Mem2Normal;

template<typename C, typename P1, typename P2>
struct Mem2Normal<int (__stdcall C::*)(P1, P2)> {
    typedef int __stdcall type(C*, P1, P2);
};

int main()
{
    Mem2Normal<decltype(&A::B)>::type x;
}
于 2013-09-20T17:48:42.973 回答