V
vj
Hi All,
I was working on a dummy routine to fill up an array with random
numbers using function templates but jst hit a road block. I jst cant
get the code below to compile with MSVC 2010 compiler. I m not sure if
i m using the correct template specialization syntax here. So please
provide me some insight as to what is wrong here:
<code>
template <int * arr, int size> void randfill()
{
arr[size]=rand();
randfill<arr,size-1>();
}
template<int * arr> void randfill<arr,0>()
{
return;
}//<!-- error is here
//template instantiation code
int arr[10];
randfill<arr,10>();
</code>
the compilation error i m getting is stl.cpp(35) : error C2768:
'randfill' : illegal use of explicit template arguments.
Thanks in advance,
VJ
I was working on a dummy routine to fill up an array with random
numbers using function templates but jst hit a road block. I jst cant
get the code below to compile with MSVC 2010 compiler. I m not sure if
i m using the correct template specialization syntax here. So please
provide me some insight as to what is wrong here:
<code>
template <int * arr, int size> void randfill()
{
arr[size]=rand();
randfill<arr,size-1>();
}
template<int * arr> void randfill<arr,0>()
{
return;
}//<!-- error is here
//template instantiation code
int arr[10];
randfill<arr,10>();
</code>
the compilation error i m getting is stl.cpp(35) : error C2768:
'randfill' : illegal use of explicit template arguments.
Thanks in advance,
VJ