# std::ranges::chunk_view<V>::begin

> C++ Atlas: `cppatlas.com/w/cpp/ranges/chunk_view/begin` | Source: https://en.cppreference.com/w/cpp/ranges/chunk_view/begin | Domain: Ranges | Standards: C++20, C++23

Returns an iterator to the first element of the chunk_view.

## Official Specification Summary (cppreference)

```cpp
// V models only input_range
constexpr __outer_iterator begin(); // (1) (since C++23)
// V models forward_range
constexpr auto begin() requires (!__simple_view<V>); // (2) (since C++23)
constexpr auto begin() const requires ranges::forward_range<const V>; // (3) (since C++23)
```

Returns an iterator to the first element of the `chunk_view`.

Let `base_` denote the underlying view.

1) Available only if `V` models `input_range`. Equivalent to:

   ```cpp
   current_ = ranges::begin(base_);
   remainder_ = n_;
   return __outer_iterator(*this);
   ```

   `current_`, `remainder_`, and `n_` are underlying exposition only data members of `chunk_view`.

2) Available if `V` models `forward_range`. Equivalent to: `return iterator<false>(this, ranges::begin(base_));`, where `iterator` is exposition only nested class.

3) Available if `V` models `forward_range`. Equivalent to: `return iterator<true>(this, ranges::begin(base_));`, where `iterator` is exposition only nested class.

### Parameters

(none)

### Return value

An iterator to the first element of the `chunk_view`, as described above.

### Example

> Note: This section is incomplete Reason: no example

### See also

- [`end`](https://en.cppreference.com/w/cpp/ranges/chunk_view/end): returns an iterator or a sentinel to the end (public member function)
- [`ranges::begin`](https://en.cppreference.com/w/cpp/ranges/begin) (C++20): returns an iterator to the beginning of a range (customization point object)

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