mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-23 06:15:38 +00:00
StringUtil: Fix for older gcc versions again
This commit is contained in:
parent
fcc0ae9571
commit
19c1e8b838
|
@ -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;
|
||||||
|
|
Loading…
Reference in a new issue