long long stoll (const string& str, size_t* idx = 0, int base = 10);long long stoll (const wstring& str, size_t* idx = 0, int base = 10);
123456789101112131415161718
// stoll example #include <iostream> // std::cout #include <string> // std::string, std::stoll int main () { std::string str = "8246821 0xffff 020"; std::string::size_type sz = 0; // alias of size_t while (!str.empty()) { long long ll = std::stoll (str,&sz,0); std::cout << str.substr(0,sz) << " interpreted as " << ll << '\n'; str = str.substr(sz); } return 0; }
8246821 interpreted as 8246821 0xffff interpreted as 65535 020 interpreted as 16