18 auto converted = string2optional<unsigned>(str, base);
25 auto converted = string2optional<std::size_t>(str, base);
32 return narrow_cast<int>(std::strtoll(str.c_str(),
nullptr, base));
37 return narrow_cast<unsigned>(std::strtoul(str.c_str(),
nullptr, base));
42 return narrow_cast<std::size_t>(std::strtoull(str.c_str(),
nullptr, base));
46 const std::string &str,
49 return std::strtoll(str.c_str(),
nullptr,
false);
53 const std::string &str,
56 return *string2optional<unsigned long long>(str, base);
61 return string2optional<int>(str, base);
64 std::optional<unsigned>
67 return string2optional<unsigned>(str, base);
70 std::optional<std::size_t>
73 return string2optional<std::size_t>(str, base);
#define CHECK_RETURN(CONDITION)
std::optional< unsigned > string2optional_unsigned(const std::string &str, int base)
Convert string to unsigned similar to the stoul or stoull functions, return nullopt when the conversi...
std::size_t unsafe_string2size_t(const std::string &str, int base)
std::optional< int > string2optional_int(const std::string &str, int base)
Convert string to integer as per stoi, but return nullopt when stoi would throw.
int unsafe_string2int(const std::string &str, int base)
std::optional< std::size_t > string2optional_size_t(const std::string &str, int base)
Convert string to size_t similar to the stoul or stoull functions, return nullopt when the conversion...
unsigned long long int unsafe_string2unsignedlonglong(const std::string &str, int base)
unsigned safe_string2unsigned(const std::string &str, int base)
unsigned unsafe_string2unsigned(const std::string &str, int base)
std::size_t safe_string2size_t(const std::string &str, int base)
signed long long int unsafe_string2signedlonglong(const std::string &str, int base)