std::ranges..._view::base(3)
β¨ NAME β¨
okay so bestie, welcome to the std::ranges..._view::base(3) page from the C++ Standard Library π this one is literally named:
std::ranges::lazy_split_view::base β std::ranges::lazy_split_view::base
like yes, it said it twice and honestly? iconic behavior π
πΈ Synopsis πΈ
constexpr V base() const& requires std::copy_constructible<V>; (1)
(since C++20)
constexpr V base() &&; (2)
(since C++20)
So there are two overloads, bestie:
(1)βconstexpr V base() const& requires std::copy_constructible<V>;and it's since C++20 β¨(2)βconstexpr V base() &&;and it's also since C++20 π
Both of them return a copy of the underlying view π«Ά
(1)copy constructs the result from the underlying view.(2)move constructs the result from the underlying view.
π Parameters π
none. not a single one. zero. the void is giving minimalism π
π Return value π
a copy of the underlying view π«
π¦ Example π¦
run this code, bestie:
#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, "] ");
}
β Output β
base() = [this,..throw,..true,..try,..]
substrings: [this] [throw] [true] [try] []
ate and left no crumbs ππ
π See also π
baseβ returns a copy of the underlying (adapted) view,(C++20), and it's a public member function ofstd::ranges::split_view<V,Pattern>π¦
that's the whole page, bestie β no cap, every detail is here and it's living its main character era πΈβ¨
source/version + date, as promised: cppreference.com Β· 2024.06.10 Β· and the manual is std::ranges..._view::base(3) πππ«Ά
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms