I'm using std::stoi in following manner
int ConvertToInt( const std::string& aVal )
{
int lVal = std::stoi( aVal, nullptr, 0 );
return lVal;
}
Third argument in std::stoi was provided as 0 to convert automatically both DEC and HEX values.
I also use try-catch structure to catch std::invalid_argument, std::out_of_range and ( ... ) althought when I provide number as 0xgg no exception is thrown and the number is converted to 0 which is not my intention.
Is it possbile to catch digits, which are out of range and throw some exception ?