other replacements for string

This commit is contained in:
Erik Frojdh
2020-03-19 12:39:42 +01:00
parent dee0aea378
commit 9a6f521f6a
4 changed files with 28 additions and 7 deletions

View File

@@ -628,6 +628,12 @@ inline int StringTo(const std::string &s) {
return std::stoi(s, nullptr, base);
}
template <>
inline int64_t StringTo(const std::string &s) {
int base = s.find("0x") != std::string::npos ? 16 : 10;
return std::stol(s, nullptr, base);
}
/** For types with a .str() method use this for conversion */
template <typename T>
typename std::enable_if<has_str<T>::value, std::string>::type