pointer to const member function typedef

前端 未结 3 1681
长情又很酷
长情又很酷 2021-01-01 11:36

I know it\'s possible to separate to create a pointer to member function like this

struct K { void func() {} };
typedef void FuncType();
typedef FuncType K::         


        
3条回答
  •  天涯浪人
    2021-01-01 12:13

    You want this:

    typedef void (K::*MemFuncType)() const;
    

    If you want to still base MemFuncType on FuncType, you need to change FuncType:

    typedef void FuncType() const;
    typedef FuncType K::* MemFuncType;
    

提交回复
热议问题