Implement LWG 2360: 'reverse_iterator::operator*() is unimplementable'. Note that this is a (small) behavior change in the library. Reverse iterators whose base iterators' operator* return references to 'within themselves' have been sacrificed to the greater goal of avoiding data races.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@203587 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -536,8 +536,6 @@ class _LIBCPP_TYPE_VIS_ONLY reverse_iterator
|
||||
typename iterator_traits<_Iter>::pointer,
|
||||
typename iterator_traits<_Iter>::reference>
|
||||
{
|
||||
private:
|
||||
mutable _Iter __t;
|
||||
protected:
|
||||
_Iter current;
|
||||
public:
|
||||
@@ -547,11 +545,11 @@ public:
|
||||
typedef typename iterator_traits<_Iter>::pointer pointer;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY reverse_iterator() : current() {}
|
||||
_LIBCPP_INLINE_VISIBILITY explicit reverse_iterator(_Iter __x) : __t(__x), current(__x) {}
|
||||
_LIBCPP_INLINE_VISIBILITY explicit reverse_iterator(_Iter __x) : current(__x) {}
|
||||
template <class _Up> _LIBCPP_INLINE_VISIBILITY reverse_iterator(const reverse_iterator<_Up>& __u)
|
||||
: __t(__u.base()), current(__u.base()) {}
|
||||
: current(__u.base()) {}
|
||||
_LIBCPP_INLINE_VISIBILITY _Iter base() const {return current;}
|
||||
_LIBCPP_INLINE_VISIBILITY reference operator*() const {__t = current; return *--__t;}
|
||||
_LIBCPP_INLINE_VISIBILITY reference operator*() const {_Iter __tmp = current; return *--__tmp;}
|
||||
_LIBCPP_INLINE_VISIBILITY pointer operator->() const {return _VSTD::addressof(operator*());}
|
||||
_LIBCPP_INLINE_VISIBILITY reverse_iterator& operator++() {--current; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY reverse_iterator operator++(int)
|
||||
|
Reference in New Issue
Block a user