You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A *view* is a lightweight range that refers to elements that it doesn't own, except for [`owning_view`](owning-view-class.md)). A view is typically based on another range and provides a different way of looking at it whether by transforming or filtering it. For example, [`std::views::filter`](filter-view-class.md) is a view that uses the criteria you specify to select elements from another range.
10
+
A *view* is a lightweight range that refers to elements that it doesn't own, (except for [`owning_view`](owning-view-class.md)). A view is typically based on another range and provides a different way of looking at it, whether by transforming or filtering it. For example, [`std::views::filter`](filter-view-class.md) is a view that uses the criteria you specify to select elements from another range.
11
11
12
-
When you access the elements in a view, it's done 'lazily' so that work is only done when you get an element. This also makes it possible to combine, or 'compose' views without a performance penalty. For example, you could create a view that provides only the even elements from a range, and then transform them by squaring them. The work to do the filtering and transformation is done only for the elements you access, and only when you access them.
12
+
When you access the elements in a view, it's done 'lazily' so that work is only done when you get an element. This also makes it possible to combine, or 'compose' views without a performance penalty. For example, you could create a view that provides only the even elements from a range and then transform them by squaring them. The work to do the filtering and transformation is done only for the elements you access, and only when you access them.
13
13
14
14
A view can be copied, assigned, and destroyed in constant time no matter how many elements it contains. This is because a view doesn't own the elements it refers to, so it doesn't need to make a copy. This is also why you can compose views without a performance penalty.
15
15
@@ -96,9 +96,9 @@ v | rev3(v): 2 1 0
96
96
97
97
The following view classes are defined in the `std::ranges` namespace.
98
98
99
-
|**Range adaptor**|**Description**|
99
+
|**View **|**Description**|
100
100
|--|--|
101
-
|[`basic_istream_view`](basic-istream-class.md)<sup>C++20</sup> | A view of successive elements from an input stream. |
101
+
|[`basic_istream_view`](basic-istream-view-class.md)<sup>C++20</sup> | A view of successive elements from an input stream. |
102
102
|[`common_view`](common-view-class.md)<sup>C++20</sup> | Adapts a view that has different iterator/sentinel types into a view with the same iterator/sentinel types. |
103
103
|[`drop_view`](drop-view-class.md)<sup>C++20</sup> | Created from another view, skipping the first `count` elements. |
104
104
|[`drop_while_view`](drop-while-view-class.md)<sup>C++20</sup> | Created from another view, skipping leading elements as long as a predicate holds. |
0 commit comments