fixed #68
This commit is contained in:
parent
17609f244d
commit
a8e92a6bfb
2 changed files with 28 additions and 34 deletions
31
src/json.hpp
31
src/json.hpp
|
@ -2333,13 +2333,12 @@ class basic_json
|
||||||
///////////////
|
///////////////
|
||||||
|
|
||||||
/// an iterator value
|
/// an iterator value
|
||||||
template<typename array_iterator_t, typename object_iterator_t>
|
|
||||||
union internal_iterator
|
union internal_iterator
|
||||||
{
|
{
|
||||||
/// iterator for JSON objects
|
/// iterator for JSON objects
|
||||||
object_iterator_t object_iterator;
|
typename object_t::iterator object_iterator;
|
||||||
/// iterator for JSON arrays
|
/// iterator for JSON arrays
|
||||||
array_iterator_t array_iterator;
|
typename array_t::iterator array_iterator;
|
||||||
/// generic iteraotr for all other value types
|
/// generic iteraotr for all other value types
|
||||||
difference_type generic_iterator;
|
difference_type generic_iterator;
|
||||||
|
|
||||||
|
@ -2401,9 +2400,8 @@ class basic_json
|
||||||
inline iterator& operator=(iterator other) noexcept (
|
inline iterator& operator=(iterator other) noexcept (
|
||||||
std::is_nothrow_move_constructible<pointer>::value and
|
std::is_nothrow_move_constructible<pointer>::value and
|
||||||
std::is_nothrow_move_assignable<pointer>::value and
|
std::is_nothrow_move_assignable<pointer>::value and
|
||||||
std::is_nothrow_move_constructible<internal_iterator<typename array_t::iterator, typename object_t::iterator>>::value
|
std::is_nothrow_move_constructible<internal_iterator>::value and
|
||||||
and
|
std::is_nothrow_move_assignable<internal_iterator>::value
|
||||||
std::is_nothrow_move_assignable<internal_iterator<typename array_t::iterator, typename object_t::iterator>>::value
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
std::swap(m_object, other.m_object);
|
std::swap(m_object, other.m_object);
|
||||||
|
@ -2862,7 +2860,7 @@ class basic_json
|
||||||
/// associated JSON instance
|
/// associated JSON instance
|
||||||
pointer m_object = nullptr;
|
pointer m_object = nullptr;
|
||||||
/// the actual iterator of the associated instance
|
/// the actual iterator of the associated instance
|
||||||
internal_iterator<typename array_t::iterator, typename object_t::iterator> m_it;
|
internal_iterator m_it;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// a const random access iterator for the basic_json class
|
/// a const random access iterator for the basic_json class
|
||||||
|
@ -2893,12 +2891,12 @@ class basic_json
|
||||||
{
|
{
|
||||||
case (basic_json::value_t::object):
|
case (basic_json::value_t::object):
|
||||||
{
|
{
|
||||||
m_it.object_iterator = typename object_t::const_iterator();
|
m_it.object_iterator = typename object_t::iterator();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (basic_json::value_t::array):
|
case (basic_json::value_t::array):
|
||||||
{
|
{
|
||||||
m_it.array_iterator = typename array_t::const_iterator();
|
m_it.array_iterator = typename array_t::iterator();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -2943,9 +2941,8 @@ class basic_json
|
||||||
inline const_iterator& operator=(const_iterator other) noexcept(
|
inline const_iterator& operator=(const_iterator other) noexcept(
|
||||||
std::is_nothrow_move_constructible<pointer>::value and
|
std::is_nothrow_move_constructible<pointer>::value and
|
||||||
std::is_nothrow_move_assignable<pointer>::value and
|
std::is_nothrow_move_assignable<pointer>::value and
|
||||||
std::is_nothrow_move_constructible<internal_iterator<typename array_t::const_iterator, typename object_t::const_iterator>>::value
|
std::is_nothrow_move_constructible<internal_iterator>::value and
|
||||||
and
|
std::is_nothrow_move_assignable<internal_iterator>::value
|
||||||
std::is_nothrow_move_assignable<internal_iterator<typename array_t::const_iterator, typename object_t::const_iterator>>::value
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
std::swap(m_object, other.m_object);
|
std::swap(m_object, other.m_object);
|
||||||
|
@ -2961,13 +2958,13 @@ class basic_json
|
||||||
{
|
{
|
||||||
case (basic_json::value_t::object):
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case (basic_json::value_t::array):
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2993,13 +2990,13 @@ class basic_json
|
||||||
{
|
{
|
||||||
case (basic_json::value_t::object):
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case (basic_json::value_t::array):
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3398,7 +3395,7 @@ class basic_json
|
||||||
/// associated JSON instance
|
/// associated JSON instance
|
||||||
pointer m_object = nullptr;
|
pointer m_object = nullptr;
|
||||||
/// the actual iterator of the associated instance
|
/// the actual iterator of the associated instance
|
||||||
internal_iterator<typename array_t::const_iterator, typename object_t::const_iterator> m_it;
|
internal_iterator m_it;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// a reverse random access iterator for the basic_json class
|
/// a reverse random access iterator for the basic_json class
|
||||||
|
|
|
@ -2333,13 +2333,12 @@ class basic_json
|
||||||
///////////////
|
///////////////
|
||||||
|
|
||||||
/// an iterator value
|
/// an iterator value
|
||||||
template<typename array_iterator_t, typename object_iterator_t>
|
|
||||||
union internal_iterator
|
union internal_iterator
|
||||||
{
|
{
|
||||||
/// iterator for JSON objects
|
/// iterator for JSON objects
|
||||||
object_iterator_t object_iterator;
|
typename object_t::iterator object_iterator;
|
||||||
/// iterator for JSON arrays
|
/// iterator for JSON arrays
|
||||||
array_iterator_t array_iterator;
|
typename array_t::iterator array_iterator;
|
||||||
/// generic iteraotr for all other value types
|
/// generic iteraotr for all other value types
|
||||||
difference_type generic_iterator;
|
difference_type generic_iterator;
|
||||||
|
|
||||||
|
@ -2401,9 +2400,8 @@ class basic_json
|
||||||
inline iterator& operator=(iterator other) noexcept (
|
inline iterator& operator=(iterator other) noexcept (
|
||||||
std::is_nothrow_move_constructible<pointer>::value and
|
std::is_nothrow_move_constructible<pointer>::value and
|
||||||
std::is_nothrow_move_assignable<pointer>::value and
|
std::is_nothrow_move_assignable<pointer>::value and
|
||||||
std::is_nothrow_move_constructible<internal_iterator<typename array_t::iterator, typename object_t::iterator>>::value
|
std::is_nothrow_move_constructible<internal_iterator>::value and
|
||||||
and
|
std::is_nothrow_move_assignable<internal_iterator>::value
|
||||||
std::is_nothrow_move_assignable<internal_iterator<typename array_t::iterator, typename object_t::iterator>>::value
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
std::swap(m_object, other.m_object);
|
std::swap(m_object, other.m_object);
|
||||||
|
@ -2862,7 +2860,7 @@ class basic_json
|
||||||
/// associated JSON instance
|
/// associated JSON instance
|
||||||
pointer m_object = nullptr;
|
pointer m_object = nullptr;
|
||||||
/// the actual iterator of the associated instance
|
/// the actual iterator of the associated instance
|
||||||
internal_iterator<typename array_t::iterator, typename object_t::iterator> m_it;
|
internal_iterator m_it;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// a const random access iterator for the basic_json class
|
/// a const random access iterator for the basic_json class
|
||||||
|
@ -2893,12 +2891,12 @@ class basic_json
|
||||||
{
|
{
|
||||||
case (basic_json::value_t::object):
|
case (basic_json::value_t::object):
|
||||||
{
|
{
|
||||||
m_it.object_iterator = typename object_t::const_iterator();
|
m_it.object_iterator = typename object_t::iterator();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (basic_json::value_t::array):
|
case (basic_json::value_t::array):
|
||||||
{
|
{
|
||||||
m_it.array_iterator = typename array_t::const_iterator();
|
m_it.array_iterator = typename array_t::iterator();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -2943,9 +2941,8 @@ class basic_json
|
||||||
inline const_iterator& operator=(const_iterator other) noexcept(
|
inline const_iterator& operator=(const_iterator other) noexcept(
|
||||||
std::is_nothrow_move_constructible<pointer>::value and
|
std::is_nothrow_move_constructible<pointer>::value and
|
||||||
std::is_nothrow_move_assignable<pointer>::value and
|
std::is_nothrow_move_assignable<pointer>::value and
|
||||||
std::is_nothrow_move_constructible<internal_iterator<typename array_t::const_iterator, typename object_t::const_iterator>>::value
|
std::is_nothrow_move_constructible<internal_iterator>::value and
|
||||||
and
|
std::is_nothrow_move_assignable<internal_iterator>::value
|
||||||
std::is_nothrow_move_assignable<internal_iterator<typename array_t::const_iterator, typename object_t::const_iterator>>::value
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
std::swap(m_object, other.m_object);
|
std::swap(m_object, other.m_object);
|
||||||
|
@ -2961,13 +2958,13 @@ class basic_json
|
||||||
{
|
{
|
||||||
case (basic_json::value_t::object):
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case (basic_json::value_t::array):
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2993,13 +2990,13 @@ class basic_json
|
||||||
{
|
{
|
||||||
case (basic_json::value_t::object):
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case (basic_json::value_t::array):
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3398,7 +3395,7 @@ class basic_json
|
||||||
/// associated JSON instance
|
/// associated JSON instance
|
||||||
pointer m_object = nullptr;
|
pointer m_object = nullptr;
|
||||||
/// the actual iterator of the associated instance
|
/// the actual iterator of the associated instance
|
||||||
internal_iterator<typename array_t::const_iterator, typename object_t::const_iterator> m_it;
|
internal_iterator m_it;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// a reverse random access iterator for the basic_json class
|
/// a reverse random access iterator for the basic_json class
|
||||||
|
|
Loading…
Reference in a new issue