Hey daniweb, I stumbled upon an issue I can't solve myself.
Here is the code :
#include <sstream>
#include <iostream>
template <class T>
inline T htot(std::string str)
{
T x;
std::stringstream ss;
ss << std::hex << str;
ss >> x;
return x;
}
int main()
{
int x = htot("0x0F"); // error: no matching function for call to 'htot(const char [5])'|
std::cout << "Hex(F) is Dec(" << x << ")";
std::cin.get();
return 0;
}
So why can't the compiler do this job without specifying the type with the call?
For example when I do specify the type with the call it compiles just fine
Call me dumb, but I just wasted 2 hours finding solutions to this.
Any help would be appreciated !
(My setup : GCC(MinGW) 4.4.1 on Win7)