Files
2025-10-25 03:02:53 +03:00

73 lines
2.3 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[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.6Concept 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.1Class 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.6Concept 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.1Class 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*]