简体   繁体   中英

Partial specialization with member function type

I want to convert int __stdcall A::(int, int) to int __stdcall (A*, int, int) .

My code is

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

It caused a lot of syntax errors, how to fix it?

For function pointers , the following works:

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;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM