我有函數指針型或函數原型:模板:通過函數原型確定模板參數
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