Change the definition of the operator override of reverse iterator to using the result of the base class directly
This commit is contained in:
parent
a3bf0131c4
commit
3aef1a582e
1 changed files with 5 additions and 9 deletions
12
src/json.hpp
12
src/json.hpp
|
@ -8671,29 +8671,25 @@ class basic_json
|
||||||
/// add to iterator
|
/// add to iterator
|
||||||
json_reverse_iterator operator+(difference_type i) const
|
json_reverse_iterator operator+(difference_type i) const
|
||||||
{
|
{
|
||||||
auto result = *this;
|
return json_reverse_iterator(base_iterator::operator+(i));
|
||||||
result -= i;
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// subtract from iterator
|
/// subtract from iterator
|
||||||
json_reverse_iterator operator-(difference_type i) const
|
json_reverse_iterator operator-(difference_type i) const
|
||||||
{
|
{
|
||||||
auto result = *this;
|
return json_reverse_iterator(base_iterator::operator-(i));
|
||||||
result += i;
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// return difference
|
/// return difference
|
||||||
difference_type operator-(const json_reverse_iterator& other) const
|
difference_type operator-(const json_reverse_iterator& other) const
|
||||||
{
|
{
|
||||||
return other.base() - this->base();
|
return base_iterator(*this) - base_iterator(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// access to successor
|
/// access to successor
|
||||||
reference operator[](difference_type n) const
|
reference operator[](difference_type n) const
|
||||||
{
|
{
|
||||||
return *(this->operator+(n));
|
return base_iterator::operator[](n);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// return the key of an object iterator
|
/// return the key of an object iterator
|
||||||
|
|
Loading…
Reference in a new issue