std::ranges...t_view::end(3)
π std::ranges...t_view::end(3) π
okay bestie, welcome to the C++ Standard Libary corner of the internet β this page is all about std::ranges::split_view::end, and weβre gonna make it make sense π
β¨
πΈ NAME πΈ
std::ranges::split_view::end - std::ranges::split_view::end
π¦ Synopsis π¦
constexpr auto end() const; (since C++20)
This one returns an iterator or a sentinel representing the end of the resulting subrange. Itβs giving range-terminator realness, no cap π
Equivalent to:
constexpr auto end()
{
if constexpr (ranges::common_range<V>)
return /*iterator*/{*this, ranges::end(base_), {}};
else
return /*sentinel*/{*this};
}
π Parameters π
(none)
Literally nothing to pass here, bestie π«Ά
β¨ Return value β¨
An iterator or a sentinel. Thatβs the whole vibe check π¦
π Example π
// Run this code
#include <iostream>
#include <ranges>
#include <string_view>
int main()
{
constexpr std::string_view keywords{"bitand bitor bool break"};
std::ranges::split_view kw{keywords, ' '};
const auto count = std::ranges::distance(kw.begin(), kw.end());
std::cout << "Words count: " << count << '\n';
}
Output:
Words count: 4
And yes, the example prints exactly that β four words, slay π
π See also π
beginβ returns an iterator to the beginning (C++20) (public member function)endβ returns an iterator or a sentinel to the end (C++20) (public member function ofstd::ranges::lazy_split_view<V,Pattern>)ranges::endβ returns a sentinel indicating the end of a range (C++20) (customization point object)
These are your go-to see-also besties, iykyk π
std::ranges...t_view::end(3) out β source/version: http://cppreference.com, date: 2024.06.10. catch you later, 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