mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2024-12-23 21:25:49 +00:00
fix to_string
fix from_string fix filename typo
This commit is contained in:
parent
c901c3058a
commit
09b4b56fad
6 changed files with 75 additions and 67 deletions
|
@ -39,21 +39,21 @@ namespace sprout {
|
|||
sprout::next(str, 2),
|
||||
base ? base : 16,
|
||||
IntType(),
|
||||
sprout::detail::char_to_int<IntType>(*sprout::next(str, 2), base),
|
||||
sprout::detail::char_to_int<IntType>(*sprout::next(str, 2), base ? base : 16),
|
||||
negative
|
||||
)
|
||||
: sprout::detail::str_to_int_impl_1<IntType>(
|
||||
sprout::next(str),
|
||||
base ? base : 8,
|
||||
IntType(),
|
||||
sprout::detail::char_to_int<IntType>(*sprout::next(str), base),
|
||||
sprout::detail::char_to_int<IntType>(*sprout::next(str), base ? base : 8),
|
||||
negative
|
||||
)
|
||||
: sprout::detail::str_to_int_impl_1<IntType>(
|
||||
str,
|
||||
base ? base : 10,
|
||||
IntType(),
|
||||
sprout::detail::char_to_int<IntType>(*str, base),
|
||||
sprout::detail::char_to_int<IntType>(*str, base ? base : 10),
|
||||
negative
|
||||
)
|
||||
;
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
namespace sprout {
|
||||
namespace detail {
|
||||
template<typename Elem, typename IntType>
|
||||
inline SPROUT_CONSTEXPR Elem int_to_char(IntType val, std::size_t base){
|
||||
inline SPROUT_CONSTEXPR Elem int_to_char(IntType val, int base){
|
||||
return val >= 0 && val < 10 ? static_cast<Elem>('0') + val
|
||||
: val >= 10 && val < base ? static_cast<Elem>('a') + (val - 10)
|
||||
: val >= 10 && val < static_cast<IntType>(base) ? static_cast<Elem>('a') + (val - 10)
|
||||
: throw std::invalid_argument("value out of bounds")
|
||||
;
|
||||
}
|
||||
|
@ -23,10 +23,10 @@ namespace sprout {
|
|||
}
|
||||
|
||||
template<typename IntType, typename Elem>
|
||||
inline SPROUT_CONSTEXPR IntType char_to_int(Elem c, std::size_t base){
|
||||
return sprout::ascii::isdigit(c) && static_cast<std::size_t>(c - static_cast<Elem>('0')) < base ? c - static_cast<Elem>('0')
|
||||
: sprout::ascii::islower(c) && static_cast<std::size_t>(c - static_cast<Elem>('a') + 10) < base ? c - static_cast<Elem>('a') + 10
|
||||
: sprout::ascii::isupper(c) && static_cast<std::size_t>(c - static_cast<Elem>('A') + 10) < base ? c - static_cast<Elem>('A') + 10
|
||||
inline SPROUT_CONSTEXPR IntType char_to_int(Elem c, int base){
|
||||
return sprout::ascii::isdigit(c) && c - static_cast<Elem>('0') < base ? c - static_cast<Elem>('0')
|
||||
: sprout::ascii::islower(c) && c - static_cast<Elem>('a') + 10 < base ? c - static_cast<Elem>('a') + 10
|
||||
: sprout::ascii::isupper(c) && c - static_cast<Elem>('A') + 10 < base ? c - static_cast<Elem>('A') + 10
|
||||
: static_cast<IntType>(-1)
|
||||
;
|
||||
}
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
|
||||
#include <cstddef>
|
||||
#include <sprout/string/to_string.hpp>
|
||||
#include <sprout/string/from_strong.hpp>
|
||||
#include <sprout/string/from_string.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_STRING_CONVERSION_HPP
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#ifndef SPROUT_STRING_INT_TO_STRING_HPP
|
||||
#define SPROUT_STRING_INT_TO_STRING_HPP
|
||||
|
||||
#include <cstddef>
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/string/string.hpp>
|
||||
|
@ -11,16 +10,26 @@
|
|||
#include <sprout/detail/char_conversion.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
// printed_integer_digits
|
||||
//
|
||||
template<typename IntType, std::size_t Base = 10>
|
||||
struct printed_integer_digits
|
||||
: public std::integral_constant<
|
||||
std::size_t,
|
||||
sprout::integer_digits<IntType, Base>::value + (std::is_signed<IntType>::value ? 1 : 0)
|
||||
>
|
||||
{};
|
||||
|
||||
namespace detail {
|
||||
template<
|
||||
typename Elem,
|
||||
std::size_t Base,
|
||||
int Base,
|
||||
typename IntType,
|
||||
typename... Args,
|
||||
typename sprout::enabler_if<(sizeof...(Args) == sprout::integer_digits<IntType, Base>::value - 1)>::type = sprout::enabler
|
||||
typename sprout::enabler_if<(sizeof...(Args) == sprout::printed_integer_digits<IntType, Base>::value - 1)>::type = sprout::enabler
|
||||
>
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<Elem, sprout::integer_digits<IntType, Base>::value>
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<Elem, sprout::printed_integer_digits<IntType, Base>::value>
|
||||
int_to_string_impl_1(IntType val, bool negative, Args... args) {
|
||||
return negative ? sprout::make_string_as<Elem>(static_cast<Elem>('-'), args...)
|
||||
: sprout::make_string_as<Elem>(args...)
|
||||
|
@ -28,12 +37,12 @@ namespace sprout {
|
|||
}
|
||||
template<
|
||||
typename Elem,
|
||||
std::size_t Base,
|
||||
int Base,
|
||||
typename IntType,
|
||||
typename... Args,
|
||||
typename sprout::enabler_if<(sizeof...(Args) < sprout::integer_digits<IntType, Base>::value - 1)>::type = sprout::enabler
|
||||
typename sprout::enabler_if<(sizeof...(Args) < sprout::printed_integer_digits<IntType, Base>::value - 1)>::type = sprout::enabler
|
||||
>
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<Elem, sprout::integer_digits<IntType, Base>::value>
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<Elem, sprout::printed_integer_digits<IntType, Base>::value>
|
||||
int_to_string_impl_1(IntType val, bool negative, Args... args) {
|
||||
return val == 0
|
||||
? (negative ? sprout::make_string_as<Elem>(static_cast<Elem>('-'), args...)
|
||||
|
@ -42,39 +51,38 @@ namespace sprout {
|
|||
: sprout::detail::int_to_string_impl_1<Elem, Base>(
|
||||
val / Base,
|
||||
negative,
|
||||
sprout::detail::int_to_char<Elem>(val % Base, Base),
|
||||
sprout::detail::int_to_char<Elem>(negative ? -(val % Base) : val % Base, Base),
|
||||
args...
|
||||
)
|
||||
;
|
||||
}
|
||||
template<typename Elem, std::size_t Base, typename IntType>
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<Elem, sprout::integer_digits<IntType, Base>::value>
|
||||
template<typename Elem, int Base, typename IntType>
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<Elem, sprout::printed_integer_digits<IntType, Base>::value>
|
||||
int_to_string_impl(IntType val) {
|
||||
return val == 0 ? sprout::make_string_as<Elem>(static_cast<Elem>('0'))
|
||||
: val < 0 ? sprout::detail::int_to_string_impl_1<Elem, Base>(-val, true)
|
||||
: sprout::detail::int_to_string_impl_1<Elem, Base>(val, false)
|
||||
: sprout::detail::int_to_string_impl_1<Elem, Base>(val, val < 0)
|
||||
;
|
||||
}
|
||||
|
||||
template<
|
||||
typename Elem,
|
||||
std::size_t Base,
|
||||
int Base,
|
||||
typename UIntType,
|
||||
typename... Args,
|
||||
typename sprout::enabler_if<(sizeof...(Args) == sprout::integer_digits<UIntType, Base>::value)>::type = sprout::enabler
|
||||
typename sprout::enabler_if<(sizeof...(Args) == sprout::printed_integer_digits<UIntType, Base>::value)>::type = sprout::enabler
|
||||
>
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<Elem, sprout::integer_digits<UIntType, Base>::value>
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<Elem, sprout::printed_integer_digits<UIntType, Base>::value>
|
||||
uint_to_string_impl_1(UIntType val, Args... args) {
|
||||
return sprout::make_string_as<Elem>(args...);
|
||||
}
|
||||
template<
|
||||
typename Elem,
|
||||
std::size_t Base,
|
||||
int Base,
|
||||
typename UIntType,
|
||||
typename... Args,
|
||||
typename sprout::enabler_if<(sizeof...(Args) < sprout::integer_digits<UIntType, Base>::value)>::type = sprout::enabler
|
||||
typename sprout::enabler_if<(sizeof...(Args) < sprout::printed_integer_digits<UIntType, Base>::value)>::type = sprout::enabler
|
||||
>
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<Elem, sprout::integer_digits<UIntType, Base>::value>
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<Elem, sprout::printed_integer_digits<UIntType, Base>::value>
|
||||
uint_to_string_impl_1(UIntType val, Args... args) {
|
||||
return val == 0
|
||||
? sprout::make_string_as<Elem>(args...)
|
||||
|
@ -85,8 +93,8 @@ namespace sprout {
|
|||
)
|
||||
;
|
||||
}
|
||||
template<typename Elem, std::size_t Base, typename UIntType>
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<Elem, sprout::integer_digits<UIntType, Base>::value>
|
||||
template<typename Elem, int Base, typename UIntType>
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<Elem, sprout::printed_integer_digits<UIntType, Base>::value>
|
||||
uint_to_string_impl(UIntType val) {
|
||||
return val == 0 ? sprout::make_string_as<Elem>(static_cast<Elem>('0'))
|
||||
: sprout::detail::uint_to_string_impl_1<Elem, Base>(val)
|
||||
|
@ -95,21 +103,21 @@ namespace sprout {
|
|||
|
||||
template<
|
||||
typename Elem,
|
||||
std::size_t Base,
|
||||
int Base,
|
||||
typename IntType,
|
||||
typename sprout::enabler_if<std::is_signed<IntType>::value>::type = sprout::enabler
|
||||
>
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<Elem, sprout::integer_digits<IntType, Base>::value>
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<Elem, sprout::printed_integer_digits<IntType, Base>::value>
|
||||
int_to_string(IntType val) {
|
||||
return sprout::detail::int_to_string_impl<Elem, Base>(val);
|
||||
}
|
||||
template<
|
||||
typename Elem,
|
||||
std::size_t Base,
|
||||
int Base,
|
||||
typename IntType,
|
||||
typename sprout::enabler_if<std::is_unsigned<IntType>::value>::type = sprout::enabler
|
||||
>
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<Elem, sprout::integer_digits<IntType, Base>::value>
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<Elem, sprout::printed_integer_digits<IntType, Base>::value>
|
||||
int_to_string(IntType val) {
|
||||
return sprout::detail::uint_to_string_impl<Elem, Base>(val);
|
||||
}
|
||||
|
@ -120,11 +128,11 @@ namespace sprout {
|
|||
//
|
||||
template<
|
||||
typename Elem,
|
||||
std::size_t Base,
|
||||
int Base,
|
||||
typename IntType,
|
||||
typename sprout::enabler_if<std::is_integral<IntType>::value>::type = sprout::enabler
|
||||
>
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<Elem, sprout::integer_digits<IntType, Base>::value>
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<Elem, sprout::printed_integer_digits<IntType, Base>::value>
|
||||
int_to_string(IntType val) {
|
||||
return sprout::detail::int_to_string<Elem, Base>(val);
|
||||
}
|
||||
|
@ -133,7 +141,7 @@ namespace sprout {
|
|||
// to_string_of
|
||||
//
|
||||
template<typename Elem, typename IntType, typename sprout::enabler_if<std::is_integral<IntType>::value>::type = sprout::enabler>
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<Elem, sprout::integer_digits<IntType, 10>::value>
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<Elem, sprout::printed_integer_digits<IntType, 10>::value>
|
||||
to_string_of(IntType val) {
|
||||
return sprout::int_to_string<Elem, 10>(val);
|
||||
}
|
||||
|
@ -141,32 +149,32 @@ namespace sprout {
|
|||
//
|
||||
// to_string
|
||||
//
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<char, sprout::integer_digits<int>::value>
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<char, sprout::printed_integer_digits<int>::value>
|
||||
to_string(int val) {
|
||||
return sprout::to_string_of<char>(val);
|
||||
}
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<char, sprout::integer_digits<unsigned>::value>
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<char, sprout::printed_integer_digits<unsigned>::value>
|
||||
to_string(unsigned val) {
|
||||
return sprout::to_string_of<char>(val);
|
||||
}
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<char, sprout::integer_digits<long>::value>
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<char, sprout::printed_integer_digits<long>::value>
|
||||
to_string(long val) {
|
||||
return sprout::to_string_of<char>(val);
|
||||
}
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<char, sprout::integer_digits<unsigned long>::value>
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<char, sprout::printed_integer_digits<unsigned long>::value>
|
||||
to_string(unsigned long val) {
|
||||
return sprout::to_string_of<char>(val);
|
||||
}
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<char, sprout::integer_digits<long long>::value>
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<char, sprout::printed_integer_digits<long long>::value>
|
||||
to_string(long long val) {
|
||||
return sprout::to_string_of<char>(val);
|
||||
}
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<char, sprout::integer_digits<unsigned long long>::value>
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<char, sprout::printed_integer_digits<unsigned long long>::value>
|
||||
to_string(unsigned long long val) {
|
||||
return sprout::to_string_of<char>(val);
|
||||
}
|
||||
template<typename IntType, typename sprout::enabler_if<std::is_integral<IntType>::value>::type = sprout::enabler>
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<char, sprout::integer_digits<IntType>::value>
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<char, sprout::printed_integer_digits<IntType>::value>
|
||||
to_string(IntType val) {
|
||||
return sprout::to_string_of<char>(val);
|
||||
}
|
||||
|
@ -174,32 +182,32 @@ namespace sprout {
|
|||
//
|
||||
// to_wstring
|
||||
//
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<wchar_t, sprout::integer_digits<int>::value>
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<wchar_t, sprout::printed_integer_digits<int>::value>
|
||||
to_wstring(int val) {
|
||||
return sprout::to_string_of<wchar_t>(val);
|
||||
}
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<wchar_t, sprout::integer_digits<unsigned>::value>
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<wchar_t, sprout::printed_integer_digits<unsigned>::value>
|
||||
to_wstring(unsigned val) {
|
||||
return sprout::to_string_of<wchar_t>(val);
|
||||
}
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<wchar_t, sprout::integer_digits<long>::value>
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<wchar_t, sprout::printed_integer_digits<long>::value>
|
||||
to_wstring(long val) {
|
||||
return sprout::to_string_of<wchar_t>(val);
|
||||
}
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<wchar_t, sprout::integer_digits<unsigned long>::value>
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<wchar_t, sprout::printed_integer_digits<unsigned long>::value>
|
||||
to_wstring(unsigned long val) {
|
||||
return sprout::to_string_of<wchar_t>(val);
|
||||
}
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<wchar_t, sprout::integer_digits<long long>::value>
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<wchar_t, sprout::printed_integer_digits<long long>::value>
|
||||
to_wstring(long long val) {
|
||||
return sprout::to_string_of<wchar_t>(val);
|
||||
}
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<wchar_t, sprout::integer_digits<unsigned long long>::value>
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<wchar_t, sprout::printed_integer_digits<unsigned long long>::value>
|
||||
to_wstring(unsigned long long val) {
|
||||
return sprout::to_string_of<wchar_t>(val);
|
||||
}
|
||||
template<typename IntType, typename sprout::enabler_if<std::is_integral<IntType>::value>::type = sprout::enabler>
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<wchar_t, sprout::integer_digits<IntType>::value>
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<wchar_t, sprout::printed_integer_digits<IntType>::value>
|
||||
to_wstring(IntType val) {
|
||||
return sprout::to_string_of<wchar_t>(val);
|
||||
}
|
||||
|
@ -207,32 +215,32 @@ namespace sprout {
|
|||
//
|
||||
// to_u16string
|
||||
//
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<char16_t, sprout::integer_digits<int>::value>
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<char16_t, sprout::printed_integer_digits<int>::value>
|
||||
to_u16string(int val) {
|
||||
return sprout::to_string_of<char16_t>(val);
|
||||
}
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<char16_t, sprout::integer_digits<unsigned>::value>
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<char16_t, sprout::printed_integer_digits<unsigned>::value>
|
||||
to_u16string(unsigned val) {
|
||||
return sprout::to_string_of<char16_t>(val);
|
||||
}
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<char16_t, sprout::integer_digits<long>::value>
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<char16_t, sprout::printed_integer_digits<long>::value>
|
||||
to_u16string(long val) {
|
||||
return sprout::to_string_of<char16_t>(val);
|
||||
}
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<char16_t, sprout::integer_digits<unsigned long>::value>
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<char16_t, sprout::printed_integer_digits<unsigned long>::value>
|
||||
to_u16string(unsigned long val) {
|
||||
return sprout::to_string_of<char16_t>(val);
|
||||
}
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<char16_t, sprout::integer_digits<long long>::value>
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<char16_t, sprout::printed_integer_digits<long long>::value>
|
||||
to_u16string(long long val) {
|
||||
return sprout::to_string_of<char16_t>(val);
|
||||
}
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<char16_t, sprout::integer_digits<unsigned long long>::value>
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<char16_t, sprout::printed_integer_digits<unsigned long long>::value>
|
||||
to_u16string(unsigned long long val) {
|
||||
return sprout::to_string_of<char16_t>(val);
|
||||
}
|
||||
template<typename IntType, typename sprout::enabler_if<std::is_integral<IntType>::value>::type = sprout::enabler>
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<char16_t, sprout::integer_digits<IntType>::value>
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<char16_t, sprout::printed_integer_digits<IntType>::value>
|
||||
to_u16string(IntType val) {
|
||||
return sprout::to_string_of<char16_t>(val);
|
||||
}
|
||||
|
@ -240,32 +248,32 @@ namespace sprout {
|
|||
//
|
||||
// to_u32string
|
||||
//
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<char32_t, sprout::integer_digits<int>::value>
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<char32_t, sprout::printed_integer_digits<int>::value>
|
||||
to_u32string(int val) {
|
||||
return sprout::to_string_of<char32_t>(val);
|
||||
}
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<char32_t, sprout::integer_digits<unsigned>::value>
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<char32_t, sprout::printed_integer_digits<unsigned>::value>
|
||||
to_u32string(unsigned val) {
|
||||
return sprout::to_string_of<char32_t>(val);
|
||||
}
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<char32_t, sprout::integer_digits<long>::value>
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<char32_t, sprout::printed_integer_digits<long>::value>
|
||||
to_u32string(long val) {
|
||||
return sprout::to_string_of<char32_t>(val);
|
||||
}
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<char32_t, sprout::integer_digits<unsigned long>::value>
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<char32_t, sprout::printed_integer_digits<unsigned long>::value>
|
||||
to_u32string(unsigned long val) {
|
||||
return sprout::to_string_of<char32_t>(val);
|
||||
}
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<char32_t, sprout::integer_digits<long long>::value>
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<char32_t, sprout::printed_integer_digits<long long>::value>
|
||||
to_u32string(long long val) {
|
||||
return sprout::to_string_of<char32_t>(val);
|
||||
}
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<char32_t, sprout::integer_digits<unsigned long long>::value>
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<char32_t, sprout::printed_integer_digits<unsigned long long>::value>
|
||||
to_u32string(unsigned long long val) {
|
||||
return sprout::to_string_of<char32_t>(val);
|
||||
}
|
||||
template<typename IntType, typename sprout::enabler_if<std::is_integral<IntType>::value>::type = sprout::enabler>
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<char32_t, sprout::integer_digits<IntType>::value>
|
||||
inline SPROUT_CONSTEXPR sprout::basic_string<char32_t, sprout::printed_integer_digits<IntType>::value>
|
||||
to_u32string(IntType val) {
|
||||
return sprout::to_string_of<char32_t>(val);
|
||||
}
|
||||
|
|
|
@ -122,7 +122,7 @@ namespace sprout {
|
|||
typename sprout::enabler_if<std::is_integral<IntType>::value>::type = sprout::enabler
|
||||
>
|
||||
inline SPROUT_CONSTEXPR IntType from_string(sprout::basic_string<Elem, N, Traits> const& str, std::size_t* idx) {
|
||||
return sprout::string_to_int<IntType>(str, idx);
|
||||
return sprout::string_to_int<IntType>(str, idx, 0);
|
||||
}
|
||||
template<
|
||||
typename IntType,
|
||||
|
@ -132,7 +132,7 @@ namespace sprout {
|
|||
typename sprout::enabler_if<std::is_integral<IntType>::value>::type = sprout::enabler
|
||||
>
|
||||
inline SPROUT_CONSTEXPR IntType from_string(sprout::basic_string<Elem, N, Traits> const& str) {
|
||||
return sprout::string_to_int<IntType>(str);
|
||||
return sprout::string_to_int<IntType>(str, 0);
|
||||
}
|
||||
} // namespace sprout
|
||||
|
||||
|
|
Loading…
Reference in a new issue