我正在尝试编写一个返回函数指针的函数。这是我的最小示例:
void (*myfn)(int)() // Doesn't work: supposed to be a function called myfn
{ // that returns a pointer to a function returning void
} // and taking an int argument.
当我用g++ myfn.cpp
它编译它时会打印这个错误:
myfn.cpp:1:19: error: ‘myfn’ declared as function returning a function
myfn.cpp:1:19: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11 [enabled by default]
这是否意味着我不允许返回函数指针?