From Jason Turner

[queue]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmphq4g5fwv/{from.md → to.md} +49 -49
tmp/tmphq4g5fwv/{from.md → to.md} RENAMED
@@ -9,49 +9,49 @@ particular, `list` [[list]] and `deque` [[deque]] can be used.
9
  ``` cpp
10
  namespace std {
11
  template<class T, class Container = deque<T>>
12
  class queue {
13
  public:
14
- using value_type = typename Container::value_type;
15
- using reference = typename Container::reference;
16
- using const_reference = typename Container::const_reference;
17
- using size_type = typename Container::size_type;
18
  using container_type = Container;
19
 
20
  protected:
21
  Container c;
22
 
23
  public:
24
- queue() : queue(Container()) {}
25
- explicit queue(const Container&);
26
- explicit queue(Container&&);
27
- template<class InputIterator> queue(InputIterator first, InputIterator last);
28
- template<container-compatible-range<T> R> queue(from_range_t, R&& rg);
29
- template<class Alloc> explicit queue(const Alloc&);
30
- template<class Alloc> queue(const Container&, const Alloc&);
31
- template<class Alloc> queue(Container&&, const Alloc&);
32
- template<class Alloc> queue(const queue&, const Alloc&);
33
- template<class Alloc> queue(queue&&, const Alloc&);
34
  template<class InputIterator, class Alloc>
35
- queue(InputIterator first, InputIterator last, const Alloc&);
36
  template<container-compatible-range<T> R, class Alloc>
37
- queue(from_range_t, R&& rg, const Alloc&);
38
 
39
- [[nodiscard]] bool empty() const { return c.empty(); }
40
- size_type size() const { return c.size(); }
41
- reference front() { return c.front(); }
42
- const_reference front() const { return c.front(); }
43
- reference back() { return c.back(); }
44
- const_reference back() const { return c.back(); }
45
- void push(const value_type& x) { c.push_back(x); }
46
- void push(value_type&& x) { c.push_back(std::move(x)); }
47
- template<container-compatible-range<T> R> void push_range(R&& rg);
48
  template<class... Args>
49
- decltype(auto) emplace(Args&&... args)
50
  { return c.emplace_back(std::forward<Args>(args)...); }
51
- void pop() { c.pop_front(); }
52
- void swap(queue& q) noexcept(is_nothrow_swappable_v<Container>)
53
  { using std::swap; swap(c, q.c); }
54
  };
55
 
56
  template<class Container>
57
  queue(Container) -> queue<typename Container::value_type, Container>;
@@ -81,32 +81,32 @@ namespace std {
81
  ```
82
 
83
  #### Constructors <a id="queue.cons">[[queue.cons]]</a>
84
 
85
  ``` cpp
86
- explicit queue(const Container& cont);
87
  ```
88
 
89
  *Effects:* Initializes `c` with `cont`.
90
 
91
  ``` cpp
92
- explicit queue(Container&& cont);
93
  ```
94
 
95
  *Effects:* Initializes `c` with `std::move(cont)`.
96
 
97
  ``` cpp
98
  template<class InputIterator>
99
- queue(InputIterator first, InputIterator last);
100
  ```
101
 
102
  *Effects:* Initializes `c` with `first` as the first argument and `last`
103
  as the second argument.
104
 
105
  ``` cpp
106
  template<container-compatible-range<T> R>
107
- queue(from_range_t, R&& rg);
108
  ```
109
 
110
  *Effects:* Initializes `c` with
111
  `ranges::to<Container>(std::forward<R>(rg))`.
112
 
@@ -114,127 +114,127 @@ template<container-compatible-range<T> R>
114
 
115
  If `uses_allocator_v<container_type, Alloc>` is `false` the constructors
116
  in this subclause shall not participate in overload resolution.
117
 
118
  ``` cpp
119
- template<class Alloc> explicit queue(const Alloc& a);
120
  ```
121
 
122
  *Effects:* Initializes `c` with `a`.
123
 
124
  ``` cpp
125
- template<class Alloc> queue(const container_type& cont, const Alloc& a);
126
  ```
127
 
128
  *Effects:* Initializes `c` with `cont` as the first argument and `a` as
