MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / as_float_helper

Function as_float_helper

system/lib/libcxx/src/string.cpp:191–205  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

189
190template <typename V, typename S, typename F>
191inline 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
207template <typename V, typename S>
208inline V as_float(const string& func, const S& s, size_t* idx = nullptr);

Callers

nothing calls this directly

Calls 5

fFunction · 0.50
swapFunction · 0.50
c_strMethod · 0.45

Tested by

no test coverage detected