MCPcopy Create free account
hub / github.com/boostorg/leaf / convert

Function convert

example/print_half.cpp:23–35  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21};
22
23leaf::result<int> convert(const std::string& str) noexcept
24{
25 if (str.empty())
26 return leaf::new_error(ConversionErrc::EmptyString);
27
28 if (!std::all_of(str.begin(), str.end(), ::isdigit))
29 return leaf::new_error(ConversionErrc::IllegalChar);
30
31 if (str.length() > 9)
32 return leaf::new_error(ConversionErrc::TooLong);
33
34 return atoi(str.c_str());
35}
36
37// Do not static_store BigInt to actually work -- it's a stub.
38struct BigInt

Callers 1

print_halfFunction · 0.85

Calls 1

new_errorFunction · 0.85

Tested by

no test coverage detected