The following example is working when I manualy replace T wirh char *, but why is not working as it is:
T
char *
template
I guess it's because your function expects const (char *) (since T is char *), i.e. you can't change the address it points to, while const char * stands for (const char) *, i.e. you can't change the value on the place the pointer points to.
const (char *)
const char *
(const char) *