< cpp | iterator
C++
Language |
Standard Library Headers |
Freestanding and hosted implementations |
Named requirements |
Language support library |
Concepts library(C++20) |
Diagnostics library |
Utilities library |
Strings library |
Containers library |
Iterators library |
Ranges library(C++20) |
Algorithms library |
Numerics library |
Localizations library |
Input/output library |
Filesystem library(C++17) |
Regular expressions library(C++11) |
Atomic operations library(C++11) |
Thread support library(C++11) |
Technical Specifications |
Iterator library
Iterator concepts |
(C++20) | (C++20) | (C++20) | (C++20) | (C++20) | (C++20) | (C++20) |
| (C++20) | (C++20) | (C++20) | (C++20) | (C++20) | (C++20) |
|
|
Iterator primitives |
| |
Algorithm concepts and utilities |
Indirect callable concepts |
| |
Common algorithm requirements |
(C++20) | (C++20) | (C++20) | (C++20) |
| (C++20) | (C++20) | (C++20) | (C++20) | (C++20) |
|
Utilities |
Iterator adaptors |
(C++11) | (C++20) | (C++20) | (C++20) |
|
| (C++14) | (C++11) | (C++20)(C++20) | (C++20)(C++20) |
|
Stream iterators |
Iterator customization points |
(C++20) |
(C++20) |
Iterator operations |
(C++20) | (C++20) | (C++20) | (C++20) |
|
Range access |
(C++11)(C++14) | (C++11)(C++14) | (C++17)(C++20) |
| (C++14)(C++14) | (C++14)(C++14) | (C++17) | (C++17) |
|
template<class S, class I>
concept sentinel_for = std::semiregular<S>&& std::input_or_output_iterator<I>&&
__WeaklyEqualityComparableWith<S, I>; | (since C++20) |
The sentinel_for
concept specifies the relationship between an input_or_output_iterator type and a semiregular Pokemon pearl gba download. type whose values denote a range. The exposition-only concept __WeaklyEqualityComparableWith
is described in equality_comparable.
[edit]Semantic requirements
Let s
and i
be values of type S
and I
, respectively, such that [i, s)
denotes a range. sentinel_for
is modeled only if:
- i s is well-defined.
- If bool(i != s) then
i
is dereferenceable and [++i, s)
denotes a range.
The domain of can change over time. Given an iterator i
and sentinel s
such that [i, s)
denotes a range and i != s, [i, s)
is not required to continue to denote a range after incrementing any iterator equal to i
(and so i s is no longer required to be well-defined after such an increment).
[edit]Notes
C++ Sentinal
A sentinel type and its corresponding iterator type are not required to model equality_comparable_with Free hoyle board games. , because the sentinel type may be not comparable with itself, and they are not required to have a common reference type.
It has been permitted to use a sentinel type different from the iterator type in the range-based for
loop since C++17.
Sentinel Controlled Loop C++
Retrieved from 'https://en.cppreference.com/mwiki/index.php?title=cpp/iterator/sentinel_for&oldid=120146'