nlohmann::detail::invalid_iterator
nlohmann::detail::exception
json.hpp
typename BasicJsonType
invalid_iterator static invalid_iterator nlohmann::detail::invalid_iterator::create (int id_, const std::string &what_arg, const BasicJsonType &context) create int id_ const std::string & what_arg const BasicJsonType & context nlohmann::detail::exception::diagnostics JSON_HEDLEY_NON_NULL nlohmann::detail::exception::name nlohmann::detail::string nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType >::basic_json nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType >::erase nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType >::insert nlohmann::detail::iter_impl< BasicJsonType >::key nlohmann::detail::iter_impl< BasicJsonType >::operator* nlohmann::detail::iter_impl< BasicJsonType >::operator+= nlohmann::detail::iter_impl< BasicJsonType >::operator- nlohmann::detail::iter_impl< BasicJsonType >::operator-> nlohmann::detail::iter_impl< BasicJsonType >::operator< nlohmann::detail::iter_impl< BasicJsonType >::operator== nlohmann::detail::iter_impl< BasicJsonType >::operator[] nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType >::update
nlohmann::detail::invalid_iterator::invalid_iterator
(int id_, const char *what_arg)
invalid_iterator
int id_
const char * what_arg

exception indicating errors with iterators

This exception is thrown if iterators passed to a library function do not match the expected semantics.

Exceptions have ids 2xx.

name / id | example message | description
json.exception.invalid_iterator.201 | iterators are not compatible | The iterators passed to constructor basic_json(InputIT first, InputIT last) are not compatible, meaning they do not belong to the same container. Therefore, the range (first, last) is invalid.
json.exception.invalid_iterator.202 | iterator does not fit current value | In an erase or insert function, the passed iterator pos does not belong to the JSON value for which the function was called. It hence does not define a valid position for the deletion/insertion.
json.exception.invalid_iterator.203 | iterators do not fit current value | Either iterator passed to function erase(IteratorType first, IteratorType last) does not belong to the JSON value from which values shall be erased. It hence does not define a valid range to delete values from.
json.exception.invalid_iterator.204 | iterators out of range | When an iterator range for a primitive type (number, boolean, or string) is passed to a constructor or an erase function, this range has to be exactly (begin(), end()), because this is the only way the single stored value is expressed. All other ranges are invalid.
json.exception.invalid_iterator.205 | iterator out of range | When an iterator for a primitive type (number, boolean, or string) is passed to an erase function, the iterator has to be the begin() iterator, because it is the only way to address the stored value. All other iterators are invalid.
json.exception.invalid_iterator.206 | cannot construct with iterators from null | The iterators passed to constructor basic_json(InputIT first, InputIT last) belong to a JSON null value and hence to not define a valid range.
json.exception.invalid_iterator.207 | cannot use key() for non-object iterators | The key() member function can only be used on iterators belonging to a JSON object, because other types do not have a concept of a key.
json.exception.invalid_iterator.208 | cannot use operator[] for object iterators | The operator[] to specify a concrete offset cannot be used on iterators belonging to a JSON object, because JSON objects are unordered.
json.exception.invalid_iterator.209 | cannot use offsets with object iterators | The offset operators (+, -, +=, -=) cannot be used on iterators belonging to a JSON object, because JSON objects are unordered.
json.exception.invalid_iterator.210 | iterators do not fit | The iterator range passed to the insert function are not compatible, meaning they do not belong to the same container. Therefore, the range (first, last) is invalid.
json.exception.invalid_iterator.211 | passed iterators may not belong to container | The iterator range passed to the insert function must not be a subrange of the container to insert to.
json.exception.invalid_iterator.212 | cannot compare iterators of different containers | When two iterators are compared, they must belong to the same container.
json.exception.invalid_iterator.213 | cannot compare order of object iterators | The order of object iterators cannot be compared, because JSON objects are unordered.
json.exception.invalid_iterator.214 | cannot get value | Cannot get value for iterator: Either the iterator belongs to a null value or it is an iterator to a primitive type (number, boolean, or string), but the iterator is different to begin().

{The following code shows how an `invalid_iterator` exception can be caught.,invalid_iterator}

- exception for the base class of the library exceptions

- parse_error for exceptions indicating a parse error

- type_error for exceptions indicating executing a member function with a wrong type

- out_of_range for exceptions indicating access out of the defined range

- other_error for exceptions indicating other library errors

version 3.0.0

nlohmann::detail::invalid_iterator
std::exception
nlohmann::detail::exception
nlohmann::detail::invalid_iterator
std::runtime_error
int
std::exception
nlohmann::detail::exception
-m
+id
- nlohmann::detail::invalid_iterator
  create
- nlohmann::detail::invalid_iterator
  diagnostics
- nlohmann::detail::invalid_iterator
  exception
- nlohmann::detail::invalid_iterator
  id
- nlohmann::detail::invalid_iterator
  invalid_iterator
- nlohmann::detail::invalid_iterator
  name
- nlohmann::detail::invalid_iterator
  what