std::ranges::take_while_view<V,Pred>::base
From cppreference.com
< cpp | ranges | take while view
C++
Feature test macros (C++20)
Concepts library (C++20)
Metaprogramming library (C++11)
Ranges library (C++20)
Filesystem library (C++17)
Concurrency support library (C++11)
Execution control library (C++26)
Ranges library
(C++23)(C++23)
(C++26)(C++26)
(C++23)(C++23)
(C++26)(C++26)
(C++26)(C++26)
(C++23)(C++23)
(C++23)(C++23)
(C++23)(C++23)
(C++23)(C++23)
(C++23)(C++23)
(C++23)
(C++23)(C++23)
(C++23)
(C++23)(C++23)
(C++23)(C++23)
(C++23)(C++23)
(C++23)(C++23)
(C++23)(C++23)
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_
.Contents
[edit] Parameters
(none)
[edit] Return value
A copy of the underlying view.
[edit] Example
Run this code
#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:
1 2 3 1 2 3 4 5