129
  the second argument.
130
 
131
  ``` cpp
132
- template<class Alloc> queue(container_type&& cont, const Alloc& a);
133
  ```
134
 
135
  *Effects:* Initializes `c` with `std::move(cont)` as the first argument
136
  and `a` as the second argument.
137
 
138
  ``` cpp
139
- template<class Alloc> queue(const queue& q, const Alloc& a);
140
  ```
141
 
142
  *Effects:* Initializes `c` with `q.c` as the first argument and `a` as
143
  the second argument.
144
 
145
  ``` cpp
146
- template<class Alloc> queue(queue&& q, const Alloc& a);
147
  ```
148
 
149
  *Effects:* Initializes `c` with `std::move(q.c)` as the first argument
150
  and `a` as the second argument.
151
 
152
  ``` cpp
153
  template<class InputIterator, class Alloc>
154
- queue(InputIterator first, InputIterator last, const Alloc& alloc);
155
  ```
156
 
157
  *Effects:* Initializes `c` with `first` as the first argument, `last` as
158
  the second argument, and `alloc` as the third argument.
159
 
160
  ``` cpp
161
  template<container-compatible-range<T> R, class Alloc>
162
- queue(from_range_t, R&& rg, const Alloc& a);
163
  ```
164
 
165
  *Effects:* Initializes `c` with
166
  `ranges::to<Container>(std::forward<R>(rg), a)`.
167
 
168
  #### Modifiers <a id="queue.mod">[[queue.mod]]</a>
169
 
170
  ``` cpp
171
  template<container-compatible-range<T> R>
172
- void push_range(R&& rg);
173
  ```
174
 
175
  *Effects:* Equivalent to `c.append_range(std::forward<R>(rg))` if that
176
  is a valid expression, otherwise `ranges::copy(rg, back_inserter(c))`.
177
 
178
  #### Operators <a id="queue.ops">[[queue.ops]]</a>
179
 
180
  ``` cpp
181
  template<class T, class Container>
182
- bool operator==(const queue<T, Container>& x, const queue<T, Container>& y);
183
  ```
184
 
185
  *Returns:* `x.c == y.c`.
186
 
187
  ``` cpp
188
  template<class T, class Container>
189
- bool operator!=(const queue<T, Container>& x, const queue<T, Container>& y);
190
  ```
191
 
192
  *Returns:* `x.c != y.c`.
193
 
194
  ``` cpp
195
  template<class T, class Container>
196
- bool operator< (const queue<T, Container>& x, const queue<T, Container>& y);
197
  ```
198
 
199
  *Returns:* `x.c < y.c`.
200
 
201
  ``` cpp
202
  template<class T, class Container>
203
- bool operator> (const queue<T, Container>& x, const queue<T, Container>& y);
204
  ```
205
 
206
  *Returns:* `x.c > y.c`.
207
 
208
  ``` cpp
209
  template<class T, class Container>
210
- bool operator<=(const queue<T, Container>& x, const queue<T, Container>& y);
211
  ```
212
 
213
  *Returns:* `x.c <= y.c`.
214
 
215
  ``` cpp
216
  template<class T, class Container>
217
- bool operator>=(const queue<T, Container>& x,
218
- const queue<T, Container>& y);
219
  ```
220
 
221
  *Returns:* `x.c >= y.c`.
222
 
223
  ``` cpp
224
  template<class T, three_way_comparable Container>
225
- compare_three_way_result_t<Container>
226
  operator<=>(const queue<T, Container>& x, const queue<T, Container>& y);
227
  ```
228
 
229
  *Returns:* `x.c <=> y.c`.
230
 
231
  #### Specialized algorithms <a id="queue.special">[[queue.special]]</a>
232
 
233
  ``` cpp
234
  template<class T, class Container>
235
- void swap(queue<T, Container>& x, queue<T, Container>& y) noexcept(noexcept(x.swap(y)));
 
236
  ```
237
 
238
  *Constraints:* `is_swappable_v<Container>` is `true`.
239
 
240
  *Effects:* As if by `x.swap(y)`.
 
