diff --git a/src/common/string_util.h b/src/common/string_util.h index 6380d775b..7c2af92ec 100644 --- a/src/common/string_util.h +++ b/src/common/string_util.h @@ -5,7 +5,7 @@ #include #include -#if __cplusplus >= 201703L +#if defined(__has_include) && __has_include() #include #else #include @@ -39,8 +39,7 @@ std::optional FromChars(const std::string_view str) { T value; -#if __cplusplus >= 201703L - T value; +#if defined(__has_include) && __has_include() const std::from_chars_result result = std::from_chars(str.data(), str.data() + str.length(), value); if (result.ec != std::errc()) return std::nullopt;