Rework reverse_iterator::operator[] so as not to use the base iterators operator [], which can cause constness problems. Fixes PR17883
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@231375 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
3b1d283788
commit
ad98e210c6
@ -575,7 +575,7 @@ public:
|
|||||||
_LIBCPP_INLINE_VISIBILITY reverse_iterator& operator-=(difference_type __n)
|
_LIBCPP_INLINE_VISIBILITY reverse_iterator& operator-=(difference_type __n)
|
||||||
{current += __n; return *this;}
|
{current += __n; return *this;}
|
||||||
_LIBCPP_INLINE_VISIBILITY reference operator[](difference_type __n) const
|
_LIBCPP_INLINE_VISIBILITY reference operator[](difference_type __n) const
|
||||||
{return current[-__n-1];}
|
{return *(*this + __n);}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Iter1, class _Iter2>
|
template <class _Iter1, class _Iter2>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user