std::ranges::lazy_split_view<V,Pattern>::base
ja.cppreference.net より
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>
の公開メンバ関数)
|