From 780bbe5d6c9fbd612bbe5e01480178a6d4465d59 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Wed, 7 Apr 2021 16:05:17 +0200 Subject: [PATCH] Fix https://github.com/yhirose/cpp-peglib/issues/167 (#168) --- peglib.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/peglib.h b/peglib.h index a04dfad..19ba686 100644 --- a/peglib.h +++ b/peglib.h @@ -13,9 +13,6 @@ #include #if __has_include() #include -#define CPPPEGLIB_HAS_CHARCONV true -#else -#define CPPPEGLIB_HAS_CHARCONV false #endif #include #include @@ -343,8 +340,12 @@ 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 constexpr (CPPPEGLIB_HAS_CHARCONV && !std::is_floating_point::value) { +#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 } else { auto s = std::string(sv); std::istringstream ss(s);