From 0009f778e66981afa80acac12720967de7798240 Mon Sep 17 00:00:00 2001 From: minamiyama1994 Date: Sun, 23 Feb 2014 19:37:56 +0900 Subject: [PATCH] cannot compile this code ( http://melpon.org/wandbox/permlink/dMPGXatLnTh3o3Fk ) by my environment --- sprout/cstdlib/str_to_float.hpp | 8 ++++++++ sprout/cstdlib/str_to_int.hpp | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/sprout/cstdlib/str_to_float.hpp b/sprout/cstdlib/str_to_float.hpp index 5350decc..d1ed165a 100644 --- a/sprout/cstdlib/str_to_float.hpp +++ b/sprout/cstdlib/str_to_float.hpp @@ -241,9 +241,17 @@ namespace sprout { inline SPROUT_CONSTEXPR FloatType str_to_float(CStrIterator str, CharPtr* endptr) { return !endptr ? sprout::detail::str_to_float(str) +#ifdef __MINGW32__ + : std::is_same::type, float>::value ? strtof(&*str, endptr) +#else : std::is_same::type, float>::value ? std::strtof(&*str, endptr) +#endif : std::is_same::type, double>::value ? std::strtod(&*str, endptr) +#ifdef __MINGW32__ + : strtold(&*str, endptr) +#else : std::strtold(&*str, endptr) +#endif ; } } // namespace detail diff --git a/sprout/cstdlib/str_to_int.hpp b/sprout/cstdlib/str_to_int.hpp index b40a7331..4c2893f8 100644 --- a/sprout/cstdlib/str_to_int.hpp +++ b/sprout/cstdlib/str_to_int.hpp @@ -109,10 +109,18 @@ namespace sprout { return !endptr ? sprout::detail::str_to_int(str, base) : std::is_signed::value ? sizeof(IntType) <= sizeof(long) ? static_cast(std::strtol(&*str, endptr, base)) +#ifdef __MINGW32__ + : sizeof(IntType) <= sizeof(long long) ? static_cast(strtoll(&*str, endptr, base)) +#else : sizeof(IntType) <= sizeof(long long) ? static_cast(std::strtoll(&*str, endptr, base)) +#endif : static_cast(std::strtoimax(&*str, endptr, base)) : sizeof(IntType) <= sizeof(unsigned long) ? static_cast(std::strtoul(&*str, endptr, base)) +#ifdef __MINGW32__ + : sizeof(IntType) <= sizeof(unsigned long long) ? static_cast(strtoull(&*str, endptr, base)) +#else : sizeof(IntType) <= sizeof(unsigned long long) ? static_cast(std::strtoull(&*str, endptr, base)) +#endif : static_cast(std::strtoumax(&*str, endptr, base)) ; #endif