How can I use the new1 using
keyword to declare a function type?
I know how I can use it to declare a function pointer type. For example, the following typedef:
typedef int (*int_to_int)(int);
seems equivalent to the following using declaration:
using int_to_int = int (*)(int);
How do I do the same for the following non-pointer typedef:
typedef int (int_to_intf)(int);
My "removing the typedef name and putting it after using
" algorithm doesn't work:
using int_to_intf_u = int ()(int); // nope, doesn't compile
1 At least for those poor souls like me who still define "new" as "introduced in C++11".
It's just int(int)
. To get the abstract declarator, just remove the variable name from an actual declaration. You would declare int f(int);
, so the abstract declarator should be int(int)
.