Search code examples
c++c++11typedefusing

How do I typedef a method pointer with the C++11 using syntax?


I'd like to write this

class A {
   ...
};
typedef void (A::*MethodPtr)();

using using. How would I do that?

Would appreciate answers both with and without using type_traits.

(The answer for regular functions can be found here: How do I typedef a function pointer with the C++11 using syntax?)


Solution

  • using MethodPtr = void (A::*)();
    

    Quite similar to a function pointer, in fact.