! @param[in] s reference token to be converted into an array index @return integer representation of @a s @throw out_of_range.404 if string @a s could not be converted to an integer */
| 10402 | @throw out_of_range.404 if string @a s could not be converted to an integer |
| 10403 | */ |
| 10404 | static int array_index(const std::string& s) |
| 10405 | { |
| 10406 | std::size_t processed_chars = 0; |
| 10407 | const int res = std::stoi(s, &processed_chars); |
| 10408 | |
| 10409 | // check if the string was completely read |
| 10410 | if (JSON_HEDLEY_UNLIKELY(processed_chars != s.size())) |
| 10411 | { |
| 10412 | JSON_THROW(detail::out_of_range::create(404, "unresolved reference token '" + s + "'")); |
| 10413 | } |
| 10414 | |
| 10415 | return res; |
| 10416 | } |
| 10417 | |
| 10418 | json_pointer top() const |
| 10419 | { |