I'll go into a bit of detail about what I am trying to do.
I have a class that accepts a string (similar in format to an HTTP post string), and splits it up into its key/value pairs. The accessor function for these pairs is declared as follows:
sometimes I want to get a key as an integer because it contains a numeric value, so it would be nice to have an overload of the function that returns int, but takes the same parameters.
std::string GetKeyValue(const std::string& str):
my solution was the following:
I could then just add another overload for any new type I want to return, but as you can tell from this thread, this didn't work as expected.
template <class T> T _GetKeyValue(const std::string& str)
void GKV(const string& str, std::string& t);
void GKV(const string& str, int& t);
void GKV(const string& str, double& t);
void GKV(const string& str, long& t);