according to MSDN the typedef syntax is:
typedef type-declaration synonym;
Very easy:
typedef int MY_INT;
But how the heck does the member-function-pointer typedefs comply to this rule?
typedef int (MyClass::*MyTypedef)( int);
100% confusion – the synonym (MyTypedef) is in the middle?
Can someone please explain what the logical steps are to get from the very easy to understand syntax format of MSDN to the reverse/random/front/last/mixed syntax thing of aboves typedef?
*edit thanks for all the fast answers (and the beautification of my post) 🙂
Its not in the middle. Just forget member-function for a while, see how a function pointer is defined:
And this is how you would typedef it:
Simple! The only difference is, in the typedef
FuncPtrbecomes a type, while in the pointer declaration,FuncPtris a variable.Similarly,
And the typedef as: