C++26 Ranges: Four New Views
cppdashboard.dev/r/2026/10/cpp26-ranges-four-new-viewsThis article discusses four new views introduced in C++26 ranges, providing insights into their functionality and usage. It serves as the first part of a series exploring the enhancements in C++26 ranges.
From the article
C++20 shipped a powerful ranges library, but the set of view adaptors had some obvious gaps. Want to get the output as a container? No luck. At least C++23 helped with that . Want to iterate over two vectors as one sequence? Write your own. Want to avoid redundant evaluations in a transform | filter pipeline? Write a workaround. Want a quick index sequence matching a range’s size? Spell out iota with an ugly cast.
C++26 fills four of these gaps with new views: views::concat , views::to_input , views::cache_latest , and views::indices .
This was one of the most requested additions. P2542R8 gives us views::concat , which lazily concatenates any number of ranges into a single view:
Share this resource