std::ranges::adjacent_view<V,N>::iterator<Const>::operator*
constexpr auto operator*() const; | (начиная с C++23) |
Возвращает элементы, на которые указывает базовый массив итераторов в V.
Пусть current_ — это базовый массив итераторов.
Эквивалентно:
return /*tuple-transform*/([](auto& i) -> decltype(auto) { return *i; }, current_);
Параметры
(нет)
Возвращаемое значение
Текущий элемент, представляющий собой std::tuple ссылок на базовые элементы.
Примечания
operator-> не предоставляется.
Пример
#include <ranges>
#include <tuple>
int main()
{
constexpr static auto v = {0, 1, 2, 3, 4, 5};
// └──┬──┘
// └─────────────────┐
constexpr auto view {v | std::views::adjacent<3>}; // │
constexpr auto iter {view.begin() + 2}; // │
// ┌────────────────────┬────────────────┘
// │ ┌──┴──┐
static_assert(*iter == std::tuple{2, 3, 4});
}
См. также
|
(C++23) | доступ к элементу по индексу (открытая функция-член) |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/cpp/ranges/adjacent_view/iterator/operator*