MCPcopy Create free account
hub / github.com/ChaiScript/ChaiScript / parse_num

Function parse_num

include/chaiscript/chaiscript_defines.hpp:155–166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

153
154 template<typename T>
155 auto parse_num(const char *t_str) -> typename std::enable_if<std::is_integral<T>::value, T>::type
156 {
157 T t = 0;
158 for (char c = *t_str; (c = *t_str) != 0; ++t_str) {
159 if (c < '0' || c > '9') {
160 return t;
161 }
162 t *= 10;
163 t += c - '0';
164 }
165 return t;
166 }
167
168
169 template<typename T>

Callers

nothing calls this directly

Calls 2

TClass · 0.85
c_strMethod · 0.45

Tested by

no test coverage detected