12879 {
12880 using size_type = typename BasicJsonType::size_type;
12881
12882
12883 if (JSON_HEDLEY_UNLIKELY(s.size() > 1 && s[0] == '0'))
12884 {
12886 }
12887
12888
12889 if (JSON_HEDLEY_UNLIKELY(s.size() > 1 && !(s[0] >= '1' && s[0] <= '9')))
12890 {
12892 }
12893
12894 std::size_t processed_chars = 0;
12895 unsigned long long res = 0;
12896 JSON_TRY
12897 {
12898 res = std::stoull(s, &processed_chars);
12899 }
12900 JSON_CATCH(std::out_of_range &)
12901 {
12902 JSON_THROW(detail::out_of_range::create(404, "unresolved reference token '" + s + "'", BasicJsonType()));
12903 }
12904
12905
12906 if (JSON_HEDLEY_UNLIKELY(processed_chars != s.size()))
12907 {
12908 JSON_THROW(detail::out_of_range::create(404, "unresolved reference token '" + s + "'", BasicJsonType()));
12909 }
12910
12911
12912
12913 if (res >= static_cast<unsigned long long>((std::numeric_limits<size_type>::max)()))
12914 {
12915 JSON_THROW(detail::out_of_range::create(410, "array index " + s + " exceeds size_type", BasicJsonType()));
12916 }
12917
12918 return static_cast<size_type>(res);
12919 }
static parse_error create(int id_, const position_t &pos, const std::string &what_arg, const BasicJsonType &context)
create a parse error exception