int func(void);
//函数指针
int (*pfunc)(void) = func;
//返回函数指针的函数
//经典方法,传入一个int参数
int (*test(int))(void);
//后置返回值
auto test1(int) ->int (*)();
//decltype推断
decltype(func) * test2(int);
//use using
using PF = int(*)(void);
PF test3(int);
经典方法说明以下
首先一个函数
test(int)
返回一个函数指针类型前面至少要有*修饰吧,先想象成这样
*test(int)
这个指针是指向函数的
int(*)(void);
嵌套以下就是了
int(*test(int))(void);
顺便吐槽以下:怎么会有这样奇怪的语法???;C++11 NB,后置返回值是真好用。