std::ranges..._view::begin(3)
π
std::ranges..._view::begin(3) π
okay bestie, this page is from the C++ Standard Libary (yes, βLibaryβ β weβre not fixing the manualβs typo, itβs part of the lore) and itβs all about std::ranges..._view::begin(3). π
β¨ NAME β¨
std::ranges::adjacent_transform_view::beginβ and honestly? alsostd::ranges::adjacent_transform_view::begin. Same thing, twice, because the NAME section said it twice and we respect the bit. π
πΈ Synopsis πΈ
Hii so hereβs the signature situation, no cap:
constexpr auto begin(); (1)
(since C++23)
constexpr auto begin() const
requires ranges::range<const InnerView> && (2)
(since C++23)
std::regular_invocable<const F&,
__REPEAT(ranges::range_reference_t<const V>, N)...>;
Both of those are since C++23, bestie. β¨
Returns an iterator to the first element of the adjacent_transform_view.
Let inner_ be the underlying ranges::adjacent_view.
- Equivalent to
return /*iterator*/<false>(*this, inner_.begin());. - Equivalent to
return /*iterator*/<true>(*this, inner_.begin());.
π Parameters π
(none) β literally none. no parameters. zero. the void. π«Ά
π₯ Return value π₯
Iterator to the first element. Thatβs it. Thatβs the whole return value. π
π Example π
// Run this code
#include <ranges>
int main()
{
auto sum = [](auto... args) { return (... + args); };
constexpr auto view = std::views::iota(13, 1337)
| std::views::adjacent_transform<3>(sum);
static_assert(*view.begin() == 42 and 42 == 13 + 14 + 15);
}
π See also π
endβ returns an iterator or a sentinel to the end (C++23) (public member function)ranges::beginβ returns an iterator to the beginning of a range (C++20) (customization point object)
source/version footer vibes: http://cppreference.com Β· date: 2024.06.10 Β· page: std::ranges..._view::begin(3) β mwah bestie, go call begin() and slay π
π¦ 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