名前空間
変種
操作

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

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

基底ビューbase_のコピーを返します。

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

目次

[編集] 戻り値

1) 基底ビューのコピー。
2) 基底ビューからムーブ構築されたビュー。

[編集]

#include <iomanip>
#include <iostream>
#include <ranges>
#include <string_view>
 
int main()
{
    constexpr std::string_view keywords{"this throw true try typedef typeid"};
    std::ranges::split_view split_view{keywords, ' '};
    std::cout << "base() = " << std::quoted(split_view.base()) << "\n"
                 "substrings: ";
    for (auto split : split_view)
        std::cout << std::quoted(std::string_view{split}) << ' ';
    std::cout << '\n';
}

出力

base() = "this throw true try typedef typeid"
substrings: "this" "throw" "true" "try" "typedef" "typeid"

[編集] 不具合報告

以下の動作変更を伴う欠陥報告が、以前に公開されたC++標準に遡って適用されました。

DR 適用対象 公開された動作 正しい動作
LWG 3590 C++20 const& オーバーロードで、コピー代入の妥当性が追加で要求されていた 制約が緩和されました。

[編集] 関連項目

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