# std::ranges::chunk_by_view<V,Pred>::iterator::operator++,--

> C++ Atlas: `cppatlas.com/w/cpp/ranges/chunk_by_view/iterator/operator_arith` | Source: https://en.cppreference.com/w/cpp/ranges/chunk_by_view/iterator/operator_arith | Domain: Ranges | Standards: C++23

Increments or decrements the iterator.

## Official Specification Summary (cppreference)

```cpp
constexpr /*iterator*/& operator++(); // (1) (since C++23)
constexpr /*iterator*/ operator++(int); // (2) (since C++23)
constexpr /*iterator*/& operator--() requires ranges::bidirectional_range<V>; // (3) (since C++23)
constexpr /*iterator*/ operator--(int) requires ranges::bidirectional_range<V>; // (4) (since C++23)
```

Increments or decrements the iterator.

Let `parent_`, `current_`, and `next_` be the appropriate underlying (exposition-only) data-members of iterator.

Let `find-next` and `find-prev` be appropriate (exposition-only) member functions of `ranges::chunk_by_view`.

1) Equivalent to:

   ```cpp
   current_ = next_;
   next_ = parent_->/*find-next*/(current_);
   return *this;
   ```

The behavior is undefined if before the call to this operator `current_` is equal to `next_`.

2) Equivalent to: `auto tmp = *this; ++*this; return tmp;`

3) Equivalent to:

   ```cpp
   next_ = current_;
   current_ = parent_->/*find-prev*/(next_);
   return *this;
   ```

4) Equivalent to: `auto tmp = *this; --*this; return tmp;`

### Parameters

(none)

### Return value

1,3) `*this`

2,4) a copy of `*this` that was made before the change.

---
Attribution: content from https://en.cppreference.com/w/cpp/ranges/chunk_by_view/iterator/operator_arith (cppreference.com), licensed under CC-BY-SA 3.0 and GFDL. Modified: converted to markdown, study notes added. Offline snapshot of 9 February 2025.