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
An alias template is an alias for another type, which can make code more readable. For example, the following alias, `conditional_t`, is an alias for either `borrowed_range` or `dangling` range, depending on the kind of `range` that's passed in:
11
11
12
12
```cpp
13
-
// requires /std:c++20, or later
13
+
// requires /std:c++20 or later
14
14
15
15
#include<iostream>
16
16
#include<list>
@@ -94,7 +94,7 @@ If an algorithm function is passed a range whose iterators depend on its lifetim
94
94
The following example shows how `borrowed_iterator_t` detects a dangling iterator. The function `ranges::max_element()` uses this template alias to determine the return type:
95
95
96
96
```cpp
97
-
// requires /std:c++20, or later
97
+
// requires /std:c++20 or later
98
98
99
99
#include<vector>
100
100
#include<span>
@@ -165,7 +165,7 @@ If an algorithm function is passed a range whose iterators depend on its lifetim
165
165
The following example shows how `borrowed_subrange_t` detects a dangling iterator because `equal_range()` and `max_element` use this template alias to determine the return type:
166
166
167
167
```cpp
168
-
// requires /std:c++20, or later
168
+
// requires /std:c++20 or later
169
169
170
170
#include<vector>
171
171
#include<iostream>
@@ -228,7 +228,7 @@ A variable number of non-`void` types. They have no effect. The arguments are a
228
228
The following example shows how `max_element` detects a dangling iterator.
229
229
230
230
```cpp
231
-
// requires /std:c++20, or later
231
+
// requires /std:c++20 or later
232
232
233
233
#include <vector>
234
234
#include <iostream>
@@ -272,7 +272,7 @@ The range type to get the iterator type for.
272
272
The following example shows how `iterator_t` can be used to declare an iterator for a vector:
273
273
274
274
```cpp
275
-
// requires /std:c++20, or later
275
+
// requires /std:c++20 or later
276
276
277
277
#include<vector>
278
278
#include<ranges>
@@ -314,7 +314,7 @@ The range whose iterator will provide the difference type.
314
314
The following example shows how `range_difference_t` is used to hold the distance between elements in a range:
315
315
316
316
```cpp
317
-
// requires /std:c++20, or later
317
+
// requires /std:c++20 or later
318
318
319
319
#include<vector>
320
320
#include<ranges>
@@ -356,7 +356,7 @@ The range for which the reference type of its iterator type is returned.
356
356
The following example shows `range_reference_t` referring to the type of the elements in a range:
357
357
358
358
```cpp
359
-
// requires /std:c++20, or later
359
+
// requires /std:c++20 or later
360
360
361
361
#include<vector>
362
362
#include<ranges>
@@ -399,7 +399,7 @@ The range to get the rvalue reference type to its iterator type.
399
399
The following example shows `range_rvalue_reference_t` referring to a rvalue type of the elements in a range:
400
400
401
401
```cpp
402
-
// requires /std:c++20, or later
402
+
// requires /std:c++20 or later
403
403
404
404
#include<vector>
405
405
#include<ranges>
@@ -442,7 +442,7 @@ The range to get the type of its `size` function.
442
442
The following example shows `range_size_t` referring to the number of elements in a range:
443
443
444
444
```cpp
445
-
// requires /std:c++20, or later
445
+
// requires /std:c++20 or later
446
446
447
447
#include<vector>
448
448
#include<iostream>
@@ -484,7 +484,7 @@ The range to get the value type of its iterator.
484
484
The following example shows how `range_value_t` refers to the type of elements in a range:
485
485
486
486
```cpp
487
-
// requires /std:c++20, or later
487
+
// requires /std:c++20 or later
488
488
489
489
#include<vector>
490
490
#include<ranges>
@@ -526,7 +526,7 @@ The range to get the sentinel type for.
526
526
The following example shows using `sentinel_t` to determine whether the iterator type and sentinel type are the same:
Copy file name to clipboardExpand all lines: docs/standard-library/view-classes.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -51,7 +51,7 @@ Using a view after the range that it's based on is modified can lead to undefine
51
51
Because views are cheap to create, you should generally re-create a view if you modify the underlying range. The following example demonstrates how to store a view pipeline in a variable so that you can reuse it.
0 commit comments