From bb2671df11a33006869212a436766736eb4c4204 Mon Sep 17 00:00:00 2001 From: Niels Date: Sun, 22 Mar 2015 19:18:21 +0100 Subject: [PATCH] fixed #43 (adding friendship to allow iterator change) --- src/json.hpp | 6 ++++++ src/json.hpp.re2c | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/src/json.hpp b/src/json.hpp index 09880b9e1..5356966b6 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -2040,6 +2040,9 @@ class basic_json /// a random access iterator for the basic_json class class iterator : public std::iterator { + // 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; @@ -2529,6 +2532,9 @@ class basic_json /// a const random access iterator for the basic_json class class const_iterator : public std::iterator { + // 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; diff --git a/src/json.hpp.re2c b/src/json.hpp.re2c index 36bb0e002..b78afcd52 100644 --- a/src/json.hpp.re2c +++ b/src/json.hpp.re2c @@ -2040,6 +2040,9 @@ class basic_json /// a random access iterator for the basic_json class class iterator : public std::iterator { + // 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; @@ -2529,6 +2532,9 @@ class basic_json /// a const random access iterator for the basic_json class class const_iterator : public std::iterator { + // 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;