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

2.4 KiB
Raw Permalink Blame History

[iterator.iterators]

24 Iterators library [iterators]

24.3 Iterator requirements [iterator.requirements]

24.3.5 C++17 iterator requirements [iterator.cpp17]

24.3.5.2 Cpp17Iterator [iterator.iterators]

1

#

The Cpp17Iterator requirements form the basis of the iterator taxonomy; every iterator meets the Cpp17Iterator requirements.

This set of requirements specifies operations for dereferencing and incrementing an iterator.

Most algorithms will require additional operations to read ([input.iterators]) or write ([output.iterators]) values, or to provide a richer set of iterator movements ([forward.iterators], [bidirectional.iterators], [random.access.iterators]).

2

#

A type X meets the Cpp17Iterator requirements if

X meets the Cpp17CopyConstructible, Cpp17CopyAssignable, Cpp17Swappable, andCpp17Destructible requirements ([utility.arg.requirements], [swappable.requirements]), and

iterator_traits::difference_type is a signed integer type or void, and

the expressions in Table 78 are valid and have the indicated semantics.

Table 78Cpp17Iterator requirements [tab:iterator]

🔗
Expression
Return type Operational Assertion/note
🔗 semantics pre-/post-condition
🔗
*r
unspecified Preconditions: r is dereferenceable.
🔗
++r
X&