tmp/tmpizd82kim/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
### Other range refinements <a id="range.refinements">[[range.refinements]]</a>
|
| 2 |
+
|
| 3 |
+
The `output_range` concept specifies requirements of a `range` type for
|
| 4 |
+
which `ranges::begin` returns a model of `output_iterator`
|
| 5 |
+
[[iterator.concept.output]]. `input_range`, `forward_range`,
|
| 6 |
+
`bidirectional_range`, and `random_access_range` are defined similarly.
|
| 7 |
+
|
| 8 |
+
``` cpp
|
| 9 |
+
template<class R, class T>
|
| 10 |
+
concept output_range =
|
| 11 |
+
range<R> && output_iterator<iterator_t<R>, T>;
|
| 12 |
+
|
| 13 |
+
template<class T>
|
| 14 |
+
concept input_range =
|
| 15 |
+
range<T> && input_iterator<iterator_t<T>>;
|
| 16 |
+
|
| 17 |
+
template<class T>
|
| 18 |
+
concept forward_range =
|
| 19 |
+
input_range<T> && forward_iterator<iterator_t<T>>;
|
| 20 |
+
|
| 21 |
+
template<class T>
|
| 22 |
+
concept bidirectional_range =
|
| 23 |
+
forward_range<T> && bidirectional_iterator<iterator_t<T>>;
|
| 24 |
+
|
| 25 |
+
template<class T>
|
| 26 |
+
concept random_access_range =
|
| 27 |
+
bidirectional_range<T> && random_access_iterator<iterator_t<T>>;
|
| 28 |
+
```
|
| 29 |
+
|
| 30 |
+
`contiguous_range` additionally requires that the `ranges::data`
|
| 31 |
+
customization point [[range.prim.data]] is usable with the range.
|
| 32 |
+
|
| 33 |
+
``` cpp
|
| 34 |
+
template<class T>
|
| 35 |
+
concept contiguous_range =
|
| 36 |
+
random_access_range<T> && contiguous_iterator<iterator_t<T>> &&
|
| 37 |
+
requires(T& t) {
|
| 38 |
+
{ ranges::data(t) } -> same_as<add_pointer_t<range_reference_t<T>>>;
|
| 39 |
+
};
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
Given an expression `t` such that `decltype((t))` is `T&`, `T` models
|
| 43 |
+
`contiguous_range` only if
|
| 44 |
+
`to_address({}ranges::begin(t)) == ranges::data(t)` is `true`.
|
| 45 |
+
|
| 46 |
+
The `common_range` concept specifies requirements of a `range` type for
|
| 47 |
+
which `ranges::begin` and `ranges::end` return objects of the same type.
|
| 48 |
+
|
| 49 |
+
[*Example 1*: The standard containers [[containers]] model
|
| 50 |
+
`common_range`. — *end example*]
|
| 51 |
+
|
| 52 |
+
``` cpp
|
| 53 |
+
template<class T>
|
| 54 |
+
concept common_range =
|
| 55 |
+
range<T> && same_as<iterator_t<T>, sentinel_t<T>>;
|
| 56 |
+
```
|
| 57 |
+
|
| 58 |
+
The `viewable_range` concept specifies the requirements of a `range`
|
| 59 |
+
type that can be converted to a `view` safely.
|
| 60 |
+
|
| 61 |
+
``` cpp
|
| 62 |
+
template<class T>
|
| 63 |
+
concept viewable_range =
|
| 64 |
+
range<T> && (borrowed_range<T> || view<remove_cvref_t<T>>);
|
| 65 |
+
```
|
| 66 |
+
|