Skip to content

Commit

Permalink
fixed #43 (adding friendship to allow iterator change)
Browse files Browse the repository at this point in the history
  • Loading branch information
nlohmann committed Mar 22, 2015
1 parent f2957dc commit bb2671d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2040,6 +2040,9 @@ class basic_json
/// a random access iterator for the basic_json class
class iterator : public std::iterator<std::random_access_iterator_tag, basic_json>
{
// allow basic_json class to access m_it
friend class basic_json;

public:
/// the type of the values when the iterator is dereferenced
using value_type = basic_json::value_type;
Expand Down Expand Up @@ -2529,6 +2532,9 @@ class basic_json
/// a const random access iterator for the basic_json class
class const_iterator : public std::iterator<std::random_access_iterator_tag, const basic_json>
{
// allow basic_json class to access m_it
friend class basic_json;

public:
/// the type of the values when the iterator is dereferenced
using value_type = basic_json::value_type;
Expand Down
6 changes: 6 additions & 0 deletions src/json.hpp.re2c
Original file line number Diff line number Diff line change
Expand Up @@ -2040,6 +2040,9 @@ class basic_json
/// a random access iterator for the basic_json class
class iterator : public std::iterator<std::random_access_iterator_tag, basic_json>
{
// allow basic_json class to access m_it
friend class basic_json;

public:
/// the type of the values when the iterator is dereferenced
using value_type = basic_json::value_type;
Expand Down Expand Up @@ -2529,6 +2532,9 @@ class basic_json
/// a const random access iterator for the basic_json class
class const_iterator : public std::iterator<std::random_access_iterator_tag, const basic_json>
{
// allow basic_json class to access m_it
friend class basic_json;

public:
/// the type of the values when the iterator is dereferenced
using value_type = basic_json::value_type;
Expand Down

0 comments on commit bb2671d

Please sign in to comment.