I have method which returns string, e.g. returnString(std::string arg)
I would like to have some wrapper function which will cast this function and return different types (and maybe do some further computation) based on how the wrapper function was called. I do not know how exactly this concept of requesting data type in templates is named so I will post example:
object->returnWrapper<int>(arg) // return std::stoi(returnString(std::string arg))
object->returnWrapper<string>(arg) // return returnString(std::string arg)
object->returnWrapper(arg) // return returnString(std::string arg)
The last one isn't mandatory, if there is need to always request desired type to explicitly get string I'm fine with that.
Based on this question I've tried
template <>
int returnWrapper<int>(std::string arg) {
return std::stoi(returnString(std::string arg))
}
but it VS intelisense says that returnWrapper is not a template