Go to the documentation of this file.
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);
66 return string2optional<unsigned>(str, base);
71 return string2optional<std::size_t>(str, base);
#define CHECK_RETURN(CONDITION)
std::size_t safe_string2size_t(const std::string &str, int base)
unsigned long long int unsafe_string2unsignedlonglong(const std::string &str, int base)
optionalt< 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...
signed long long int unsafe_string2signedlonglong(const std::string &str, int base)
optionalt< 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...
optionalt< int > string2optional_int(const std::string &str, int base)
Convert string to integer as per stoi, but return nullopt when stoi would throw.
nonstd::optional< T > optionalt
unsigned safe_string2unsigned(const std::string &str, int base)
unsigned unsafe_string2unsigned(const std::string &str, int base)
std::size_t unsafe_string2size_t(const std::string &str, int base)
int unsafe_string2int(const std::string &str, int base)