9
  ``` cpp
10
  namespace std {
11
  template<class T, class Container = deque<T>>
12
  class queue {
13
  public:
14
+ using value_type = Container::value_type;
15
+ using reference = Container::reference;
16
+ using const_reference = Container::const_reference;
17
+ using size_type = Container::size_type;
18
  using container_type = Container;
19
 
20
  protected:
21
  Container c;
22
 
23
  public:
24
+ constexpr queue() : queue(Container()) {}
25
+ constexpr explicit queue(const Container&);
26
+ constexpr explicit queue(Container&&);
27
+ template<class InputIterator> constexpr queue(InputIterator first, InputIterator last);
28
+ template<container-compatible-range<T> R> constexpr queue(from_range_t, R&& rg);
29
+ template<class Alloc> constexpr explicit queue(const Alloc&);
30
+ template<class Alloc> constexpr queue(const Container&, const Alloc&);
31
+ template<class Alloc> constexpr queue(Container&&, const Alloc&);
32
+ template<class Alloc> constexpr queue(const queue&, const Alloc&);
33
+ template<class Alloc> constexpr queue(queue&&, const Alloc&);
34
  template<class InputIterator, class Alloc>
35
+ constexpr queue(InputIterator first, InputIterator last, const Alloc&);
36
  template<container-compatible-range<T> R, class Alloc>
37
+ constexpr queue(from_range_t, R&& rg, const Alloc&);
38
 
39
+ constexpr bool empty() const { return c.empty(); }
40
+ constexpr size_type size() const { return c.size(); }
41
+ constexpr reference front() { return c.front(); }
42
+ constexpr const_reference front() const { return c.front(); }
43
+ constexpr reference back() { return c.back(); }
44
+ constexpr const_reference back() const { return c.back(); }
45
+ constexpr void push(const value_type& x) { c.push_back(x); }
46
+ constexpr void push(value_type&& x) { c.push_back(std::move(x)); }
47
+ template<container-compatible-range<T> R> constexpr void push_range(R&& rg);
48
  template<class... Args>
49
+ constexpr decltype(auto) emplace(Args&&... args)
50
  { return c.emplace_back(std::forward<Args>(args)...); }
51
+ constexpr void pop() { c.pop_front(); }
52
+ constexpr void swap(queue& q) noexcept(is_nothrow_swappable_v<Container>)
53
  { using std::swap; swap(c, q.c); }
54
  };
55
 
56
  template<class Container>
57
  queue(Container) -> queue<typename Container::value_type, Container>;
 
81
  ```
82
 
83
  #### Constructors <a id="queue.cons">[[queue.cons]]</a>
84
 
85
  ``` cpp
86
+ constexpr explicit queue(const Container& cont);
87
  ```
88
 
89
  *Effects:* Initializes `c` with `cont`.
90
 
91
  ``` cpp
92
+ constexpr explicit queue(Container&& cont);
93
  ```
94
 
95
  *Effects:* Initializes `c` with `std::move(cont)`.
96
 
97
  ``` cpp
98
  template<class InputIterator>
99
+ constexpr queue(InputIterator first, InputIterator last);
100
  ```
101
 
102
  *Effects:* Initializes `c` with `first` as the first argument and `last`
103
  as the second argument.
104
 
105
  ``` cpp
106
  template<container-compatible-range<T> R>
107
+ constexpr queue(from_range_t, R&& rg);
108
  ```
109
 
110
  *Effects:* Initializes `c` with
111
  `ranges::to<Container>(std::forward<R>(rg))`.
112
 
 
114
 
115
  If `uses_allocator_v<container_type, Alloc>` is `false` the constructors
116
  in this subclause shall not participate in overload resolution.
117
 
118
  ``` cpp
119
+ template<class Alloc> constexpr explicit queue(const Alloc& a);
120
  ```
121
 
122
  *Effects:* Initializes `c` with `a`.
123
 
124
  ``` cpp
125
+ template<class Alloc> constexpr queue(const container_type& cont, const Alloc& a);
126
  ```
127
 
128
  *Effects:* Initializes `c` with `cont` as the first argument and `a` as
129
  the second argument.
130
 
