Daily bit(e) of C++ | std::views::adjacent, std::views::pairwise
Daily bit(e) of C++ #127, The C++23 "sliding tuple" views: std::views::adjacent and std::views::pairwise.
std::views::adjacent is a view similar to std::views::slide, producing a sliding window over the input range. However, where std::views::slide produces subranges, std::views::adjacent produces tuples of references to elements.
Consequently, the elements of std::views::adjacent can be deconstructed using structured binding.
The std::views::adjacent<2> has an alias in std::views::pairwise.