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

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

Returns a copy of the underlying view.

## Official Specification Summary (cppreference)

```cpp
constexpr V base() const& requires std::copy_constructible<V>; // (1) (since C++20)
constexpr V base() &&; // (2) (since C++20)
```

Returns a copy of the underlying view.

1) Copy constructs the result from the underlying view `base_`.

2) Move constructs the result from the underlying view `base_`.

### Parameters

(none)

### Return value

A copy of the underlying view.

### Example

```cpp
#include <iostream>
#include <ranges>

namespace stq {
void println(auto, const auto& v)
{
    for (const auto& e : v)
        std::cout << e << ' ';
    std::cout << '\n';
}
}

int main()
{
    static constexpr int a[]{1, 2, 3, 4, 5};
    constexpr auto view = a | std::views::take_while([](int x){ return x < 4; });
    stq::println("{}", view);
    const auto base = view.base();
    stq::println("{}", base);
}
```

Output:

```text
1 2 3
1 2 3 4 5
```

### See also

- [`pred`](https://en.cppreference.com/w/cpp/ranges/take_while_view/pred): returns a reference to the stored predicate (public member function)

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