StringUtil: Fix for older gcc versions again

This commit is contained in:
Connor McLaughlin 2020-02-28 17:12:49 +10:00
parent fcc0ae9571
commit 19c1e8b838

View file

@ -5,7 +5,7 @@
#include <optional> #include <optional>
#include <string> #include <string>
#if __cplusplus >= 201703L #if defined(__has_include) && __has_include(<charconv>)
#include <charconv> #include <charconv>
#else #else
#include <sstream> #include <sstream>
@ -39,8 +39,7 @@ std::optional<T> FromChars(const std::string_view str)
{ {
T value; T value;
#if __cplusplus >= 201703L #if defined(__has_include) && __has_include(<charconv>)
T value;
const std::from_chars_result result = std::from_chars(str.data(), str.data() + str.length(), value); const std::from_chars_result result = std::from_chars(str.data(), str.data() + str.length(), value);
if (result.ec != std::errc()) if (result.ec != std::errc())
return std::nullopt; return std::nullopt;