I'm building a program which was originally written for gcc. One of the header files contains some conversion functions which look like this:-
Attempting to compile these with MSVC produces errors like:- error C2912: explicit specialization; 'std::string PBD::to_string(int32_t)' is not a specialization of a function template
I can get rid of the errors either by removing the lines which say template<> - or alternatively by changing them to say template<class T>. Is there any validity in the original lines which just say template<> :confused:
Code:
template <>
inline std::string to_string (bool val)
{
std::string tmp;
bool_to_string (val, tmp);
return tmp;
}
template <>
inline std::string to_string (int16_t val)
{
std::string tmp;
int16_to_string (val, tmp);
return tmp;
}
template <>
inline std::string to_string (int32_t val)
{
std::string tmp;
int32_to_string (val, tmp);
return tmp;
}
I can get rid of the errors either by removing the lines which say template<> - or alternatively by changing them to say template<class T>. Is there any validity in the original lines which just say template<> :confused: