更新时间:2023-11-30 22:20:22
我在gcc 4.9中编译了代码,成员函数指针;
like this
I compiled your code in gcc 4.9 by providing template arguments to the member function pointer; like this
int main(){
// Compiles
forwarder(&example::f0, 10);
//Does not compile
forwarder(&example::f1, 10);
//Does compile, instantiate template with int or what ever you need
forwarder(&example::f1<int>,10)
}
我相信发生的是你需要实例化模板成员函数。
是否会改变你的界面太多?
我想任何答案将围绕实例化的成员模板不知何故。
I believe what is going on is that you need to instantiate the template member function. does that change your interface too much? I think any answer will revolve around instantiating that member template somehow.