可以使用 C++ 模板声明一个函数,如下所示:
template <class T>
T function_A (T input){
printf("function_A has been called.");
return input;
}
但是是否可以定义一个使用 C++ 模板声明返回类型的 C 块(或回调)类型?例如:
template <class T>
typedef T (^Block)(T input);
我该怎么做(如果需要,使用 Obj-C++)?