throw ConversionException if not all chars could be extracted
This commit is contained in:
parent
aff51370d9
commit
d437126760
|
@ -172,7 +172,7 @@ template <typename NumberType, typename StringType> LIB_EXPORT NumberType string
|
||||||
std::basic_stringstream<typename StringType::value_type> ss;
|
std::basic_stringstream<typename StringType::value_type> ss;
|
||||||
ss << std::setbase(base) << string;
|
ss << std::setbase(base) << string;
|
||||||
NumberType result;
|
NumberType result;
|
||||||
if(ss >> result) {
|
if((ss >> result) && ss.eof()) {
|
||||||
return result;
|
return result;
|
||||||
} else {
|
} else {
|
||||||
throw ConversionException("The specified string is no valid number.");
|
throw ConversionException("The specified string is no valid number.");
|
||||||
|
|
Loading…
Reference in New Issue