131
  ``` cpp
132
+ template<class Alloc> constexpr queue(container_type&& cont, const Alloc& a);
133
  ```
134
 
135
  *Effects:* Initializes `c` with `std::move(cont)` as the first argument
136
  and `a` as the second argument.
137
 
138
  ``` cpp
139
+ template<class Alloc> constexpr queue(const queue& q, const Alloc& a);
140
  ```
141
 
142
  *Effects:* Initializes `c` with `q.c` as the first argument and `a` as
143
  the second argument.
144
 
145
  ``` cpp
146
+ template<class Alloc> constexpr queue(queue&& q, const Alloc& a);
147
  ```
148
 
149
  *Effects:* Initializes `c` with `std::move(q.c)` as the first argument
150
  and `a` as the second argument.
151
 
152
  ``` cpp
153
  template<class InputIterator, class Alloc>
154
+ constexpr queue(InputIterator first, InputIterator last, const Alloc& alloc);
155
  ```
156
 
157
  *Effects:* Initializes `c` with `first` as the first argument, `last` as
158
  the second argument, and `alloc` as the third argument.
159
 
160
  ``` cpp
161
  template<container-compatible-range<T> R, class Alloc>
162
+ constexpr queue(from_range_t, R&& rg, const Alloc& a);
163
  ```
164
 
165
  *Effects:* Initializes `c` with
166
  `ranges::to<Container>(std::forward<R>(rg), a)`.
167
 
168
  #### Modifiers <a id="queue.mod">[[queue.mod]]</a>
169
 
170
  ``` cpp
171
  template<container-compatible-range<T> R>
172
+ constexpr void push_range(R&& rg);
173
  ```
174
 
175
  *Effects:* Equivalent to `c.append_range(std::forward<R>(rg))` if that
176
  is a valid expression, otherwise `ranges::copy(rg, back_inserter(c))`.
177
 
178
  #### Operators <a id="queue.ops">[[queue.ops]]</a>
179
 
180
  ``` cpp
181
  template<class T, class Container>
182
+ constexpr bool operator==(const queue<T, Container>& x, const queue<T, Container>& y);
183
  ```
184
 
185
  *Returns:* `x.c == y.c`.
186
 
187
  ``` cpp
188
  template<class T, class Container>
189
+ constexpr bool operator!=(const queue<T, Container>& x, const queue<T, Container>& y);
190
  ```
191
 
192
  *Returns:* `x.c != y.c`.
193
 
194
  ``` cpp
195
  template<class T, class Container>
196
+ constexpr bool operator< (const queue<T, Container>& x, const queue<T, Container>& y);
197
  ```
198
 
199
  *Returns:* `x.c < y.c`.
200
 
201
  ``` cpp
202
  template<class T, class Container>
203
+ constexpr bool operator> (const queue<T, Container>& x, const queue<T, Container>& y);
204
  ```
205
 
206
  *Returns:* `x.c > y.c`.
207
 
208
  ``` cpp
209
  template<class T, class Container>
210
+ constexpr bool operator<=(const queue<T, Container>& x, const queue<T, Container>& y);
211
  ```
212
 
213
  *Returns:* `x.c <= y.c`.
214
 
215
  ``` cpp
216
  template<class T, class Container>
217
+ constexpr bool operator>=(const queue<T, Container>& x, const queue<T, Container>& y);
 
218
  ```
219
 
220
  *Returns:* `x.c >= y.c`.
221
 
222
  ``` cpp
223
  template<class T, three_way_comparable Container>
224
+ constexpr compare_three_way_result_t<Container>
225
  operator<=>(const queue<T, Container>& x, const queue<T, Container>& y);
226
  ```
227
 
228
  *Returns:* `x.c <=> y.c`.
229
 
230
  #### Specialized algorithms <a id="queue.special">[[queue.special]]</a>
231
 
232
  ``` cpp
233
  template<class T, class Container>
234
+ constexpr void swap(queue<T, Container>& x, queue<T, Container>& y)
235
+ noexcept(noexcept(x.swap(y)));
236
  ```
237
 
238
  *Constraints:* `is_swappable_v<Container>` is `true`.
239
 
240
  *Effects:* As if by `x.swap(y)`.