Iterator concepts | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Iterator primitives | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Algorithm concepts and utilities | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Indirect callable concepts | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Common algorithm requirements | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Utilities | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Iterator adaptors | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
Defined in header <iterator> | ||
template<class T> using iter_value_t=/* see below */; | (1) | (since C++20) |
template</*dereferenceable*/ T> using iter_reference_t= decltype(*std::declval<T&>()); | (2) | (since C++20) |
template<std::indirectly_readable T> using iter_const_reference_t= | (3) | (since C++23) |
template<class T> using iter_difference_t=/* see below */; | (4) | (since C++20) |
template</*dereferenceable*/ T> requires/* see below */ | (5) | (since C++20) |
template<std::indirectly_readable T> using iter_common_reference_t= | (6) | (since C++20) |
Helper templates | ||
template<class T> concept/*dereferenceable*/=/* see below */; | (7) | (exposition only*) |
template<std::indirectly_readable T> using/*indirect-value-t*/=/* see below */; | (8) | (exposition only*) |
Compute the associated types of an iterator.
T
.T
.T
.T
.T
. The constraint on this alias template is satisfied if and only if the expressionranges::iter_move(std::declval<T&>()) is valid and has a referenceable type.T
. This is the common reference type between its reference type and an lvalue reference to its value type.dereferenceable
is satisfied if and only if the expression*std::declval<T&>() is valid and has areferenceable type.indirect-value-t
denotes the following:T
is the same asstd::projected<I, Proj> for some typesI
andProj
.The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
DR | Applied to | Behavior as published | Correct behavior |
---|---|---|---|
P2609R3 | C++20 | std::iter_common_reference_t was defined in termsofstd::iter_value_t<T>& which incorrectly handled std::projected types that project into rvalue reference types | defined in terms of /*indirect-value-t*/<T> to handle such cases |
(C++20) | specifies that a type is indirectly readable by applying operator* (concept)[edit] |
(C++20) | specifies that asemiregular type can be incremented with pre- and post-increment operators(concept)[edit] |
(C++20) | computes the value type of anindirectly_readable type(class template)[edit] |
(C++20) | computes the difference type of aweakly_incrementable type(class template)[edit] |
provides uniform interface to the properties of an iterator (class template)[edit] | |
(C++20)(C++23)(C++20)(C++23) | obtains iterator and sentinel types of a range (alias template)[edit] |
obtains reference types of a range (alias template)[edit] | |
(C++20)(C++20)(C++20) | obtains size, difference, and value types of a range (alias template)[edit] |