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

Popular posts from this blog

Java 8 + Maven Javadoc plugin: Error fetching URL -

android - How to delete or change the searchview icon inside the SearchView actionBar? -

c++ - Msgpack packing bools bug -