A Discrete-Event Network Simulator
API
nlohmann::detail::invalid_iterator Class Reference

exception indicating errors with iterators More...

#include "json.h"

+ Inheritance diagram for nlohmann::detail::invalid_iterator:
+ Collaboration diagram for nlohmann::detail::invalid_iterator:

Static Public Member Functions

static invalid_iterator create (int id_, const std::string &what_arg)
 
static invalid_iterator create (int id_, const std::string &what_arg)
 

Private Member Functions

 invalid_iterator (int id_, const char *what_arg)
 
 invalid_iterator (int id_, const char *what_arg)
 

Additional Inherited Members

- Public Member Functions inherited from nlohmann::detail::exception
JSON_HEDLEY_RETURNS_NON_NULL const char * what () const noexcept override
 returns the explanatory string More...
 
JSON_HEDLEY_RETURNS_NON_NULL const char * what () const noexcept override
 returns the explanatory string More...
 
- Public Attributes inherited from nlohmann::detail::exception
const int id
 the id of the exception More...
 
- Protected Member Functions inherited from nlohmann::detail::exception
 exception (int id_, const char *what_arg)
 
 exception (int id_, const char *what_arg)
 
- Static Protected Member Functions inherited from nlohmann::detail::exception
static std::string name (const std::string &ename, int id_)
 
static std::string name (const std::string &ename, int id_)
 

Detailed Description

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().

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

See also
- 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
Since
version 3.0.0

Definition at line 2577 of file json.h.

Constructor & Destructor Documentation

◆ invalid_iterator() [1/2]

nlohmann::detail::invalid_iterator::invalid_iterator ( int  id_,
const char *  what_arg 
)
inlineprivate

Definition at line 2588 of file json.h.

Referenced by create().

+ Here is the caller graph for this function:

◆ invalid_iterator() [2/2]

nlohmann::detail::invalid_iterator::invalid_iterator ( int  id_,
const char *  what_arg 
)
inlineprivate

Definition at line 2588 of file json.h.

Member Function Documentation

◆ create() [1/2]

static invalid_iterator nlohmann::detail::invalid_iterator::create ( int  id_,
const std::string &  what_arg 
)
inlinestatic

◆ create() [2/2]

static invalid_iterator nlohmann::detail::invalid_iterator::create ( int  id_,
const std::string &  what_arg 
)
inlinestatic

Definition at line 2580 of file json.h.

References invalid_iterator(), and nlohmann::detail::exception::name().

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: