! @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 */
| 11663 | @throw out_of_range.404 if string @a s could not be converted to an integer |
| 11664 | */ |
| 11665 | static int array_index(const std::string& s) |
| 11666 | { |
| 11667 | std::size_t processed_chars = 0; |
| 11668 | const int res = std::stoi(s, &processed_chars); |
| 11669 | |
| 11670 | // check if the string was completely read |
| 11671 | if (JSON_UNLIKELY(processed_chars != s.size())) |
| 11672 | { |
| 11673 | JSON_THROW(detail::out_of_range::create(404, "unresolved reference token '" + s + "'")); |
| 11674 | } |
| 11675 | |
| 11676 | return res; |
| 11677 | } |
| 11678 | |
| 11679 | private: |
| 11680 | /*! |