Summary
This episode continues Jason's mini-series on C++23 ranges by comparing two easily confused views: adjacent_view and slide_view. While both create sliding windows over a range, they differ in key ways: adjacent_view takes a compile-time template parameter for window size and returns tuples of references, while slide_view takes a runtime parameter and returns ranges of references. Jason demonstrates both views with examples and explains when to use each - adjacent_view for compile-time known window sizes and slide_view for runtime-determined sizes or when a range output is preferred over tuples.
Related C++ Standard Sections
This episode covers topics found in these sections of the C++ standard:
-
[range.view]61% match -
[range.as.rvalue.view]46% match -
[range.as.const.view]45% match -
[range.adjacent.view]45% match -
[range.adjacent.transform.view]45% match -
[range.slide.view]44% match -
[range.common.view]44% match -
[range.owning.view]44% match -
[range.reverse.view]44% match -
[range.enumerate.view]43% match - + 12 more related sections