From Jason Turner

[range.concat.view]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmphavdohmc/{from.md → to.md} +183 -0
tmp/tmphavdohmc/{from.md → to.md} RENAMED
@@ -0,0 +1,183 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Class template `concat_view` <a id="range.concat.view">[[range.concat.view]]</a>
2
+
3
+ ``` cpp
4
+ namespace std::ranges {
5
+ template<class... Rs>
6
+ using concat-reference-t = common_reference_t<range_reference_t<Rs>...>; // exposition only
7
+ template<class... Rs>
8
+ using concat-value-t = common_type_t<range_value_t<Rs>...>; // exposition only
9
+ template<class... Rs>
10
+ using concat-rvalue-reference-t = // exposition only
11
+ common_reference_t<range_rvalue_reference_t<Rs>...>;
12
+
13
+ template<class... Rs>
14
+ concept concat-indirectly-readable = see below; // exposition only
15
+ template<class... Rs>
16
+ concept concatable = see below; // exposition only
17
+ template<bool Const, class... Rs>
18
+ concept concat-is-random-access = see below; // exposition only
19
+ template<bool Const, class... Rs>
20
+ concept concat-is-bidirectional = see below; // exposition only
21
+
22
+ template<input_range... Views>
23
+ requires (view<Views> && ...) && (sizeof...(Views) > 0) &&
24
+ concatable<Views...>
25
+ class concat_view : public view_interface<concat_view<Views...>> {
26
+
27
+ tuple<Views...> views_; // exposition only
28
+
29
+ // [range.concat.iterator], class template concat_view::iterator
30
+ template<bool> class iterator; // exposition only
31
+
32
+ public:
33
+ constexpr concat_view() = default;
34
+ constexpr explicit concat_view(Views... views);
35
+
36
+ constexpr iterator<false> begin() requires (!(simple-view<Views> && ...));
37
+ constexpr iterator<true> begin() const
38
+ requires (range<const Views> && ...) && concatable<const Views...>;
39
+
40
+ constexpr auto end() requires (!(simple-view<Views> && ...));
41
+ constexpr auto end() const
42
+ requires (range<const Views> && ...) && concatable<const Views...>;
43
+
44
+ constexpr auto size() requires (sized_range<Views> && ...);
45
+ constexpr auto size() const requires (sized_range<const Views> && ...);
46
+ };
47
+
48
+ template<class... R>
49
+ concat_view(R&&...) -> concat_view<views::all_t<R>...>;
50
+ }
51
+ ```
52
+
53
+ ``` cpp
54
+ template<class... Rs>
55
+ concept concat-indirectly-readable = see below; // exposition only
56
+ ```
57
+
58
+ The exposition-only `concat-indirectly-readable` concept is equivalent
59
+ to:
60
+
61
+ ``` cpp
62
+ template<class Ref, class RRef, class It>
63
+ concept concat-indirectly-readable-impl = // exposition only
64
+ requires (const It it) {
65
+ { *it } -> convertible_to<Ref>;
66
+ { ranges::iter_move(it) } -> convertible_to<RRef>;
67
+ };
68
+
69
+ template<class... Rs>
70
+ concept concat-indirectly-readable = // exposition only
71
+ common_reference_with<concat-reference-t<Rs...>&&,
72
+ concat-value-t<Rs...>&> &&
73
+ common_reference_with<concat-reference-t<Rs...>&&,
74
+ concat-rvalue-reference-t<Rs...>&&> &&
75
+ common_reference_with<concat-rvalue-reference-t<Rs...>&&,
76
+ concat-value-t<Rs...> const&> &&
77
+ (concat-indirectly-readable-impl<concat-reference-t<Rs...>,
78
+ concat-rvalue-reference-t<Rs...>,
79
+ iterator_t<Rs>> && ...);
80
+ ```
81
+
82
+ ``` cpp
83
+ template<class... Rs>
84
+ concept concatable = see below; // exposition only
85
+ ```
86
+
87
+ The exposition-only `concatable` concept is equivalent to:
88
+
89
+ ``` cpp
90
+ template<class... Rs>
91
+ concept concatable = requires { // exposition only
92
+ typename concat-reference-t<Rs...>;
93
+ typename concat-value-t<Rs...>;
94
+ typename concat-rvalue-reference-t<Rs...>;
95
+ } && concat-indirectly-readable<Rs...>;
96
+ ```
97
+
98
+ ``` cpp
99
+ template<bool Const, class... Rs>
100
+ concept concat-is-random-access = see below; // exposition only
101
+ ```
102
+
103
+ Let `Fs` be the pack that consists of all elements of `Rs` except the
104
+ last element, then *`concat-is-random-access`* is equivalent to:
105
+
106
+ ``` cpp
107
+ template<bool Const, class... Rs>
108
+ concept concat-is-random-access = // exposition only
109
+ all-random-access<Const, Rs...> &&
110
+ (common_range<maybe-const<Const, Fs>> && ...);
111
+ ```
112
+
113
+ ``` cpp
114
+ template<bool Const, class... Rs>
115
+ concept concat-is-bidirectional = see below; // exposition only
116
+ ```
117
+
118
+ Let `Fs` be the pack that consists of all elements of `Rs` except the
119
+ last element, then *`concat-is-bidirectional`* is equivalent to:
120
+
121
+ ``` cpp
122
+ template<bool Const, class... Rs>
123
+ concept concat-is-bidirectional = // exposition only
124
+ all-bidirectional<Const, Rs...> &&
125
+ (common_range<maybe-const<Const, Fs>> && ...);
126
+ ```
127
+
128
+ ``` cpp
129
+ constexpr explicit concat_view(Views... views);
130
+ ```
131
+
132
+ *Effects:* Initializes *views\_* with `std::move(views)...`.
133
+
134
+ ``` cpp
135
+ constexpr iterator<false> begin() requires (!(simple-view<Views> && ...));
136
+ constexpr iterator<true> begin() const
137
+ requires (range<const Views> && ...) && concatable<const Views...>;
138
+ ```
139
+
140
+ *Effects:* Let *is-const* be `true` for the const-qualified overload,
141
+ and `false` otherwise. Equivalent to:
142
+
143
+ ``` cpp
144
+ iterator<is-const> it(this, in_place_index<0>, ranges::begin(std::get<0>(views_)));
145
+ it.template satisfy<0>();
146
+ return it;
147
+ ```
148
+
149
+ ``` cpp
150
+ constexpr auto end() requires (!(simple-view<Views> && ...));
151
+ constexpr auto end() const
152
+ requires (range<const Views> && ...) && concatable<const Views...>;
153
+ ```
154
+
155
+ *Effects:* Let *is-const* be `true` for the const-qualified overload,
156
+ and `false` otherwise. Equivalent to:
157
+
158
+ ``` cpp
159
+ constexpr auto N = sizeof...(Views);
160
+ if constexpr (common_range<maybe-const<is-const, Views...[N - 1]>>) {
161
+ return iterator<is-const>(this, in_place_index<N - 1>,
162
+ ranges::end(std::get<N - 1>(views_)));
163
+ } else {
164
+ return default_sentinel;
165
+ }
166
+ ```
167
+
168
+ ``` cpp
169
+ constexpr auto size() requires (sized_range<Views> && ...);
170
+ constexpr auto size() const requires (sized_range<const Views> && ...);
171
+ ```
172
+
173
+ *Effects:* Equivalent to:
174
+
175
+ ``` cpp
176
+ return apply(
177
+ [](auto... sizes) {
178
+ using CT = make-unsigned-like-t<common_type_t<decltype(sizes)...>>;
179
+ return (CT(sizes) + ...);
180
+ },
181
+ tuple-transform(ranges::size, views_));
182
+ ```
183
+