JSON for Modern C++  2.0.3
Public Types | Public Member Functions | Friends | List of all members
nlohmann::basic_json::const_iterator Class Reference

a const random access iterator for the basic_json class More...

#include <json.hpp>

Public Types

using difference_type = typename basic_json::difference_type
 a type to represent differences between iterators More...
 
using iterator_category = std::bidirectional_iterator_tag
 the category of the iterator More...
 
using pointer = typename basic_json::const_pointer
 defines a pointer to the type iterated over (value_type) More...
 
using reference = typename basic_json::const_reference
 defines a reference to the type iterated over (value_type) More...
 
using value_type = typename basic_json::value_type
 the type of the values when the iterator is dereferenced More...
 

Public Member Functions

 const_iterator ()=default
 default constructor More...
 
 const_iterator (pointer object) noexcept
 constructor for a given JSON instance More...
 
 const_iterator (const iterator &other) noexcept
 copy constructor given a non-const iterator More...
 
 const_iterator (const const_iterator &other) noexcept
 copy constructor More...
 
object_t::key_type key () const
 return the key of an object iterator More...
 
bool operator!= (const const_iterator &other) const
 comparison: not equal More...
 
reference operator* () const
 return a reference to the value pointed to by the iterator More...
 
const_iterator operator+ (difference_type i)
 add to iterator More...
 
const_iterator operator++ (int)
 post-increment (it++) More...
 
const_iteratoroperator++ ()
 pre-increment (++it) More...
 
const_iteratoroperator+= (difference_type i)
 add to iterator More...
 
const_iterator operator- (difference_type i)
 subtract from iterator More...
 
difference_type operator- (const const_iterator &other) const
 return difference More...
 
const_iterator operator-- (int)
 post-decrement (it–) More...
 
const_iteratoroperator-- ()
 pre-decrement (–it) More...
 
const_iteratoroperator-= (difference_type i)
 subtract from iterator More...
 
pointer operator-> () const
 dereference the iterator More...
 
bool operator< (const const_iterator &other) const
 comparison: smaller More...
 
bool operator<= (const const_iterator &other) const
 comparison: less than or equal More...
 
const_iteratoroperator= (const_iterator other) noexcept(std::is_nothrow_move_constructible< pointer >::value andstd::is_nothrow_move_assignable< pointer >::value andstd::is_nothrow_move_constructible< internal_iterator >::value andstd::is_nothrow_move_assignable< internal_iterator >::value)
 copy assignment More...
 
bool operator== (const const_iterator &other) const
 comparison: equal More...
 
bool operator> (const const_iterator &other) const
 comparison: greater than More...
 
bool operator>= (const const_iterator &other) const
 comparison: greater than or equal More...
 
reference operator[] (difference_type n) const
 access to successor More...
 
reference value () const
 return the value of an iterator More...
 

Friends

class basic_json
 allow basic_json to access private members More...
 

Detailed Description

template<template< typename U, typename V, typename...Args > class ObjectType = std::map, template< typename U, typename...Args > class ArrayType = std::vector, class StringType = std::string, class BooleanType = bool, class NumberIntegerType = std::int64_t, class NumberUnsignedType = std::uint64_t, class NumberFloatType = double, template< typename U > class AllocatorType = std::allocator>
class nlohmann::basic_json::const_iterator

This class implements a const iterator for the basic_json class. From this class, the iterator class is derived.

Note
An iterator is called initialized when a pointer to a JSON value has been set (e.g., by a constructor or a copy assignment). If the iterator is default-constructed, it is uninitialized and most methods are undefined. The library uses assertions to detect calls on uninitialized iterators.
Requirements
The class satisfies the following concept requirements:
  • RandomAccessIterator: The iterator that can be moved to point (forward and backward) to any element in constant time.
Since
version 1.0.0

Definition at line 6711 of file json.hpp.