# std::ranges::take_while_view<V,Pred>::end

> C++ Atlas: `cppatlas.com/w/cpp/ranges/take_while_view/end` | Source: https://en.cppreference.com/w/cpp/ranges/take_while_view/end | Domain: Ranges | Standards: C++20

Returns a sentinel representing the end of the view.

## Official Specification Summary (cppreference)

```cpp
constexpr auto end() requires (!/*simple-view*/<V>); // (1) (since C++20)

constexpr auto end() const requires
    ranges::range<const V> &&
    std::indirect_unary_predicate<const Pred, ranges::iterator_t<const V>>; // (2) (since C++20)
```

Returns a sentinel representing the end of the view.

Let `base_` denote the underlying view.

1) Effectively returns `/*sentinel*/<false>(ranges::end(base_), std::addressof(pred()))`.

2) Effectively returns `/*sentinel*/<true>(ranges::end(base_), std::addressof(pred()))`.

Overload (1) does not participate in overload resolution if `V` is a simple view (that is, if `V` and `const V` are views with the same iterator and sentinel types).

### Parameters

(none)

### Return value

A sentinel representing the end of the view.

### Example

> Note: This section is incomplete Reason: no example

### Defect reports

The following behavior-changing defect reports were applied retroactively to previously published C++ standards.

| DR | Applied to | Behavior as published | Correct behavior |
| --- | --- | --- | --- |
| LWG 3450 | C++20 | the `const` overload might return a sentinel non-comparable to the iterator | constrained |

### See also

- [`begin`](https://en.cppreference.com/w/cpp/ranges/take_while_view/begin): returns an iterator to the beginning (public member function)
- [`operator==`](https://en.cppreference.com/w/cpp/ranges/take_while_view/sentinel/operator_cmp) (C++20): compares a sentinel with an iterator returned from `take_while_view::begin` (function)

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