| 189 | |
| 190 | template <typename V, typename S, typename F> |
| 191 | inline V as_float_helper(const string& func, const S& str, size_t* idx, F f) { |
| 192 | typename S::value_type* ptr = nullptr; |
| 193 | const typename S::value_type* const p = str.c_str(); |
| 194 | __libcpp_remove_reference_t<decltype(errno)> errno_save = errno; |
| 195 | errno = 0; |
| 196 | V r = f(p, &ptr); |
| 197 | swap(errno, errno_save); |
| 198 | if (errno_save == ERANGE) |
| 199 | throw_from_string_out_of_range(func); |
| 200 | if (ptr == p) |
| 201 | throw_from_string_invalid_arg(func); |
| 202 | if (idx) |
| 203 | *idx = static_cast<size_t>(ptr - p); |
| 204 | return r; |
| 205 | } |
| 206 | |
| 207 | template <typename V, typename S> |
| 208 | inline V as_float(const string& func, const S& s, size_t* idx = nullptr); |
nothing calls this directly
no test coverage detected