# std::ranges::split_view<V,Pattern>::end

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

Returns an iterator or a sentinel representing the end of the resulting subrange. Equivalent to:

## Official Specification Summary (cppreference)

```cpp
constexpr auto end() const; // (since C++20)
```

Returns an iterator or a sentinel representing the end of the resulting subrange. Equivalent to:

`constexpr auto end() { if constexpr (ranges::common_range<V>) return iterator{*this, ranges::end(base_), {}}; else return sentinel{*this}; }`

### Return value

An iterator or a sentinel.

### Example

```cpp
#include <cassert>
#include <ranges>
#include <string_view>

int main()
{
    constexpr std::string_view keywords{"bitand bitor bool break"};
    std::ranges::split_view kw{keywords, ' '};
    assert(4 == std::ranges::distance(kw.begin(), kw.end()));
}
```

### See also

- [`begin`](https://en.cppreference.com/w/cpp/ranges/split_view/begin): returns an iterator to the beginning (public member function)
- [`end`](https://en.cppreference.com/w/cpp/ranges/lazy_split_view/end): returns an iterator or a sentinel to the end (public member function of `std::ranges::lazy_split_view<V,Pattern>`)
- [`ranges::end`](https://en.cppreference.com/w/cpp/ranges/end) (C++20): returns a sentinel indicating the end of a range (customization point object)

---
Attribution: content from https://en.cppreference.com/w/cpp/ranges/split_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.