[counted.iter.cmp]

# 24 Iterators library [[iterators]](./#iterators)

## 24.5 Iterator adaptors [[predef.iterators]](predef.iterators#counted.iter.cmp)

### 24.5.7 Counted iterators [[iterators.counted]](iterators.counted#counted.iter.cmp)

#### 24.5.7.6 Comparisons [counted.iter.cmp]

[ð](#lib:operator==,counted_iterator)

`template<[common_with](concept.common#concept:common_with "18.4.6 Concept common_­with [concept.common]")<I> I2>
  friend constexpr bool operator==(
    const counted_iterator& x, const counted_iterator<I2>& y);
`

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L6362)

*Preconditions*: x and y refer to
elements of the same sequence ([[counted.iterator]](counted.iterator "24.5.7.1 Class template counted_­iterator"))[.](#1.sentence-1)

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L6367)

*Effects*: Equivalent to: return x.length == y.length;

[ð](#lib:operator==,counted_iterator_)

`friend constexpr bool operator==(
  const counted_iterator& x, default_sentinel_t) noexcept;
`

[3](#3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L6379)

*Effects*: Equivalent to: return x.length == 0;

[ð](#lib:operator%3c=%3e,counted_iterator)

`template<[common_with](concept.common#concept:common_with "18.4.6 Concept common_­with [concept.common]")<I> I2>
  friend constexpr strong_ordering operator<=>(
    const counted_iterator& x, const counted_iterator<I2>& y);
`

[4](#4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L6392)

*Preconditions*: x and y refer to
elements of the same sequence ([[counted.iterator]](counted.iterator "24.5.7.1 Class template counted_­iterator"))[.](#4.sentence-1)

[5](#5)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L6397)

*Effects*: Equivalent to: return y.length <=> x.length;

[6](#6)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L6401)

[*Note [1](#note-1)*:

The argument order in the *Effects*: element is reversed
because length counts down, not up[.](#6.sentence-1)

â *end note*]
