我需要将我的函数作为参数传递,但它应该是模板函数。例如。指向模板函数的指针
template <class rettype, class argtype> rettype test(argtype x)
{
return (rettype)x;
}
我需要使用此函数作为方法的参数。
template <class type,class value> class MyClass
{
// constructors, etc
template <class type,class value> void myFunc(<function should be here with parameters >) {
rettype result = function(argtype);
}
};
是否可以这样做?
你在哪里提议从中获取类型的'数据argtype'? – Yakk 2015-02-24 21:09:50