std::ranges..._view::base(3)
π std::ranges..._view::base(3) π
okay bestie, welcome to the C++ Standard Libary manual page for std::ranges..._view::base(3) β yep, thatβs the title, and the manual name is folded right in here so you donβt gotta stare at a copied header line. This page is all about std::ranges::drop_while_view::base, and itβs giving βtiny accessor, main-character energy.β π
π NAME π
std::ranges::drop_while_view::base - std::ranges::drop_while_view::base
πΈ Synopsis πΈ
two overloads, both since C++20:
constexpr V base() const& requires std::copy_constructible<V>; (1)
(since C++20)
constexpr V base() &&; (2)
(since C++20)
This whole thing returns a copy of the underlying view. β¨
- Copy constructs the result from the underlying view.
- Move constructs the result from the underlying view.
π«Ά Parameters π«Ά
(none) β literally none, bestie. no args, no flags, no snacks. π
π Return value π
A copy of the underlying view. Thatβs it. Iconic, concise, no cap. π
π¦ Example π¦
// Run this code
#include <algorithm>
#include <array>
#include <iostream>
#include <ranges>
void print(auto first, auto last)
{
for (; first != last; ++first)
std::cout << *first << ' ';
std::cout << '\n';
}
int main()
{
std::array data{1, 2, 3, 4, 5};
print(data.cbegin(), data.cend());
auto func = [](int x) { return x < 3; };
auto view = std::ranges::drop_while_view{data, func};
print(view.begin(), view.end());
auto base = view.base(); // `base` refers to the `data`
std::ranges::reverse(base); //< changes `data` indirectly
print(data.cbegin(), data.cend());
}
π Output π
1 2 3 4 5
3 4 5
5 4 3 2 1
mwah π this page came from the source http://cppreference.com, dated 2024.06.10, and itβs the std::ranges..._view::base(3) page. go off, bestie π
β¨
π¦ 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