fix str_to_float SFINAE

This commit is contained in:
bolero-MURAKAMI 2012-04-16 12:00:20 +09:00
parent 907bced466
commit 686d1bf67a
2 changed files with 5 additions and 3 deletions

View file

@ -5,6 +5,7 @@
#include <cstdlib> #include <cstdlib>
#include <cmath> #include <cmath>
#include <limits> #include <limits>
#include <type_traits>
#include <sprout/config.hpp> #include <sprout/config.hpp>
#include <sprout/iterator/operation.hpp> #include <sprout/iterator/operation.hpp>
#include <sprout/ctype/ascii.hpp> #include <sprout/ctype/ascii.hpp>
@ -238,15 +239,15 @@ namespace sprout {
// //
// str_to_float // str_to_float
// //
template<typename FloatType, typename Char> template<typename FloatType, typename Char, typename sprout::enabler_if<std::is_floating_point<FloatType>::value>::type = sprout::enabler>
inline SPROUT_CONSTEXPR FloatType str_to_float(Char const* str, Char** endptr) { inline SPROUT_CONSTEXPR FloatType str_to_float(Char const* str, Char** endptr) {
return sprout::detail::str_to_float<FloatType>(str, endptr); return sprout::detail::str_to_float<FloatType>(str, endptr);
} }
template<typename FloatType, typename Char> template<typename FloatType, typename Char, typename sprout::enabler_if<std::is_floating_point<FloatType>::value>::type = sprout::enabler>
inline SPROUT_CONSTEXPR FloatType str_to_float(Char const* str, std::nullptr_t endptr) { inline SPROUT_CONSTEXPR FloatType str_to_float(Char const* str, std::nullptr_t endptr) {
return sprout::detail::str_to_float<FloatType>(str); return sprout::detail::str_to_float<FloatType>(str);
} }
template<typename FloatType, typename Char> template<typename FloatType, typename Char, typename sprout::enabler_if<std::is_floating_point<FloatType>::value>::type = sprout::enabler>
inline SPROUT_CONSTEXPR FloatType str_to_float(Char const* str) { inline SPROUT_CONSTEXPR FloatType str_to_float(Char const* str) {
return sprout::detail::str_to_float<FloatType>(str); return sprout::detail::str_to_float<FloatType>(str);
} }

View file

@ -4,6 +4,7 @@
#include <cstddef> #include <cstddef>
#include <cstdlib> #include <cstdlib>
#include <limits> #include <limits>
#include <type_traits>
#include <sprout/config.hpp> #include <sprout/config.hpp>
#include <sprout/iterator/operation.hpp> #include <sprout/iterator/operation.hpp>
#include <sprout/ctype/ascii.hpp> #include <sprout/ctype/ascii.hpp>