Does the next job work?
template<> void xxx<std::string>(std::string& param) { std::cout << "String : "<< param.size()<< std::endl; }
And the same for const std::string ?
However, it does not specialize in a function template if you have a choice (and you usually do!). Instead, just overload the function:
void xxx(std::string& param) { std::cout << "String : "<< param.size()<< std::endl; }
Please note that this is not a template. In 99% of cases, this is normal.
(Something else, C ++ has no <string.h> header, except for backward compatibility with C. The C-string header in C ++ is called <cstring> (note the leading c ), but from your code it looks like you really mean the header <string> (no leading c ).)
source share