Fix a few details in string conversion functions
This commit is contained in:
parent
546b1fecb7
commit
d5e35e460c
|
@ -537,7 +537,7 @@ IntegralType stringToNumber(const StringType &string, BaseType base = 10)
|
||||||
*/
|
*/
|
||||||
template <typename IntegralType, class StringType, typename BaseType = IntegralType,
|
template <typename IntegralType, class StringType, typename BaseType = IntegralType,
|
||||||
Traits::EnableIf<std::is_integral<IntegralType>, std::is_signed<IntegralType>, Traits::Not<std::is_scalar<std::decay_t<StringType>>>> * = nullptr>
|
Traits::EnableIf<std::is_integral<IntegralType>, std::is_signed<IntegralType>, Traits::Not<std::is_scalar<std::decay_t<StringType>>>> * = nullptr>
|
||||||
IntegralType stringToNumber(const StringType &string, IntegralType base = 10)
|
IntegralType stringToNumber(const StringType &string, BaseType base = 10)
|
||||||
{
|
{
|
||||||
auto i = string.begin();
|
auto i = string.begin();
|
||||||
auto end = string.end();
|
auto end = string.end();
|
||||||
|
@ -581,10 +581,10 @@ FloatingType stringToNumber(const StringType &string, int base = 10)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
std::string errorMsg;
|
std::string errorMsg;
|
||||||
errorMsg.reserve(42 + string.size());
|
errorMsg.reserve(48 + string.size());
|
||||||
errorMsg += "The string \"";
|
errorMsg += "The string \"";
|
||||||
errorMsg += string;
|
errorMsg += string;
|
||||||
errorMsg += "\" is no valid floating number.";
|
errorMsg += "\" is no valid floating point number.";
|
||||||
throw ConversionException(errorMsg);
|
throw ConversionException(errorMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue