Spec-Zone.ru › C++

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

constexpr V base() const& requires std::copy_constructible<V>;
(1) (since C++20)
constexpr V base() &&;
(2) (since C++20)

Возвращает копию базового представления.

1) Копирует результат из базового представления.
2) Перемещает результат из базового представления.

Параметры

(нет)

Значение результата

Копия базового представления.

Пример

#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] []

См. также

base
(C++20)
возвращает копию базового (адаптированного) представления
(публичный член-функция std::ranges::split_view<V,Pattern>)

© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/w/cpp/ranges/lazy_split_view/base

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API