Below is my func. I call it with
if(try_strtol(v, rhs))
and RHS = "15\t// comment"
bool try_strtol(int64_t &v, const string& s)
{
try
{
std::stringstream ss(s);
if ((ss >> v).fail() || !(ss >> std::ws).eof())
throw std::bad_cast();
return true;
}
catch(...)
{
return false;
}
}
It returns false, i except true with v=15. How do i fix this?