From 73242b26c413c153203306e6d7384a6c9ac842fa Mon Sep 17 00:00:00 2001 From: yhirose Date: Wed, 7 Apr 2021 08:54:42 -0400 Subject: [PATCH] Revert "Fix #167" This reverts commit ef10e7c5dde4a4b3245392bc3afc06b434064f2a. --- peglib.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/peglib.h b/peglib.h index 6aee99f..a04dfad 100644 --- a/peglib.h +++ b/peglib.h @@ -13,6 +13,9 @@ #include #if __has_include() #include +#define CPPPEGLIB_HAS_CHARCONV true +#else +#define CPPPEGLIB_HAS_CHARCONV false #endif #include #include @@ -340,12 +343,7 @@ inline std::string resolve_escape_sequence(const char *s, size_t n) { template T token_to_number_(std::string_view sv) { T n = 0; -#if __has_include() - if constexpr (!std::is_floating_point::value) { - std::from_chars(sv.data(), sv.data() + sv.size(), n); -#else - if constexpr (false) { -#endif + if constexpr (CPPPEGLIB_HAS_CHARCONV && !std::is_floating_point::value) { std::from_chars(sv.data(), sv.data() + sv.size(), n); } else { auto s = std::string(sv);