Use workaround for unavailable `std::from_chars()` also under older libstdc++ versions
This commit is contained in:
parent
21f32d318b
commit
dd0ea1d348
|
@ -20,8 +20,8 @@ namespace CppUtilities {
|
||||||
inline std::from_chars_result from_chars(
|
inline std::from_chars_result from_chars(
|
||||||
const char *first, const char *last, double &value, std::chars_format fmt = std::chars_format::general) noexcept
|
const char *first, const char *last, double &value, std::chars_format fmt = std::chars_format::general) noexcept
|
||||||
{
|
{
|
||||||
#if _LIBCPP_VERSION
|
#if defined(_LIBCPP_VERSION) || (defined(__GLIBCXX__) && _GLIBCXX_RELEASE < 11)
|
||||||
// workaround std::from_chars() not being implemented for floating point numbers in libc++
|
// workaround std::from_chars() not being implemented for floating point numbers in libc++ and older libstdc++ versions
|
||||||
CPP_UTILITIES_UNUSED(fmt)
|
CPP_UTILITIES_UNUSED(fmt)
|
||||||
auto r = std::from_chars_result{ nullptr, std::errc() };
|
auto r = std::from_chars_result{ nullptr, std::errc() };
|
||||||
auto s = std::string(first, last);
|
auto s = std::string(first, last);
|
||||||
|
|
Loading…
Reference in New Issue