🔨 set bidirectional iterator tag #593
This commit is contained in:
parent
cea3f24ff9
commit
8e067c0c3c
1 changed files with 10 additions and 11 deletions
21
src/json.hpp
21
src/json.hpp
|
@ -3599,7 +3599,7 @@ template<typename BasicJsonType> struct internal_iterator
|
||||||
template<typename IteratorType> class iteration_proxy;
|
template<typename IteratorType> class iteration_proxy;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@brief a template for a random access iterator for the @ref basic_json class
|
@brief a template for a bidirectional iterator for the @ref basic_json class
|
||||||
|
|
||||||
This class implements a both iterators (iterator and const_iterator) for the
|
This class implements a both iterators (iterator and const_iterator) for the
|
||||||
@ref basic_json class.
|
@ref basic_json class.
|
||||||
|
@ -3611,14 +3611,15 @@ This class implements a both iterators (iterator and const_iterator) for the
|
||||||
|
|
||||||
@requirement The class satisfies the following concept requirements:
|
@requirement The class satisfies the following concept requirements:
|
||||||
-
|
-
|
||||||
[RandomAccessIterator](http://en.cppreference.com/w/cpp/concept/RandomAccessIterator):
|
[BidirectionalIterator](http://en.cppreference.com/w/cpp/concept/BidirectionalIterator):
|
||||||
The iterator that can be moved to point (forward and backward) to any
|
The iterator that can be moved can be moved in both directions (i.e.
|
||||||
element in constant time.
|
incremented and decremented).
|
||||||
|
|
||||||
@since version 1.0.0, simplified in version 2.0.9
|
@since version 1.0.0, simplified in version 2.0.9, change to bidirectional
|
||||||
|
iterators in version 3.0.0 (see https://github.com/nlohmann/json/issues/593)
|
||||||
*/
|
*/
|
||||||
template<typename BasicJsonType>
|
template<typename BasicJsonType>
|
||||||
class iter_impl : public std::iterator<std::random_access_iterator_tag, BasicJsonType>
|
class iter_impl : public std::iterator<std::bidirectional_iterator_tag, BasicJsonType>
|
||||||
{
|
{
|
||||||
/// allow basic_json to access private members
|
/// allow basic_json to access private members
|
||||||
friend iter_impl<typename std::conditional<std::is_const<BasicJsonType>::value, typename std::remove_const<BasicJsonType>::type, const BasicJsonType>::type>;
|
friend iter_impl<typename std::conditional<std::is_const<BasicJsonType>::value, typename std::remove_const<BasicJsonType>::type, const BasicJsonType>::type>;
|
||||||
|
@ -3645,8 +3646,6 @@ class iter_impl : public std::iterator<std::random_access_iterator_tag, BasicJso
|
||||||
typename std::conditional<std::is_const<BasicJsonType>::value,
|
typename std::conditional<std::is_const<BasicJsonType>::value,
|
||||||
typename BasicJsonType::const_reference,
|
typename BasicJsonType::const_reference,
|
||||||
typename BasicJsonType::reference>::type;
|
typename BasicJsonType::reference>::type;
|
||||||
/// the category of the iterator
|
|
||||||
using iterator_category = std::bidirectional_iterator_tag;
|
|
||||||
|
|
||||||
/// default constructor
|
/// default constructor
|
||||||
iter_impl() = default;
|
iter_impl() = default;
|
||||||
|
@ -4279,9 +4278,9 @@ create @ref const_reverse_iterator).
|
||||||
|
|
||||||
@requirement The class satisfies the following concept requirements:
|
@requirement The class satisfies the following concept requirements:
|
||||||
-
|
-
|
||||||
[RandomAccessIterator](http://en.cppreference.com/w/cpp/concept/RandomAccessIterator):
|
[BidirectionalIterator](http://en.cppreference.com/w/cpp/concept/BidirectionalIterator):
|
||||||
The iterator that can be moved to point (forward and backward) to any
|
The iterator that can be moved can be moved in both directions (i.e.
|
||||||
element in constant time.
|
incremented and decremented).
|
||||||
- [OutputIterator](http://en.cppreference.com/w/cpp/concept/OutputIterator):
|
- [OutputIterator](http://en.cppreference.com/w/cpp/concept/OutputIterator):
|
||||||
It is possible to write to the pointed-to element (only if @a Base is
|
It is possible to write to the pointed-to element (only if @a Base is
|
||||||
@ref iterator).
|
@ref iterator).
|
||||||
|
|
Loading…
Reference in a new issue