[問題] function ptr & template
開發平台(Platform): (Ex: Win10, Linux, ...)
沒關係
編譯器(Ex: GCC, clang, VC++...)+目標環境(跟開發平台不同的話需列出)
g++
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
無
問題(Question):
各位大神安安
小弟我最近要想要寫一個可以吃各種函數的牛頓法
無奈學藝不精想不出厲害的辦法
最後做了這樣的嘗試
template<typename Fprt>
class FUNCTIONAL
{
public:
Fptr FUNC;
FUNCTIONAL(Fptr ptr):FUNC(ptr){}
auto operator()(auto U){return FUNC(U)}
};
我的問題是這樣的
能不能從Fptr裡面提取資訊置換掉call operator的兩個auto?
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.113.22.70
※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1477835247.A.57E.html
推
10/30 22:08, , 1F
10/30 22:08, 1F
→
10/30 22:10, , 2F
10/30 22:10, 2F
推
10/31 03:09, , 3F
10/31 03:09, 3F
推
10/31 06:06, , 4F
10/31 06:06, 4F
→
10/31 06:06, , 5F
10/31 06:06, 5F
推
10/31 08:24, , 6F
10/31 08:24, 6F
→
11/03 14:05, , 7F
11/03 14:05, 7F