23 Iterators library [iterators]

23.5 Iterator adaptors [predef.iterators]

23.5.6 Counted iterators [iterators.counted]

23.5.6.6 Comparisons [counted.iter.cmp]

template<Common<I> I2> friend constexpr bool operator==( const counted_iterator& x, const counted_iterator<I2>& y);
Expects: x and y refer to elements of the same sequence ([counted.iterator]).
Effects: Equivalent to: return x.length == y.length;
friend constexpr bool operator==( const counted_iterator& x, default_sentinel_t); friend constexpr bool operator==( default_sentinel_t, const counted_iterator& x);
Effects: Equivalent to: return x.length == 0;
template<Common<I> I2> friend constexpr bool operator!=( const counted_iterator& x, const counted_iterator<I2>& y); friend constexpr bool operator!=( const counted_iterator& x, default_sentinel_t y); friend constexpr bool operator!=( default_sentinel_t x, const counted_iterator& y);
Effects: Equivalent to: return !(x == y);
template<Common<I> I2> friend constexpr bool operator<( const counted_iterator& x, const counted_iterator<I2>& y);
Expects: x and y refer to elements of the same sequence ([counted.iterator]).
Effects: Equivalent to: return y.length < x.length;
[Note
:
The argument order in the Effects: element is reversed because length counts down, not up.
end note
]
template<Common<I> I2> friend constexpr bool operator>( const counted_iterator& x, const counted_iterator<I2>& y);
Effects: Equivalent to: return y < x;
template<Common<I> I2> friend constexpr bool operator<=( const counted_iterator& x, const counted_iterator<I2>& y);
Effects: Equivalent to: return !(y < x);
template<Common<I> I2> friend constexpr bool operator>=( const counted_iterator& x, const counted_iterator<I2>& y);
Effects: Equivalent to: return !(x < y);