From a8e92a6bfb4dced8ea7b50bf4cbb37c991fbfc67 Mon Sep 17 00:00:00 2001 From: Niels Date: Wed, 6 May 2015 20:18:16 +0200 Subject: [PATCH] fixed #68 --- src/json.hpp | 31 ++++++++++++++----------------- src/json.hpp.re2c | 31 ++++++++++++++----------------- 2 files changed, 28 insertions(+), 34 deletions(-) diff --git a/src/json.hpp b/src/json.hpp index e2877352..fc0562e8 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -2333,13 +2333,12 @@ class basic_json /////////////// /// an iterator value - template union internal_iterator { /// iterator for JSON objects - object_iterator_t object_iterator; + typename object_t::iterator object_iterator; /// iterator for JSON arrays - array_iterator_t array_iterator; + typename array_t::iterator array_iterator; /// generic iteraotr for all other value types difference_type generic_iterator; @@ -2401,9 +2400,8 @@ class basic_json inline iterator& operator=(iterator other) noexcept ( std::is_nothrow_move_constructible::value and std::is_nothrow_move_assignable::value and - std::is_nothrow_move_constructible>::value - and - std::is_nothrow_move_assignable>::value + std::is_nothrow_move_constructible::value and + std::is_nothrow_move_assignable::value ) { std::swap(m_object, other.m_object); @@ -2862,7 +2860,7 @@ class basic_json /// associated JSON instance pointer m_object = nullptr; /// the actual iterator of the associated instance - internal_iterator m_it; + internal_iterator m_it; }; /// a const random access iterator for the basic_json class @@ -2893,12 +2891,12 @@ class basic_json { case (basic_json::value_t::object): { - m_it.object_iterator = typename object_t::const_iterator(); + m_it.object_iterator = typename object_t::iterator(); break; } case (basic_json::value_t::array): { - m_it.array_iterator = typename array_t::const_iterator(); + m_it.array_iterator = typename array_t::iterator(); break; } default: @@ -2943,9 +2941,8 @@ class basic_json inline const_iterator& operator=(const_iterator other) noexcept( std::is_nothrow_move_constructible::value and std::is_nothrow_move_assignable::value and - std::is_nothrow_move_constructible>::value - and - std::is_nothrow_move_assignable>::value + std::is_nothrow_move_constructible::value and + std::is_nothrow_move_assignable::value ) { std::swap(m_object, other.m_object); @@ -2961,13 +2958,13 @@ class basic_json { case (basic_json::value_t::object): { - m_it.object_iterator = m_object->m_value.object->cbegin(); + m_it.object_iterator = m_object->m_value.object->begin(); break; } case (basic_json::value_t::array): { - m_it.array_iterator = m_object->m_value.array->cbegin(); + m_it.array_iterator = m_object->m_value.array->begin(); break; } @@ -2993,13 +2990,13 @@ class basic_json { case (basic_json::value_t::object): { - m_it.object_iterator = m_object->m_value.object->cend(); + m_it.object_iterator = m_object->m_value.object->end(); break; } case (basic_json::value_t::array): { - m_it.array_iterator = m_object->m_value.array->cend(); + m_it.array_iterator = m_object->m_value.array->end(); break; } @@ -3398,7 +3395,7 @@ class basic_json /// associated JSON instance pointer m_object = nullptr; /// the actual iterator of the associated instance - internal_iterator m_it; + internal_iterator m_it; }; /// a reverse random access iterator for the basic_json class diff --git a/src/json.hpp.re2c b/src/json.hpp.re2c index 282dbdf0..1ed2af2f 100644 --- a/src/json.hpp.re2c +++ b/src/json.hpp.re2c @@ -2333,13 +2333,12 @@ class basic_json /////////////// /// an iterator value - template union internal_iterator { /// iterator for JSON objects - object_iterator_t object_iterator; + typename object_t::iterator object_iterator; /// iterator for JSON arrays - array_iterator_t array_iterator; + typename array_t::iterator array_iterator; /// generic iteraotr for all other value types difference_type generic_iterator; @@ -2401,9 +2400,8 @@ class basic_json inline iterator& operator=(iterator other) noexcept ( std::is_nothrow_move_constructible::value and std::is_nothrow_move_assignable::value and - std::is_nothrow_move_constructible>::value - and - std::is_nothrow_move_assignable>::value + std::is_nothrow_move_constructible::value and + std::is_nothrow_move_assignable::value ) { std::swap(m_object, other.m_object); @@ -2862,7 +2860,7 @@ class basic_json /// associated JSON instance pointer m_object = nullptr; /// the actual iterator of the associated instance - internal_iterator m_it; + internal_iterator m_it; }; /// a const random access iterator for the basic_json class @@ -2893,12 +2891,12 @@ class basic_json { case (basic_json::value_t::object): { - m_it.object_iterator = typename object_t::const_iterator(); + m_it.object_iterator = typename object_t::iterator(); break; } case (basic_json::value_t::array): { - m_it.array_iterator = typename array_t::const_iterator(); + m_it.array_iterator = typename array_t::iterator(); break; } default: @@ -2943,9 +2941,8 @@ class basic_json inline const_iterator& operator=(const_iterator other) noexcept( std::is_nothrow_move_constructible::value and std::is_nothrow_move_assignable::value and - std::is_nothrow_move_constructible>::value - and - std::is_nothrow_move_assignable>::value + std::is_nothrow_move_constructible::value and + std::is_nothrow_move_assignable::value ) { std::swap(m_object, other.m_object); @@ -2961,13 +2958,13 @@ class basic_json { case (basic_json::value_t::object): { - m_it.object_iterator = m_object->m_value.object->cbegin(); + m_it.object_iterator = m_object->m_value.object->begin(); break; } case (basic_json::value_t::array): { - m_it.array_iterator = m_object->m_value.array->cbegin(); + m_it.array_iterator = m_object->m_value.array->begin(); break; } @@ -2993,13 +2990,13 @@ class basic_json { case (basic_json::value_t::object): { - m_it.object_iterator = m_object->m_value.object->cend(); + m_it.object_iterator = m_object->m_value.object->end(); break; } case (basic_json::value_t::array): { - m_it.array_iterator = m_object->m_value.array->cend(); + m_it.array_iterator = m_object->m_value.array->end(); break; } @@ -3398,7 +3395,7 @@ class basic_json /// associated JSON instance pointer m_object = nullptr; /// the actual iterator of the associated instance - internal_iterator m_it; + internal_iterator m_it; }; /// a reverse random access iterator for the basic_json class