Namespaces
Variants

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

ja.cppreference.net より
 
 
Ranges ライブラリ
Range アダプタ
 
 
constexpr V base() const& requires std::copy_constructible<V>;
(1) (C++20 以上)
constexpr V base() &&;
(2) (C++20 以上)

元となるビューのコピーを返します。

1) 元となるビュー base_ から結果をコピー構築します。
2) 元となるビュー base_ から結果をムーブ構築します。

パラメータ

(なし)

戻り値

基になるビューのコピー。

例

#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);
}

出力:

1 2 3
1 2 3 4 5

関連項目

格納された述語への参照を返す
(公開メンバ関数)