The Concepts Ranges and Views
Explore the C++20 ranges library by learning about concepts such as ranges and views. Understand how ranges represent iterable groups of items and how views apply operations lazily without owning data. This lesson covers various predefined views enabling functional style programming and efficient data transformation.
We'll cover the following...
I already presented the concepts ranges and views when discussing concepts. Consequently, here’s a brief refresher:
-
range: Arangeis a group of items that you can iterate over. It provides a begin iterator and an end sentinel. The containers of the STL are ranges. -
view: Aviewis something that you apply on a range and performs some operation. A view does not own data, and its time complexity to copy, move, or assign is constant.
In this code ...