L
linarin
How could I make this templates to work:
template<typename F,F f> //here f is non type template parameter
bool MethodProxy(int a,int b){ //could'nt change this function
return type and arguments.
return true;
}
template<typename F> //here F is a type of function object
void Def(F f){
static MyStruct global_methods[] =
{
{ "alert", JsProxyMethod<F,f> }, // error occur at here
NULL
} ;
//here do more works.
}
int alert(int a){
return 0;
}
int main(int argc,char* argv[]){
Def(alert); //when this function invoked, alert will be
executed.
return 0;
}
the error message is :
compiler complains that "f" not a valid argument and JsProxyMethod is
not a external linkage function.
template<typename F,F f> //here f is non type template parameter
bool MethodProxy(int a,int b){ //could'nt change this function
return type and arguments.
return true;
}
template<typename F> //here F is a type of function object
void Def(F f){
static MyStruct global_methods[] =
{
{ "alert", JsProxyMethod<F,f> }, // error occur at here
NULL
} ;
//here do more works.
}
int alert(int a){
return 0;
}
int main(int argc,char* argv[]){
Def(alert); //when this function invoked, alert will be
executed.
return 0;
}
the error message is :
compiler complains that "f" not a valid argument and JsProxyMethod is
not a external linkage function.