函數簽名是否有可能實現這樣的事情:作爲模板參數
template<typename Signature>
class Test
{
public:
//here I want operator() to respect the signature
};
Test<void(int)> t1; //void operator()(int)
Test<void(int, float)> t2; //void operator()(int, float)
返回類型總是void
。
我想作爲模板參數發送函數簽名。這可能嗎? 我無法使用可變模板,因爲我的編譯器還不支持此功能。
你試圖做什麼?你可以使用函數簽名來實例化一個模板,問題將是執行函數時的參數。參見例如:'boost :: bind'。 – Nim