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

52 lines
2.4 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.

[iterator.iterators]
# 24 Iterators library [[iterators]](./#iterators)
## 24.3 Iterator requirements [[iterator.requirements]](iterator.requirements#iterator.iterators)
### 24.3.5 C++17 iterator requirements [[iterator.cpp17]](iterator.cpp17#iterator.iterators)
#### 24.3.5.2 *Cpp17Iterator* [iterator.iterators]
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L2025)
The *Cpp17Iterator* requirements form the basis of the iterator
taxonomy; every iterator meets the *Cpp17Iterator* requirements[.](#1.sentence-1)
This
set of requirements specifies operations for dereferencing and incrementing
an iterator[.](#1.sentence-2)
Most algorithms will require additional operations to
read ([[input.iterators]](input.iterators "24.3.5.3Input iterators")) or write ([[output.iterators]](output.iterators "24.3.5.4Output iterators")) values, or
to provide a richer set of iterator movements ([[forward.iterators]](forward.iterators "24.3.5.5Forward iterators"), [[bidirectional.iterators]](bidirectional.iterators "24.3.5.6Bidirectional iterators"), [[random.access.iterators]](random.access.iterators "24.3.5.7Random access iterators"))[.](#1.sentence-3)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L2034)
A type X meets the *Cpp17Iterator* requirements if
- [(2.1)](#2.1)
X meets the *Cpp17CopyConstructible*, *Cpp17CopyAssignable*, *Cpp17Swappable*, and*Cpp17Destructible* requirements ([[utility.arg.requirements]](utility.arg.requirements "16.4.4.2Template argument requirements"), [[swappable.requirements]](swappable.requirements "16.4.4.3Swappable requirements")), and
- [(2.2)](#2.2)
iterator_traits<X>::difference_type is a signed integer type or void, and
- [(2.3)](#2.3)
the expressions in Table [78](#tab:iterator "Table 78: Cpp17Iterator requirements") are valid and have
the indicated semantics[.](#2.sentence-1)
Table [78](#tab:iterator) — *Cpp17Iterator* requirements [[tab:iterator]](./tab:iterator)
| [🔗](#tab:iterator-row-1)<br>**Expression** | **Return type** | **Operational** | **Assertion/note** |
| --- | --- | --- | --- |
| [🔗](#tab:iterator-row-2) | | **semantics** | **pre-/post-condition** |
| [🔗](#tab:iterator-row-3)<br>*r | unspecified | | *Preconditions*: r is dereferenceable[.](#tab:iterator-row-3-column-4-sentence-1) |
| [🔗](#tab:iterator-row-4)<br>++r | X& | | |