From 10b33a266258e1075a45df445f5b8f71b7ea514d Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Thu, 5 Mar 2015 16:07:37 +0000 Subject: [PATCH] Rework reverse_iterator::operator[] so as not to use the base iterators operator [], which can cause constness problems. Fixes PR17883 llvm-svn: 231375 --- libcxx/include/iterator | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libcxx/include/iterator b/libcxx/include/iterator index 04ff4c1..7f7e9ee1 100644 --- a/libcxx/include/iterator +++ b/libcxx/include/iterator @@ -575,7 +575,7 @@ public: _LIBCPP_INLINE_VISIBILITY reverse_iterator& operator-=(difference_type __n) {current += __n; return *this;} _LIBCPP_INLINE_VISIBILITY reference operator[](difference_type __n) const - {return current[-__n-1];} + {return *(*this + __n);} }; template -- 2.7.4