Merge pull request #58 from minamiyama1994/minamiyama1994-develop

cannot compile this code ( http://melpon.org/wandbox/permlink/dMPGXatLnT...
This commit is contained in:
Bolero MURAKAMI 2014-02-26 12:25:16 +09:00
commit ae9578ce37
2 changed files with 16 additions and 0 deletions

View file

@ -241,9 +241,17 @@ namespace sprout {
inline SPROUT_CONSTEXPR FloatType
str_to_float(CStrIterator str, CharPtr* endptr) {
return !endptr ? sprout::detail::str_to_float<FloatType>(str)
#ifdef __MINGW32__
: std::is_same<typename std::remove_cv<FloatType>::type, float>::value ? strtof(&*str, endptr)
#else
: std::is_same<typename std::remove_cv<FloatType>::type, float>::value ? std::strtof(&*str, endptr)
#endif
: std::is_same<typename std::remove_cv<FloatType>::type, double>::value ? std::strtod(&*str, endptr)
#ifdef __MINGW32__
: strtold(&*str, endptr)
#else
: std::strtold(&*str, endptr)
#endif
;
}
} // namespace detail

View file

@ -109,10 +109,18 @@ namespace sprout {
return !endptr ? sprout::detail::str_to_int<IntType>(str, base)
: std::is_signed<IntType>::value
? sizeof(IntType) <= sizeof(long) ? static_cast<IntType>(std::strtol(&*str, endptr, base))
#ifdef __MINGW32__
: sizeof(IntType) <= sizeof(long long) ? static_cast<IntType>(strtoll(&*str, endptr, base))
#else
: sizeof(IntType) <= sizeof(long long) ? static_cast<IntType>(std::strtoll(&*str, endptr, base))
#endif
: static_cast<IntType>(std::strtoimax(&*str, endptr, base))
: sizeof(IntType) <= sizeof(unsigned long) ? static_cast<IntType>(std::strtoul(&*str, endptr, base))
#ifdef __MINGW32__
: sizeof(IntType) <= sizeof(unsigned long long) ? static_cast<IntType>(strtoull(&*str, endptr, base))
#else
: sizeof(IntType) <= sizeof(unsigned long long) ? static_cast<IntType>(std::strtoull(&*str, endptr, base))
#endif
: static_cast<IntType>(std::strtoumax(&*str, endptr, base))
;
#endif