MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / stoi

Function stoi

support/StringSupport.h:55–78  ·  view source on GitHub ↗

Convert string values to integer. * * @note This function implements the same behaviour as std::stoi. The latter * is missing in some Android toolchains. * * @param[in] str String to be converted to int. * @param[in] pos If idx is not a null pointer, the function sets the value of pos to the position of the first character in str after the number. * @param[in] base Numeric base used

Source from the content-addressed store, hash-verified

53 * @return Integer representation of @p str.
54 */
55inline int stoi(const std::string &str, std::size_t *pos = 0, NumericBase base = NumericBase::BASE_10)
56{
57 assert(base == NumericBase::BASE_10 || base == NumericBase::BASE_16);
58 unsigned int x;
59 std::stringstream ss;
60 if (base == NumericBase::BASE_16)
61 {
62 ss << std::hex;
63 }
64 ss << str;
65 ss >> x;
66
67 if (pos)
68 {
69 std::string s;
70 std::stringstream ss_p;
71
72 ss_p << x;
73 ss_p >> s;
74 *pos = s.length();
75 }
76
77 return x;
78}
79
80/** Convert string values to unsigned long.
81 *

Callers 7

parse_validation_rangeFunction · 0.85
from_stringMethod · 0.85
get_ddk_versionMethod · 0.85
midr_from_proc_cpuinfoFunction · 0.85
get_max_cpusFunction · 0.85
parse_id_filterMethod · 0.85
darknet53_blockMethod · 0.85

Calls

no outgoing calls

Tested by 1

parse_id_filterMethod · 0.68