我习惯于在函数指针中看到这样的语法
int (*pointer_name) (float, char *);
void call_function (void (*)(int), int);
Run Code Online (Sandbox Code Playgroud)
在一些C++ 03函数库中,我看到以这种方式使用的类型:
abc::function<void(*)(int,float)> f;
Run Code Online (Sandbox Code Playgroud)
在C++ 11中,std::function我看到了这种方式给出的类型
std::function<void(int,float)> f;
Run Code Online (Sandbox Code Playgroud)
有一个失踪(*).为什么?
在C++ 03 function<T>已经T是相同的类型到相应的函数指针.很容易想象实现.
std::function在C++ 11中,核心语言增强功能支持它.是否已扩展模板参数类型以适应可调用性?