There are two problems:
> template <class T,int size >
`int size' is a non-type template parameter. In an explicit
specialization, it expected to be filled in an actual constant, like
template<> int count<const char *, 20>
If you need it to be also customizable, you need partial specialization.
However, a function template does not support it, so you will finally
need a functor.
> template<> int count< const char * ,int size > ( const char *
> (&array)[size ], const char *x) { }
You replaced `T' with `const char *', than how about the `const T'
used in main template? That's `const char * const' actually.
The following one compiles, but as I said, you do need a functor.
template<>
int count<const char *, 20>(const char * const (&array)[20],
const char * x) { /* return sth. */ }
|