77 double& value)
noexcept {
78#if defined(__cpp_lib_to_chars) && __cpp_lib_to_chars >= 201611L
79 return std::from_chars(first, last, value);
82 return {first, std::errc::invalid_argument};
90 const std::size_t n =
static_cast<std::size_t
>(last - first);
93 const char* cstr =
nullptr;
94 if (n <
sizeof(stack_buf)) {
95 std::memcpy(stack_buf, first, n);
99 heap_buf.assign(first, last);
100 cstr = heap_buf.c_str();
106 v = strtod_l(cstr, &end, loc);
108 v = std::strtod(cstr, &end);
112 return {first, std::errc::invalid_argument};
115 return {first + (end - cstr), std::errc{}};
locale_t c_locale() noexcept
Borrow a process-lifetime C numeric locale handle on fallback builds.
Definition charconv_compat.hpp:53
std::from_chars_result from_chars_double(const char *first, const char *last, double &value) noexcept
Parse a double prefix using the available numeric backend.
Definition charconv_compat.hpp:76