我有函数指针型或函数原型:模板:通过函数原型确定模板参数
int function (int arg);
typedef int (*function_t) (int arg);
和模板类像
template <typename T_ret, typename... T_args>
class caller {
T_ret (*m_p) (T_args... args);
public:
T_ret call (T_args... args) {
return m_p(args);
}
caller (T_ret (*p)(T_args...args)) : m_p(p) {}
};
是否有可能使编译器会自动确定内模板参数代码像
class caller2 : public caller <__something_with_function_prototype__> {
caller2 : caller (function) {};
};
而类似的问题:是否有可能做t他的,但与另一个模板类而不是功能?
template <typename T_ret, typename... T_args> class example;
typedef example<int, int> example_t;
谢谢。
的SOLU重刑是[这里](http://ideone.com/TxYh3X) – shved 2014-08-28 15:05:53