D - recursive templates (help please)
- Ivan Senji (34/34) Apr 24 2004 I am trying to convert this function into a template:
I am trying to convert this function into a template:
float f(int i,int n,float t)
{
if(i==0 && n==0)return 1;
if(i==n+1 || i==-1)return 0;
return (1.0f-t)*f(i,n-1,t)+t*f(i-1,n-1,t);
}
what i am trying to do is:...
template F(int I,int N)
{
float F(float t)
{
//if(I==0 && N==0)return 1;
//if(I==N+1 || I==-1)return 0;
return (1.0f-t)*.F!(I,N-1)(t)+t*.F!(I-1,N-1)(t);
}
}
template F(int I : 0,int N : 0)
{
float F(float t)
{
return 1;
}
}
but this won't work:
but template F(int I ,int N : I-1)
{
float F(float t)
{
return 0;
}
}
and even without it, the compiler doesn't output
any error messages but it doesn't create a .obj file!
Apr 24 2004








"Ivan Senji" <ivan.senji public.srce.hr>