If I have here DATA_T = std::string, I can't compile this code, because of error "no matching function for call to 'to_string'". The function does not allow converting a string to a string. But I need to get the string anyway, how can I work around this error and compile the program?
template <typename DATA_T>
std::string get_string(DATA_T subdata) {
std::string data = "...";
if (typeid(subdata) == typeid(std::string))
data += subdata;
else
data += std::to_string(subdata);
return data;
}