名前空間
変種
操作

std::ranges::lazy_split_view<V,Pattern>::base

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

基になるビューbase_のコピーを返します。

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

[編集] 戻り値

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

[編集]

#include <iostream>
#include <ranges>
#include <string_view>
 
void print(std::string_view rem, auto const& r, std::string_view post = "\n")
{
    for (std::cout << rem; auto const& e : r)
        std::cout << e;
    std::cout << post;
}
 
int main()
{
    constexpr std::string_view keywords{ "this,..throw,..true,..try,.." };
    constexpr std::string_view pattern{",.."};
    constexpr std::ranges::lazy_split_view lazy_split_view{keywords, pattern};
    print("base() = [", lazy_split_view.base(), "]\n"
          "substrings: ");
    for (auto const& split: lazy_split_view)
        print("[", split, "] ");
}

出力

base() = [this,..throw,..true,..try,..]
substrings: [this] [throw] [true] [try] []

[編集] 関連項目

基になる(適応された)ビューのコピーを返す
(std::ranges::split_view<V,Pattern>のpublicメンバ関数) [編集]
English 日本語 中文(简体) 中文(繁體)