文字放大
朝顏
484
發表
各位好~
如題函式指標宣告如下
void (helloworld::*pf)() = &helloworld::funcA;
或是
int (helloworld::*pf2)(int a,int b) = &helloworld::funcB;
也就是儲存不同的引述與回傳值的function pointer
template要如何宣告?
skill
霸氣翔陽
2837
回覆2016-08-25 09:18:42
有簡單的方法跟困難的方法,簡單的方法就是用typedef
比方說typedef bool (*SomeFunctionPt)(int, int);
再std::list<SomeFuntionPt>
困難的就...沒必要說了 XD 不知道你問的是不是這個
另外C++11的std::function也可以用