A
AG
Hi all,
I am trying to do that, but it does not compile. I am not even sure this is
possible.
I have read somewhere that specialization inside a template class is not
without specializing the class itself, but couldn't verify it into the
standard.
Help would be appreciated.
Alexandre.
#define N 20
template<class T> class A
{
public:
template<int D> void f(T *a);
};
template<class T> template<int D> void A<T>::f<D>(T *a)
{
int i;
for(i=0;i<9;i++)
a[i+1]+=a;
f<D-1>(a+10);
}
template<class T> template<> void A<T>::f<0>(T * a)
{
int i;
for(i=0;i<9;i++)
a[i+1]+=a;
}
int main()
{
A<int> myObject;
int tab[N];
myObject.f<1>(tab);
return 0;
}
I am trying to do that, but it does not compile. I am not even sure this is
possible.
I have read somewhere that specialization inside a template class is not
without specializing the class itself, but couldn't verify it into the
standard.
Help would be appreciated.
Alexandre.
#define N 20
template<class T> class A
{
public:
template<int D> void f(T *a);
};
template<class T> template<int D> void A<T>::f<D>(T *a)
{
int i;
for(i=0;i<9;i++)
a[i+1]+=a;
f<D-1>(a+10);
}
template<class T> template<> void A<T>::f<0>(T * a)
{
int i;
for(i=0;i<9;i++)
a[i+1]+=a;
}
int main()
{
A<int> myObject;
int tab[N];
myObject.f<1>(tab);
return 0;
}