MCPcopy Create free account
hub / github.com/Tablecruncher/tablecruncher / array_index

Method array_index

external/json/json.hpp:11665–11677  ·  view source on GitHub ↗

! @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 */

Source from the content-addressed store, hash-verified

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 /*!

Callers

nothing calls this directly

Calls 2

createFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected