Created on 2017-01-28.00:00:00 last changed 94 months ago
Proposed resolution:
This wording is relative to N4618.
Modify [reverse.iterators], class template reverse_iterator synopsis, as indicated:
template <class Iterator1, class Iterator2> constexpr bool operator==( const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y); template <class Iterator1, class Iterator2> constexpr bool operator<( const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y); template <class Iterator1, class Iterator2> constexpr bool operator!=( const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y); template <class Iterator1, class Iterator2> constexpr bool operator>( const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y); template <class Iterator1, class Iterator2> constexpr bool operator>=( const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y); template <class Iterator1, class Iterator2> constexpr bool operator<=( const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y); template <class Iterator> constexpr bool operator==( const reverse_iterator<Iterator>& x, const reverse_iterator<Iterator>& y); template <class Iterator> constexpr bool operator<( const reverse_iterator<Iterator>& x, const reverse_iterator<Iterator>& y); template <class Iterator> constexpr bool operator!=( const reverse_iterator<Iterator>& x, const reverse_iterator<Iterator>& y); template <class Iterator> constexpr bool operator>( const reverse_iterator<Iterator>& x, const reverse_iterator<Iterator>& y); template <class Iterator> constexpr bool operator>=( const reverse_iterator<Iterator>& x, const reverse_iterator<Iterator>& y); template <class Iterator> constexpr bool operator<=( const reverse_iterator<Iterator>& x, const reverse_iterator<Iterator>& y);
Modify [reverse.iter.op==] as indicated:
template <class Iterator1, class Iterator2> constexpr bool operator==( const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y); template <class Iterator> constexpr bool operator==( const reverse_iterator<Iterator>& x, const reverse_iterator<Iterator>& y);-1- Returns: x.current == y.current.
Modify [reverse.iter.op<] as indicated:
template <class Iterator1, class Iterator2> constexpr bool operator<( const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y); template <class Iterator> constexpr bool operator<( const reverse_iterator<Iterator>& x, const reverse_iterator<Iterator>& y);-1- Returns: x.current > y.current.
Modify [reverse.iter.op!=] as indicated:
template <class Iterator1, class Iterator2> constexpr bool operator!=( const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y); template <class Iterator> constexpr bool operator!=( const reverse_iterator<Iterator>& x, const reverse_iterator<Iterator>& y);-1- Returns: x.current != y.current.
Modify [reverse.iter.op>] as indicated:
template <class Iterator1, class Iterator2> constexpr bool operator>( const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y); template <class Iterator> constexpr bool operator>( const reverse_iterator<Iterator>& x, const reverse_iterator<Iterator>& y);-1- Returns: x.current < y.current.
Modify [reverse.iter.op>=] as indicated:
template <class Iterator1, class Iterator2> constexpr bool operator>=( const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y); template <class Iterator> constexpr bool operator>=( const reverse_iterator<Iterator>& x, const reverse_iterator<Iterator>& y);-1- Returns: x.current <= y.current.
Modify [reverse.iter.op<=] as indicated:
template <class Iterator1, class Iterator2> constexpr bool operator<=( const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y); template <class Iterator> constexpr bool operator<=( const reverse_iterator<Iterator>& x, const reverse_iterator<Iterator>& y);-1- Returns: x.current >= y.current.
[ 2017-03-04, Kona ]
Set priority to 4. STL to write a paper deprecating relops Alisdair to provide an example for Annex C.
Further to LWG 2472, the case of reverse_iterator comparisons is a regression introduced by LWG 280.
Consider the following program:#include <utility> #include <iterator> using namespace std::rel_ops; bool f(std::reverse_iterator<int *> it) { return it != it; }
Under C++03, the operator!= in lib.reverse.iterator is more specialized than the operator!= in std::rel_ops.
Following LWG 280, neither operator!= candidate is more specialized than the other. The program is observed to fail with libc++. Online compiler example, see here. Suggested resolution: Reintroduce the homogeneous comparison operators from C++03 alongside the new ones.History | |||
---|---|---|---|
Date | User | Action | Args |
2017-03-14 03:14:09 | admin | set | messages: + msg9109 |
2017-02-01 22:08:24 | admin | set | messages: + msg8835 |
2017-01-28 00:00:00 | admin | create |