C++ No instance of function template matches speciefied type -
i have template:
template <typename t> t func(const t[],int); and try specialize to:
template <> char* func(const char[], int);
but have error:
no instance of function template "func" matches specified type
i don't know why cannot return char* template? solution change to:
template <typename t> t* func(const t[],int);
you declaring specialization wrong:
template <> char func<char>(const char[], int) if meaning return pointer, have solved on own, , need change general case t*
t refers typename, not including qualifiers - function return t & if wanted to. t type/name (typename!) of object.
Comments
Post a Comment