Defined in header <ranges> | ||
---|---|---|
template< class T > using iterator_t = decltype(ranges::begin(std::declval<T&>())); | (1) | (since C++20) |
template< ranges::range R > using const_iterator_t = std::const_iterator<ranges::iterator_t<R>>; | (2) | (since C++23) |
template< ranges::range R > using sentinel_t = decltype(ranges::end(std::declval<R&>())); | (3) | (since C++20) |
template< ranges::range R > using const_sentinel_t = std::const_sentinel<ranges::sentinel_t<R>>; | (4) | (since C++23) |
template< ranges::sized_range R > using range_size_t = decltype(ranges::size(std::declval<R&>())); | (5) | (since C++20) |
template< ranges::range R > using range_difference_t = std::iter_difference_t<ranges::iterator_t<R>>; | (6) | (since C++20) |
template< ranges::range R > using range_value_t = std::iter_value_t<ranges::iterator_t<R>>; | (7) | (since C++20) |
template< ranges::range R > using range_reference_t = std::iter_reference_t<ranges::iterator_t<R>>; | (8) | (since C++20) |
template< ranges::range R > using range_const_reference_t = std::iter_const_reference_t<ranges::iterator_t<R>>; | (9) | (since C++23) |
template< ranges::range R > using range_rvalue_reference_t = std::iter_rvalue_reference_t<ranges::iterator_t<R>>; | (10) | (since C++20) |
template< ranges::range R > using range_common_reference_t = std::iter_common_reference_t<ranges::iterator_t<R>>; | (11) | (since C++23) |
T
.R
.R
.R
.R
.R
.R
.R
.R
.T | - | a type that can be used in std::ranges::begin |
R | - | a range type or a sized_range type |
iterator_t
can be applied to non-range types, e.g. arrays with unknown bound.
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
DR | Applied to | Behavior as published | Correct behavior |
---|---|---|---|
LWG 3860 | C++20 | range_common_reference_t was missing | added |
(C++20)(C++20)(C++23)(C++20)(C++20)(C++20) | computes the associated types of an iterator (alias template) |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/w/cpp/ranges/iterator_t