Ensure still the right stringToNumber() overload is called for char arrays

This commit is contained in:
Martchus 2021-03-22 12:13:20 +01:00
parent 42132719e5
commit a30ba0c147
1 changed files with 3 additions and 3 deletions

View File

@ -492,7 +492,7 @@ template <typename CharType> CharType charToDigit(CharType character, CharType b
* \throws A ConversionException will be thrown if the provided \a string is not a valid number.
* \sa numberToString(), bufferToNumber()
*/
template <typename IntegralType, typename StringType, Traits::EnableIf<std::is_integral<IntegralType>, std::is_unsigned<IntegralType>> * = nullptr>
template <typename IntegralType, typename StringType, Traits::EnableIf<std::is_integral<IntegralType>, std::is_unsigned<IntegralType>, Traits::Not<std::is_scalar<std::decay_t<StringType>>>> * = nullptr>
IntegralType stringToNumber(const StringType &string, IntegralType base = 10)
{
IntegralType result = 0;
@ -513,7 +513,7 @@ IntegralType stringToNumber(const StringType &string, IntegralType base = 10)
* \throws A ConversionException will be thrown if the provided \a string is not a valid number.
* \sa numberToString(), bufferToNumber()
*/
template <typename IntegralType, class StringType, Traits::EnableIf<std::is_integral<IntegralType>, std::is_signed<IntegralType>> * = nullptr>
template <typename IntegralType, class StringType, 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)
{
auto i = string.begin();
@ -547,7 +547,7 @@ IntegralType stringToNumber(const StringType &string, IntegralType base = 10)
* \a base and types).
* \sa numberToString(), bufferToNumber()
*/
template <typename FloatingType, class StringType, Traits::EnableIf<std::is_floating_point<FloatingType>> * = nullptr>
template <typename FloatingType, class StringType, Traits::EnableIf<std::is_floating_point<FloatingType>, Traits::Not<std::is_scalar<std::decay_t<StringType>>>> * = nullptr>
FloatingType stringToNumber(const StringType &string, int base = 10)
{
std::basic_stringstream<typename StringType::value_type> ss;