22 Iterators library [iterators]

22.5 Iterator adaptors [predef.iterators]

22.5.6 Counted iterators [iterators.counted]

22.5.6.5 Navigation [counted.iter.nav]

constexpr counted_iterator& operator++();
Expects: length > 0.
Effects: Equivalent to:
++current;
--length;
return *this;
decltype(auto) operator++(int);
Expects: length > 0.
Effects: Equivalent to:
--length;
try { return current++; }
catch(...) { ++length; throw; }
constexpr counted_iterator operator++(int) requires ForwardIterator<I>;
Effects: Equivalent to:
counted_iterator tmp = *this;
++*this;
return tmp;
constexpr counted_iterator& operator--(); requires BidirectionalIterator<I>
Effects: Equivalent to:
--current;
++length;
return *this;
constexpr counted_iterator operator--(int) requires BidirectionalIterator<I>;
Effects: Equivalent to:
counted_iterator tmp = *this;
--*this;
return tmp;
constexpr counted_iterator operator+(iter_difference_t<I> n) const requires RandomAccessIterator<I>;
Effects: Equivalent to: return counted_­iterator(current + n, length - n);
friend constexpr counted_iterator operator+( iter_difference_t<I> n, const counted_iterator& x) requires RandomAccessIterator<I>;
Effects: Equivalent to: return x + n;
constexpr counted_iterator& operator+=(iter_difference_t<I> n) requires RandomAccessIterator<I>;
Expects: n <= length.
Effects: Equivalent to:
current += n;
length -= n;
return *this;
constexpr counted_iterator operator-(iter_difference_t<I> n) const requires RandomAccessIterator<I>;
Effects: Equivalent to: return counted_­iterator(current - n, length + n);
template<Common<I> I2> friend constexpr iter_difference_t<I2> 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;
friend constexpr iter_difference_t<I> operator-( const counted_iterator& x, default_sentinel_t);
Effects: Equivalent to: return -x.length;
friend constexpr iter_difference_t<I> operator-( default_sentinel_t, const counted_iterator& y);
Effects: Equivalent to: return y.length;
constexpr counted_iterator& operator-=(iter_difference_t<I> n) requires RandomAccessIterator<I>;
Expects: -n <= length.
Effects: Equivalent to:
current -= n;
length += n;
return *this;