Spec-Zone.ru › C++

std::ranges::adjacent_transform_view<V,F,N>::iterator<Const>::operator++,--,+=,-=

constexpr /*iterator*/& operator++();
(1) (с C++23)
constexpr /*iterator*/ operator++(int);
(2) (с C++23)
constexpr /*iterator*/& operator--()
    requires ranges::bidirectional_range<Base>;
(3) (с C++23)
constexpr /*iterator*/ operator--( int )
    requires ranges::bidirectional_range<Base>;
(4) (с C++23)
constexpr /*iterator*/& operator+=( difference_type n )
    requires ranges::random_access_range<Base>;
(5) (с C++23)
constexpr /*iterator*/& operator-=( difference_type n )
    requires ranges::random_access_range<Base>;
(6) (с C++23)

Увеличивает или уменьшает итератор.

Пусть inner_ — базовый итератор, а Base — вспомогательный тип.

Эквивалентно:

1) ++inner_; return *this;
2) auto tmp = *this; ++*this; return tmp;
3) --inner_; return *this;
4) auto tmp = *this; --*this; return tmp;
5) inner_ += n; return *this;
6) inner_ -= n; return *this;

Параметры

n - смещение относительно текущей позиции

Возвращаемое значение

1,3,5,6) *this
2,4) копия значения *this, созданная до изменения

Пример

См. также

© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/w/cpp/ranges/adjacent_transform_view/iterator/operator_arith

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API