template function can't be called without determination of Type
Hey daniweb, I stumbled upon an issue I can't solve myself.
Here is the code :
template <class T>
inline T htot(std::string str)
ss << std::hex << str;
ss >> x;
int x = htot("0x0F"); // error: no matching function for call to 'htot(const char )'|
std::cout << "Hex(F) is Dec(" << x << ")";
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)
8 Months Ago
Related Article:undefined reference to a template function
is a solved C++ discussion thread by Allander that has 1 reply, was last updated 1 year ago and has been tagged with the keywords: function, list, passing, template.