From Jason Turner

[range.repeat.iterator]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpe9ilpeo2/{from.md → to.md} +196 -0
tmp/tmpe9ilpeo2/{from.md → to.md} RENAMED
@@ -0,0 +1,196 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Class `repeat_view::iterator` <a id="range.repeat.iterator">[[range.repeat.iterator]]</a>
2
+
3
+ ``` cpp
4
+ namespace std::ranges {
5
+ template<move_constructible T, semiregular Bound>
6
+ requires (is_object_v<T> && same_as<T, remove_cv_t<T>> &&
7
+ (integer-like-with-usable-difference-type<Bound> ||
8
+ same_as<Bound, unreachable_sentinel_t>))
9
+ class repeat_view<T, Bound>::iterator {
10
+ private:
11
+ using index-type = // exposition only
12
+ conditional_t<same_as<Bound, unreachable_sentinel_t>, ptrdiff_t, Bound>;
13
+ const T* value_ = nullptr; // exposition only
14
+ index-type current_ = index-type(); // exposition only
15
+
16
+ constexpr explicit iterator(const T* value, index-type b = index-type()); // exposition only
17
+
18
+ public:
19
+ using iterator_concept = random_access_iterator_tag;
20
+ using iterator_category = random_access_iterator_tag;
21
+ using value_type = T;
22
+ using difference_type = see below;
23
+
24
+ iterator() = default;
25
+
26
+ constexpr const T& operator*() const noexcept;
27
+
28
+ constexpr iterator& operator++();
29
+ constexpr iterator operator++(int);
30
+
31
+ constexpr iterator& operator--();
32
+ constexpr iterator operator--(int);
33
+
34
+ constexpr iterator& operator+=(difference_type n);
35
+ constexpr iterator& operator-=(difference_type n);
36
+ constexpr const T& operator[](difference_type n) const noexcept;
37
+
38
+ friend constexpr bool operator==(const iterator& x, const iterator& y);
39
+ friend constexpr auto operator<=>(const iterator& x, const iterator& y);
40
+
41
+ friend constexpr iterator operator+(iterator i, difference_type n);
42
+ friend constexpr iterator operator+(difference_type n, iterator i);
43
+
44
+ friend constexpr iterator operator-(iterator i, difference_type n);
45
+ friend constexpr difference_type operator-(const iterator& x, const iterator& y);
46
+ };
47
+ }
48
+ ```
49
+
50
+ If `is-signed-integer-like<index-type>` is `true`, the member
51
+ *typedef-name* `difference_type` denotes *`index-type`*. Otherwise, it
52
+ denotes `IOTA-DIFF-T(index-type)` [[range.iota.view]].
53
+
54
+ ``` cpp
55
+ constexpr explicit iterator(const T* value, index-type b = index-type());
56
+ ```
57
+
58
+ *Preconditions:* If `Bound` is not `unreachable_sentinel_t`, `b` ≥ 0.
59
+
60
+ *Effects:* Initializes *value\_* with `value` and *current\_* with `b`.
61
+
62
+ ``` cpp
63
+ constexpr const T& operator*() const noexcept;
64
+ ```
65
+
66
+ *Effects:* Equivalent to: `return *`*`value_`*`;`
67
+
68
+ ``` cpp
69
+ constexpr iterator& operator++();
70
+ ```
71
+
72
+ *Effects:* Equivalent to:
73
+
74
+ ``` cpp
75
+ ++current_;
76
+ return *this;
77
+ ```
78
+
79
+ ``` cpp
80
+ constexpr iterator operator++(int);
81
+ ```
82
+
83
+ *Effects:* Equivalent to:
84
+
85
+ ``` cpp
86
+ auto tmp = *this;
87
+ ++*this;
88
+ return tmp;
89
+ ```
90
+
91
+ ``` cpp
92
+ constexpr iterator& operator--();
93
+ ```
94
+
95
+ *Preconditions:* If `Bound` is not `unreachable_sentinel_t`,
96
+ current_ > 0.
97
+
98
+ *Effects:* Equivalent to:
99
+
100
+ ``` cpp
101
+ --current_;
102
+ return *this;
103
+ ```
104
+
105
+ ``` cpp
106
+ constexpr iterator operator--(int);
107
+ ```
108
+
109
+ *Effects:* Equivalent to:
110
+
111
+ ``` cpp
112
+ auto tmp = *this;
113
+ --*this;
114
+ return tmp;
115
+ ```
116
+
117
+ ``` cpp
118
+ constexpr iterator& operator+=(difference_type n);
119
+ ```
120
+
121
+ *Preconditions:* If `Bound` is not `unreachable_sentinel_t`,
122
+ current_ + `n` ≥ 0.
123
+
124
+ *Effects:* Equivalent to:
125
+
126
+ ``` cpp
127
+ current_ += n;
128
+ return *this;
129
+ ```
130
+
131
+ ``` cpp
132
+ constexpr iterator& operator-=(difference_type n);
133
+ ```
134
+
135
+ *Preconditions:* If `Bound` is not `unreachable_sentinel_t`,
136
+ current_ - `n` ≥ 0.
137
+
138
+ *Effects:* Equivalent to:
139
+
140
+ ``` cpp
141
+ current_ -= n;
142
+ return *this;
143
+ ```
144
+
145
+ ``` cpp
146
+ constexpr const T& operator[](difference_type n) const noexcept;
147
+ ```
148
+
149
+ *Effects:* Equivalent to: `return *(*this + n);`
150
+
151
+ ``` cpp
152
+ friend constexpr bool operator==(const iterator& x, const iterator& y);
153
+ ```
154
+
155
+ *Effects:* Equivalent to: `return x.`*`current_`*` == y.`*`current_`*`;`
156
+
157
+ ``` cpp
158
+ friend constexpr auto operator<=>(const iterator& x, const iterator& y);
159
+ ```
160
+
161
+ *Effects:* Equivalent to:
162
+ `return x.`*`current_`*` <=> y.`*`current_`*`;`
163
+
164
+ ``` cpp
165
+ friend constexpr iterator operator+(iterator i, difference_type n);
166
+ friend constexpr iterator operator+(difference_type n, iterator i);
167
+ ```
168
+
169
+ *Effects:* Equivalent to:
170
+
171
+ ``` cpp
172
+ i += n;
173
+ return i;
174
+ ```
175
+
176
+ ``` cpp
177
+ friend constexpr iterator operator-(iterator i, difference_type n);
178
+ ```
179
+
180
+ *Effects:* Equivalent to:
181
+
182
+ ``` cpp
183
+ i -= n;
184
+ return i;
185
+ ```
186
+
187
+ ``` cpp
188
+ friend constexpr difference_type operator-(const iterator& x, const iterator& y);
189
+ ```
190
+
191
+ *Effects:* Equivalent to:
192
+
193
+ ``` cpp
194
+ return static_cast<difference_type>(x.current_) - static_cast<difference_type>(y.current_);
195
+ ```
196
+