| 55 | } |
| 56 | |
| 57 | unsigned long stoul(const string& str, size_t* idx, int base) |
| 58 | { |
| 59 | char* end; |
| 60 | unsigned long result = ::strtoul(str.c_str(), &end, base); |
| 61 | |
| 62 | if (end != str.c_str()) |
| 63 | { |
| 64 | if (idx) |
| 65 | *idx = static_cast<size_t>(end - str.c_str()); |
| 66 | return result; |
| 67 | } |
| 68 | // TODO: no conversion -> invalid_argument |
| 69 | // TODO: ERANGE in errno -> out_of_range |
| 70 | return 0; |
| 71 | } |
| 72 | |
| 73 | long long stoll(const string& str, size_t* idx, int base) |
| 74 | { |