I've always struggled with remembering the syntax for function type typedefs:
typedef RETTY (*FNTYNAME)(ARGTY1, ARGTY2, ..., ARGTYn);
we can now use using
for a far more pleasant syntax:
using FNTYNAME = RETTY(ARGTY1, ARGTY2, ..., ARGTYn);
which is also intuitive. You write down the "type"
on the right hand side, and give it a name on the left.
This is not strictly the same, since the typedef
typedefs
FNTYNAME
to a function pointer type , while
the C++ version typedefs the function type . I prefer
the latter at any rate, since I dislike the fact
that the usual typedef tends to hide the fact that a
function pointer is some pointer-like-thing.