blob: 1176602a2b6951d32d90dfbbc4a388edd4c2329e [file] [log] [blame]
Howard Hinnant3e519522010-05-11 19:42:161// -*- C++ -*-
Louis Dionneeb8650a2021-11-17 21:25:012//===----------------------------------------------------------------------===//
Howard Hinnant3e519522010-05-11 19:42:163//
Chandler Carruth57b08b02019-01-19 10:56:404// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Howard Hinnant3e519522010-05-11 19:42:167//
8//===----------------------------------------------------------------------===//
9
10#ifndef _LIBCPP_ALGORITHM
11#define _LIBCPP_ALGORITHM
12
13/*
14 algorithm synopsis
15
16#include <initializer_list>
17
18namespace std
19{
20
Nikolas Klauserd3729bb2022-01-14 01:55:5121namespace ranges {
Konstantin Varlamov79a2b4b2022-06-28 18:59:5922
23 // [algorithms.results], algorithm result types
Nikolas Klauser1e77b392022-02-11 16:01:5824 template <class I, class F>
Mark de Weverde6827b2023-02-24 20:35:4125 struct in_fun_result; // since C++20
Nikolas Klauser1e77b392022-02-11 16:01:5826
Nikolas Klauserd3729bb2022-01-14 01:55:5127 template <class I1, class I2>
Mark de Weverde6827b2023-02-24 20:35:4128 struct in_in_result; // since C++20
Nikolas Klauserf3514af2022-01-25 10:21:4729
Konstantin Varlamov79a2b4b2022-06-28 18:59:5930 template <class I, class O>
Mark de Weverde6827b2023-02-24 20:35:4131 struct in_out_result; // since C++20
Konstantin Varlamov79a2b4b2022-06-28 18:59:5932
Nikolas Klauserf3514af2022-01-25 10:21:4733 template <class I1, class I2, class O>
Mark de Weverde6827b2023-02-24 20:35:4134 struct in_in_out_result; // since C++20
Nikolas Klauser610979b2022-02-03 01:17:0335
36 template <class I, class O1, class O2>
Mark de Weverde6827b2023-02-24 20:35:4137 struct in_out_out_result; // since C++20
Nikolas Klauser1e77b392022-02-11 16:01:5838
Nikolas Klauser807766b2022-02-21 21:48:3639 template <class I1, class I2>
Mark de Weverde6827b2023-02-24 20:35:4140 struct min_max_result; // since C++20
Nikolas Klauser807766b2022-02-21 21:48:3641
Nikolas Klauser68f41312022-02-21 22:07:0242 template <class I>
Mark de Weverde6827b2023-02-24 20:35:4143 struct in_found_result; // since C++20
Nikolas Klauser68f41312022-02-21 22:07:0244
Christopher Di Bella39034382023-12-20 05:57:5045 template <class I, class T>
46 struct in_value_result; // since C++23
47
Nikolas Klauser3b470d12022-02-11 12:11:5748 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
Mark de Weverde6827b2023-02-24 20:35:4149 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> // since C++20
Nikolas Klauser3b470d12022-02-11 12:11:5750 constexpr I min_element(I first, S last, Comp comp = {}, Proj proj = {});
51
52 template<forward_range R, class Proj = identity,
Mark de Weverde6827b2023-02-24 20:35:4153 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> // since C++20
Nikolas Klauser3b470d12022-02-11 12:11:5754 constexpr borrowed_iterator_t<R> min_element(R&& r, Comp comp = {}, Proj proj = {});
Nikolas Klauserc2cd15a2022-03-08 22:12:3555
Nikolas Klauser40f7fca32022-05-22 11:43:3756 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
57 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
Mark de Weverde6827b2023-02-24 20:35:4158 constexpr I ranges::max_element(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser40f7fca32022-05-22 11:43:3759
60 template<forward_range R, class Proj = identity,
61 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
Mark de Weverde6827b2023-02-24 20:35:4162 constexpr borrowed_iterator_t<R> ranges::max_element(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser40f7fca32022-05-22 11:43:3763
Konstantin Varlamov79a2b4b2022-06-28 18:59:5964 template<class I1, class I2>
65 using mismatch_result = in_in_result<I1, I2>;
66
Nikolas Klauserc2cd15a2022-03-08 22:12:3567 template <input_iterator I1, sentinel_for<_I1> S1, input_iterator I2, sentinel_for<_I2> S2,
68 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
69 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
Mark de Weverde6827b2023-02-24 20:35:4170 constexpr mismatch_result<_I1, _I2> // since C++20
71 mismatch()(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {})
Nikolas Klauserc2cd15a2022-03-08 22:12:3572
73 template <input_range R1, input_range R2,
74 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
75 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
76 constexpr mismatch_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
Mark de Weverde6827b2023-02-24 20:35:4177 mismatch(R1&& r1, R2&& r2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}) // since C++20
Nikolas Klauseree0f8c42022-03-12 00:45:3578
Nikolas Klauseree0f8c42022-03-12 00:45:3579 requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
Mark de Weverde6827b2023-02-24 20:35:4180 constexpr I find(I first, S last, const T& value, Proj proj = {}); // since C++20
Nikolas Klauseree0f8c42022-03-12 00:45:3581
82 template<input_range R, class T, class Proj = identity>
83 requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
84 constexpr borrowed_iterator_t<R>
Mark de Weverde6827b2023-02-24 20:35:4185 find(R&& r, const T& value, Proj proj = {}); // since C++20
Nikolas Klauseree0f8c42022-03-12 00:45:3586
87 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
88 indirect_unary_predicate<projected<I, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:4189 constexpr I find_if(I first, S last, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauseree0f8c42022-03-12 00:45:3590
91 template<input_range R, class Proj = identity,
92 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
93 constexpr borrowed_iterator_t<R>
Mark de Weverde6827b2023-02-24 20:35:4194 find_if(R&& r, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauseree0f8c42022-03-12 00:45:3595
96 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
97 indirect_unary_predicate<projected<I, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:4198 constexpr I find_if_not(I first, S last, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauseree0f8c42022-03-12 00:45:3599
100 template<input_range R, class Proj = identity,
101 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
102 constexpr borrowed_iterator_t<R>
Mark de Weverde6827b2023-02-24 20:35:41103 find_if_not(R&& r, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauserf83d8332022-03-18 01:57:08104
Nikolas Klausere476df52022-04-03 07:17:01105 template<class T, class Proj = identity,
106 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
Mark de Weverde6827b2023-02-24 20:35:41107 constexpr const T& min(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauserf83d8332022-03-18 01:57:08108
Nikolas Klausere476df52022-04-03 07:17:01109 template<copyable T, class Proj = identity,
110 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
Mark de Weverde6827b2023-02-24 20:35:41111 constexpr T min(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauserf83d8332022-03-18 01:57:08112
113 template<input_range R, class Proj = identity,
114 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
115 requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
116 constexpr range_value_t<R>
Mark de Weverde6827b2023-02-24 20:35:41117 min(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klausere476df52022-04-03 07:17:01118
119 template<class T, class Proj = identity,
120 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
Mark de Weverde6827b2023-02-24 20:35:41121 constexpr const T& max(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klausere476df52022-04-03 07:17:01122
123 template<copyable T, class Proj = identity,
124 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
Mark de Weverde6827b2023-02-24 20:35:41125 constexpr T max(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klausere476df52022-04-03 07:17:01126
127 template<input_range R, class Proj = identity,
128 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
129 requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
130 constexpr range_value_t<R>
Mark de Weverde6827b2023-02-24 20:35:41131 max(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser3ba85482022-04-05 09:05:36132
133 template<class I, class O>
Mark de Weverde6827b2023-02-24 20:35:41134 using unary_transform_result = in_out_result<I, O>; // since C++20
Nikolas Klauser3ba85482022-04-05 09:05:36135
136 template<class I1, class I2, class O>
Mark de Weverde6827b2023-02-24 20:35:41137 using binary_transform_result = in_in_out_result<I1, I2, O>; // since C++20
Nikolas Klauser3ba85482022-04-05 09:05:36138
139 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O,
140 copy_constructible F, class Proj = identity>
141 requires indirectly_writable<O, indirect_result_t<F&, projected<I, Proj>>>
142 constexpr ranges::unary_transform_result<I, O>
Mark de Weverde6827b2023-02-24 20:35:41143 transform(I first1, S last1, O result, F op, Proj proj = {}); // since C++20
Nikolas Klauser3ba85482022-04-05 09:05:36144
145 template<input_range R, weakly_incrementable O, copy_constructible F,
146 class Proj = identity>
147 requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R>, Proj>>>
148 constexpr ranges::unary_transform_result<borrowed_iterator_t<R>, O>
Mark de Weverde6827b2023-02-24 20:35:41149 transform(R&& r, O result, F op, Proj proj = {}); // since C++20
Nikolas Klauser3ba85482022-04-05 09:05:36150
151 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
152 weakly_incrementable O, copy_constructible F, class Proj1 = identity,
153 class Proj2 = identity>
154 requires indirectly_writable<O, indirect_result_t<F&, projected<I1, Proj1>,
155 projected<I2, Proj2>>>
156 constexpr ranges::binary_transform_result<I1, I2, O>
157 transform(I1 first1, S1 last1, I2 first2, S2 last2, O result,
Mark de Weverde6827b2023-02-24 20:35:41158 F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauser3ba85482022-04-05 09:05:36159
160 template<input_range R1, input_range R2, weakly_incrementable O,
161 copy_constructible F, class Proj1 = identity, class Proj2 = identity>
162 requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R1>, Proj1>,
163 projected<iterator_t<R2>, Proj2>>>
164 constexpr ranges::binary_transform_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
165 transform(R1&& r1, R2&& r2, O result,
Mark de Weverde6827b2023-02-24 20:35:41166 F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauser1306b102022-04-07 11:02:02167
168 template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity>
169 requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
170 constexpr iter_difference_t<I>
Mark de Weverde6827b2023-02-24 20:35:41171 count(I first, S last, const T& value, Proj proj = {}); // since C++20
Nikolas Klauser1306b102022-04-07 11:02:02172
173 template<input_range R, class T, class Proj = identity>
174 requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
175 constexpr range_difference_t<R>
Mark de Weverde6827b2023-02-24 20:35:41176 count(R&& r, const T& value, Proj proj = {}); // since C++20
Nikolas Klauser1306b102022-04-07 11:02:02177
178 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
179 indirect_unary_predicate<projected<I, Proj>> Pred>
180 constexpr iter_difference_t<I>
Mark de Weverde6827b2023-02-24 20:35:41181 count_if(I first, S last, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser1306b102022-04-07 11:02:02182
183 template<input_range R, class Proj = identity,
184 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
185 constexpr range_difference_t<R>
Mark de Weverde6827b2023-02-24 20:35:41186 count_if(R&& r, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser58d9ab72022-04-13 20:59:09187
Konstantin Varlamov79a2b4b2022-06-28 18:59:59188 template<class T>
189 using minmax_result = min_max_result<T>;
190
Nikolas Klauser58d9ab72022-04-13 20:59:09191 template<class T, class Proj = identity,
192 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
193 constexpr ranges::minmax_result<const T&>
Mark de Weverde6827b2023-02-24 20:35:41194 minmax(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser58d9ab72022-04-13 20:59:09195
196 template<copyable T, class Proj = identity,
197 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
198 constexpr ranges::minmax_result<T>
Mark de Weverde6827b2023-02-24 20:35:41199 minmax(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser58d9ab72022-04-13 20:59:09200
201 template<input_range R, class Proj = identity,
202 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
203 requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
204 constexpr ranges::minmax_result<range_value_t<R>>
Mark de Weverde6827b2023-02-24 20:35:41205 minmax(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser58d9ab72022-04-13 20:59:09206
Konstantin Varlamov79a2b4b2022-06-28 18:59:59207 template<class I>
208 using minmax_element_result = min_max_result<I>;
209
Nikolas Klauser58d9ab72022-04-13 20:59:09210 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
211 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
212 constexpr ranges::minmax_element_result<I>
Mark de Weverde6827b2023-02-24 20:35:41213 minmax_element(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser58d9ab72022-04-13 20:59:09214
215 template<forward_range R, class Proj = identity,
216 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
217 constexpr ranges::minmax_element_result<borrowed_iterator_t<R>>
Mark de Weverde6827b2023-02-24 20:35:41218 minmax_element(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser1d837502022-04-15 11:43:40219
220 template<class I, class O>
Mark de Weverde6827b2023-02-24 20:35:41221 using copy_result = in_out_result<I, O>; // since C++20
Nikolas Klauser1d837502022-04-15 11:43:40222
Konstantin Varlamov79a2b4b2022-06-28 18:59:59223 template<class I, class O>
Mark de Weverde6827b2023-02-24 20:35:41224 using copy_n_result = in_out_result<I, O>; // since C++20
Nikolas Klauser1d837502022-04-15 11:43:40225
226 template<class I, class O>
227 using copy_if_result = in_out_result<I, O>; // since C++20
228
229 template<class I1, class I2>
230 using copy_backward_result = in_out_result<I1, I2>; // since C++20
231
ZijunZhaoCCKfdd089b2023-12-20 00:34:19232 template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity>
233 requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
234 constexpr bool ranges::contains(I first, S last, const T& value, Proj proj = {}); // since C++23
235
236 template<input_range R, class T, class Proj = identity>
237 requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
238 constexpr bool ranges::contains(R&& r, const T& value, Proj proj = {}); // since C++23
239
Nikolas Klauser1d837502022-04-15 11:43:40240 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O>
241 requires indirectly_copyable<I, O>
242 constexpr ranges::copy_result<I, O> ranges::copy(I first, S last, O result); // since C++20
243
244 template<input_range R, weakly_incrementable O>
245 requires indirectly_copyable<iterator_t<R>, O>
246 constexpr ranges::copy_result<borrowed_iterator_t<R>, O> ranges::copy(R&& r, O result); // since C++20
247
248 template<input_iterator I, weakly_incrementable O>
249 requires indirectly_copyable<I, O>
250 constexpr ranges::copy_n_result<I, O>
251 ranges::copy_n(I first, iter_difference_t<I> n, O result); // since C++20
252
253 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Proj = identity,
254 indirect_unary_predicate<projected<I, Proj>> Pred>
255 requires indirectly_copyable<I, O>
256 constexpr ranges::copy_if_result<I, O>
257 ranges::copy_if(I first, S last, O result, Pred pred, Proj proj = {}); // since C++20
258
259 template<input_range R, weakly_incrementable O, class Proj = identity,
260 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
261 requires indirectly_copyable<iterator_t<R>, O>
262 constexpr ranges::copy_if_result<borrowed_iterator_t<R>, O>
263 ranges::copy_if(R&& r, O result, Pred pred, Proj proj = {}); // since C++20
264
265 template<bidirectional_iterator I1, sentinel_for<I1> S1, bidirectional_iterator I2>
266 requires indirectly_copyable<I1, I2>
267 constexpr ranges::copy_backward_result<I1, I2>
268 ranges::copy_backward(I1 first, S1 last, I2 result); // since C++20
269
270 template<bidirectional_range R, bidirectional_iterator I>
271 requires indirectly_copyable<iterator_t<R>, I>
272 constexpr ranges::copy_backward_result<borrowed_iterator_t<R>, I>
273 ranges::copy_backward(R&& r, I result); // since C++20
Nikolas Klauser80045e92022-05-04 18:27:07274
275 template<class I, class F>
276 using for_each_result = in_fun_result<I, F>; // since C++20
277
278 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
279 indirectly_unary_invocable<projected<I, Proj>> Fun>
280 constexpr ranges::for_each_result<I, Fun>
281 ranges::for_each(I first, S last, Fun f, Proj proj = {}); // since C++20
282
283 template<input_range R, class Proj = identity,
284 indirectly_unary_invocable<projected<iterator_t<R>, Proj>> Fun>
285 constexpr ranges::for_each_result<borrowed_iterator_t<R>, Fun>
286 ranges::for_each(R&& r, Fun f, Proj proj = {}); // since C++20
287
288 template<input_iterator I, class Proj = identity,
289 indirectly_unary_invocable<projected<I, Proj>> Fun>
290 constexpr ranges::for_each_n_result<I, Fun>
291 ranges::for_each_n(I first, iter_difference_t<I> n, Fun f, Proj proj = {}); // since C++20
Nikolas Klauser37ba1b92022-05-04 12:19:09292
293 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
294 indirect_unary_predicate<projected<I, Proj>> Pred>
295 constexpr bool ranges::is_partitioned(I first, S last, Pred pred, Proj proj = {}); // since C++20
296
297 template<input_range R, class Proj = identity,
298 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
299 constexpr bool ranges::is_partitioned(R&& r, Pred pred, Proj proj = {}); // since C++20
300
Konstantin Varlamovc945bd02022-07-08 20:46:27301 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
302 class Proj = identity>
303 requires sortable<I, Comp, Proj>
304 constexpr I
305 ranges::push_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
306
307 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
308 requires sortable<iterator_t<R>, Comp, Proj>
309 constexpr borrowed_iterator_t<R>
310 ranges::push_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
311
312 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
313 class Proj = identity>
314 requires sortable<I, Comp, Proj>
315 constexpr I
316 ranges::pop_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
317
318 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
319 requires sortable<iterator_t<R>, Comp, Proj>
320 constexpr borrowed_iterator_t<R>
321 ranges::pop_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
322
323 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
324 class Proj = identity>
325 requires sortable<I, Comp, Proj>
326 constexpr I
327 ranges::make_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
328
329 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
330 requires sortable<iterator_t<R>, Comp, Proj>
331 constexpr borrowed_iterator_t<R>
332 ranges::make_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
333
334 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
335 class Proj = identity>
336 requires sortable<I, Comp, Proj>
337 constexpr I
338 ranges::sort_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
339
340 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
341 requires sortable<iterator_t<R>, Comp, Proj>
342 constexpr borrowed_iterator_t<R>
343 ranges::sort_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
344
Konstantin Varlamovd406c642022-07-26 23:11:09345 template<random_access_iterator I, sentinel_for<I> S, class Proj = identity,
346 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
Mark de Weverde6827b2023-02-24 20:35:41347 constexpr bool is_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
Konstantin Varlamovd406c642022-07-26 23:11:09348
349 template<random_access_range R, class Proj = identity,
350 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
Mark de Weverde6827b2023-02-24 20:35:41351 constexpr bool is_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Konstantin Varlamovd406c642022-07-26 23:11:09352
353 template<random_access_iterator I, sentinel_for<I> S, class Proj = identity,
354 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
Mark de Weverde6827b2023-02-24 20:35:41355 constexpr I is_heap_until(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
Konstantin Varlamovd406c642022-07-26 23:11:09356
357 template<random_access_range R, class Proj = identity,
358 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
359 constexpr borrowed_iterator_t<R>
Mark de Weverde6827b2023-02-24 20:35:41360 is_heap_until(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Konstantin Varlamovd406c642022-07-26 23:11:09361
Nikolas Klauser1d1a1912022-05-24 08:32:50362 template<bidirectional_iterator I, sentinel_for<I> S>
363 requires permutable<I>
364 constexpr I ranges::reverse(I first, S last); // since C++20
365
366 template<bidirectional_range R>
367 requires permutable<iterator_t<R>>
368 constexpr borrowed_iterator_t<R> ranges::reverse(R&& r); // since C++20
369
Konstantin Varlamovff3989e2022-06-16 22:20:53370 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
371 class Proj = identity>
372 requires sortable<I, Comp, Proj>
373 constexpr I
Konstantin Varlamov94c7b892022-07-01 23:34:08374 ranges::sort(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
Konstantin Varlamovff3989e2022-06-16 22:20:53375
376 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
377 requires sortable<iterator_t<R>, Comp, Proj>
378 constexpr borrowed_iterator_t<R>
Konstantin Varlamov94c7b892022-07-01 23:34:08379 ranges::sort(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
380
381 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
382 class Proj = identity>
383 requires sortable<I, Comp, Proj>
384 I ranges::stable_sort(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
385
386 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
387 requires sortable<iterator_t<R>, Comp, Proj>
388 borrowed_iterator_t<R>
389 ranges::stable_sort(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Konstantin Varlamovff3989e2022-06-16 22:20:53390
varconst5dd19ad2022-07-20 03:10:02391 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
392 class Proj = identity>
393 requires sortable<I, Comp, Proj>
394 constexpr I
395 ranges::partial_sort(I first, I middle, S last, Comp comp = {}, Proj proj = {}); // since C++20
396
397 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
398 requires sortable<iterator_t<R>, Comp, Proj>
399 constexpr borrowed_iterator_t<R>
400 ranges::partial_sort(R&& r, iterator_t<R> middle, Comp comp = {}, Proj proj = {}); // since C++20
401
Nikolas Klauser7af89a32022-05-21 16:26:29402 template<class T, output_iterator<const T&> O, sentinel_for<O> S>
403 constexpr O ranges::fill(O first, S last, const T& value); // since C++20
404
405 template<class T, output_range<const T&> R>
406 constexpr borrowed_iterator_t<R> ranges::fill(R&& r, const T& value); // since C++20
407
408 template<class T, output_iterator<const T&> O>
409 constexpr O ranges::fill_n(O first, iter_difference_t<O> n, const T& value); // since C++20
Nikolas Klauser569d6632022-05-25 09:09:43410
Konstantin Varlamovead73022022-07-26 22:50:14411 template<input_or_output_iterator O, sentinel_for<O> S, copy_constructible F>
412 requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>>
Mark de Weverde6827b2023-02-24 20:35:41413 constexpr O generate(O first, S last, F gen); // since C++20
Konstantin Varlamovead73022022-07-26 22:50:14414
Nikolas Klausercd916102023-06-09 20:45:34415 template<class ExecutionPolicy, class ForwardIterator, class Generator>
416 void generate(ExecutionPolicy&& exec,
417 ForwardIterator first, ForwardIterator last,
418 Generator gen); // since C++17
419
Konstantin Varlamovead73022022-07-26 22:50:14420 template<class R, copy_constructible F>
421 requires invocable<F&> && output_range<R, invoke_result_t<F&>>
Mark de Weverde6827b2023-02-24 20:35:41422 constexpr borrowed_iterator_t<R> generate(R&& r, F gen); // since C++20
Konstantin Varlamovead73022022-07-26 22:50:14423
424 template<input_or_output_iterator O, copy_constructible F>
425 requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>>
Mark de Weverde6827b2023-02-24 20:35:41426 constexpr O generate_n(O first, iter_difference_t<O> n, F gen); // since C++20
Konstantin Varlamovead73022022-07-26 22:50:14427
Nikolas Klausercd916102023-06-09 20:45:34428 template<class ExecutionPolicy, class ForwardIterator, class Size, class Generator>
429 ForwardIterator generate_n(ExecutionPolicy&& exec,
430 ForwardIterator first, Size n, Generator gen); // since C++17
431
Nikolas Klauser569d6632022-05-25 09:09:43432 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
433 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
434 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
435 constexpr bool ranges::equal(I1 first1, S1 last1, I2 first2, S2 last2,
436 Pred pred = {},
437 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
438
439 template<input_range R1, input_range R2, class Pred = ranges::equal_to,
440 class Proj1 = identity, class Proj2 = identity>
441 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
442 constexpr bool ranges::equal(R1&& r1, R2&& r2, Pred pred = {},
443 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
444
Nikolas Klauser0e3dc1a2022-05-26 14:42:46445 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
446 indirect_unary_predicate<projected<I, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:41447 constexpr bool ranges::all_of(I first, S last, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser0e3dc1a2022-05-26 14:42:46448
449 template<input_range R, class Proj = identity,
450 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:41451 constexpr bool ranges::all_of(R&& r, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser0e3dc1a2022-05-26 14:42:46452
453 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
454 indirect_unary_predicate<projected<I, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:41455 constexpr bool ranges::any_of(I first, S last, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser0e3dc1a2022-05-26 14:42:46456
457 template<input_range R, class Proj = identity,
458 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:41459 constexpr bool ranges::any_of(R&& r, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser0e3dc1a2022-05-26 14:42:46460
Zijun Zhao0218ea42023-09-18 18:28:11461 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
462 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
463 requires (forward_iterator<I1> || sized_sentinel_for<S1, I1>) &&
464 (forward_iterator<I2> || sized_sentinel_for<S2, I2>) &&
465 indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
466 constexpr bool ranges::ends_with(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
467 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23
468
469 template<input_range R1, input_range R2, class Pred = ranges::equal_to, class Proj1 = identity,
470 class Proj2 = identity>
471 requires (forward_range<R1> || sized_range<R1>) &&
472 (forward_range<R2> || sized_range<R2>) &&
473 indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
474 constexpr bool ranges::ends_with(R1&& r1, R2&& r2, Pred pred = {},
475 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23
476
Nikolas Klauser0e3dc1a2022-05-26 14:42:46477 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
478 indirect_unary_predicate<projected<I, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:41479 constexpr bool ranges::none_of(I first, S last, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser0e3dc1a2022-05-26 14:42:46480
481 template<input_range R, class Proj = identity,
482 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:41483 constexpr bool ranges::none_of(R&& r, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser0e3dc1a2022-05-26 14:42:46484
zijunzhao20517552023-05-08 22:04:00485 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
486 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
487 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
488 constexpr bool ranges::starts_with(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
489 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23
490
491 template<input_range R1, input_range R2, class Pred = ranges::equal_to, class Proj1 = identity,
492 class Proj2 = identity>
493 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
494 constexpr bool ranges::starts_with(R1&& r1, R2&& r2, Pred pred = {},
495 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23
496
Konstantin Varlamovdb7d7952022-07-30 09:42:05497 template<input_iterator I1, sentinel_for<I1> S1,
498 random_access_iterator I2, sentinel_for<I2> S2,
499 class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
500 requires indirectly_copyable<I1, I2> && sortable<I2, Comp, Proj2> &&
501 indirect_strict_weak_order<Comp, projected<I1, Proj1>, projected<I2, Proj2>>
502 constexpr partial_sort_copy_result<I1, I2>
503 partial_sort_copy(I1 first, S1 last, I2 result_first, S2 result_last,
Mark de Weverde6827b2023-02-24 20:35:41504 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Konstantin Varlamovdb7d7952022-07-30 09:42:05505
506 template<input_range R1, random_access_range R2, class Comp = ranges::less,
507 class Proj1 = identity, class Proj2 = identity>
508 requires indirectly_copyable<iterator_t<R1>, iterator_t<R2>> &&
509 sortable<iterator_t<R2>, Comp, Proj2> &&
510 indirect_strict_weak_order<Comp, projected<iterator_t<R1>, Proj1>,
511 projected<iterator_t<R2>, Proj2>>
512 constexpr partial_sort_copy_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
513 partial_sort_copy(R1&& r, R2&& result_r, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:41514 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Konstantin Varlamovdb7d7952022-07-30 09:42:05515
Nikolas Klauser11e3ad22022-05-26 14:08:55516 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
517 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
518 constexpr bool ranges::is_sorted(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
519
520 template<forward_range R, class Proj = identity,
521 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
522 constexpr bool ranges::is_sorted(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
523
524 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
525 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
526 constexpr I ranges::is_sorted_until(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
527
528 template<forward_range R, class Proj = identity,
529 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
530 constexpr borrowed_iterator_t<R>
531 ranges::is_sorted_until(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser81715862022-06-05 19:15:16532
Konstantin Varlamov23c73282022-07-08 03:35:51533 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
534 class Proj = identity>
535 requires sortable<I, Comp, Proj>
536 constexpr I
Mark de Weverde6827b2023-02-24 20:35:41537 ranges::nth_element(I first, I nth, S last, Comp comp = {}, Proj proj = {}); // since C++20
Konstantin Varlamov23c73282022-07-08 03:35:51538
539 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
540 requires sortable<iterator_t<R>, Comp, Proj>
541 constexpr borrowed_iterator_t<R>
Mark de Weverde6827b2023-02-24 20:35:41542 ranges::nth_element(R&& r, iterator_t<R> nth, Comp comp = {}, Proj proj = {}); // since C++20
Konstantin Varlamov23c73282022-07-08 03:35:51543
Nikolas Klauser81715862022-06-05 19:15:16544 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
Mark de Weverde6827b2023-02-24 20:35:41545 indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less> // since C++20
546 constexpr I upper_bound(I first, S last, const T& value, Comp comp = {}, Proj proj = {});
Nikolas Klauser81715862022-06-05 19:15:16547
548 template<forward_range R, class T, class Proj = identity,
549 indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
550 ranges::less>
551 constexpr borrowed_iterator_t<R>
Mark de Weverde6827b2023-02-24 20:35:41552 upper_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser81715862022-06-05 19:15:16553
554 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
555 indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
556 constexpr I lower_bound(I first, S last, const T& value, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:41557 Proj proj = {}); // since C++20
Nikolas Klauser81715862022-06-05 19:15:16558 template<forward_range R, class T, class Proj = identity,
559 indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
560 ranges::less>
561 constexpr borrowed_iterator_t<R>
Mark de Weverde6827b2023-02-24 20:35:41562 lower_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser81715862022-06-05 19:15:16563
564 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
565 indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
566 constexpr bool binary_search(I first, S last, const T& value, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:41567 Proj proj = {}); // since C++20
Nikolas Klauserb79b2b62022-06-06 11:57:34568
Nikolas Klauser81715862022-06-05 19:15:16569 template<forward_range R, class T, class Proj = identity,
570 indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
571 ranges::less>
572 constexpr bool binary_search(R&& r, const T& value, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:41573 Proj proj = {}); // since C++20
Konstantin Varlamov8ed702b2022-07-19 04:05:51574
575 template<permutable I, sentinel_for<I> S, class Proj = identity,
576 indirect_unary_predicate<projected<I, Proj>> Pred>
577 constexpr subrange<I>
Mark de Weverde6827b2023-02-24 20:35:41578 partition(I first, S last, Pred pred, Proj proj = {}); // since C++20
Konstantin Varlamov8ed702b2022-07-19 04:05:51579
580 template<forward_range R, class Proj = identity,
581 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
582 requires permutable<iterator_t<R>>
583 constexpr borrowed_subrange_t<R>
Mark de Weverde6827b2023-02-24 20:35:41584 partition(R&& r, Pred pred, Proj proj = {}); // since C++20
Konstantin Varlamov8ed702b2022-07-19 04:05:51585
586 template<bidirectional_iterator I, sentinel_for<I> S, class Proj = identity,
587 indirect_unary_predicate<projected<I, Proj>> Pred>
588 requires permutable<I>
Mark de Weverde6827b2023-02-24 20:35:41589 subrange<I> stable_partition(I first, S last, Pred pred, Proj proj = {}); // since C++20
Konstantin Varlamov8ed702b2022-07-19 04:05:51590
591 template<bidirectional_range R, class Proj = identity,
592 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
593 requires permutable<iterator_t<R>>
Mark de Weverde6827b2023-02-24 20:35:41594 borrowed_subrange_t<R> stable_partition(R&& r, Pred pred, Proj proj = {}); // since C++20
Konstantin Varlamov8ed702b2022-07-19 04:05:51595
Nikolas Klauserb79b2b62022-06-06 11:57:34596 template<input_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2,
597 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
598 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
599 constexpr I1 ranges::find_first_of(I1 first1, S1 last1, I2 first2, S2 last2,
600 Pred pred = {},
601 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
602
603 template<input_range R1, forward_range R2,
604 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
605 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
606 constexpr borrowed_iterator_t<R1>
607 ranges::find_first_of(R1&& r1, R2&& r2,
608 Pred pred = {},
609 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauser81715862022-06-05 19:15:16610
Nikolas Klauser916e9052022-06-08 10:14:12611 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
612 indirect_binary_predicate<projected<I, Proj>,
613 projected<I, Proj>> Pred = ranges::equal_to>
Mark de Weverde6827b2023-02-24 20:35:41614 constexpr I ranges::adjacent_find(I first, S last, Pred pred = {}, Proj proj = {}); // since C++20
Nikolas Klauser916e9052022-06-08 10:14:12615
616 template<forward_range R, class Proj = identity,
617 indirect_binary_predicate<projected<iterator_t<R>, Proj>,
618 projected<iterator_t<R>, Proj>> Pred = ranges::equal_to>
619 constexpr borrowed_iterator_t<R> ranges::adjacent_find(R&& r, Pred pred = {}, Proj proj = {}); // since C++20
620
Nikolas Klauserff6d5de2022-06-07 07:42:10621 template<input_iterator I, sentinel_for<I> S, class T1, class T2, class Proj = identity>
622 requires indirectly_writable<I, const T2&> &&
623 indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*>
624 constexpr I
625 ranges::replace(I first, S last, const T1& old_value, const T2& new_value, Proj proj = {}); // since C++20
626
627 template<input_range R, class T1, class T2, class Proj = identity>
628 requires indirectly_writable<iterator_t<R>, const T2&> &&
629 indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T1*>
630 constexpr borrowed_iterator_t<R>
631 ranges::replace(R&& r, const T1& old_value, const T2& new_value, Proj proj = {}); // since C++20
632
633 template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity,
634 indirect_unary_predicate<projected<I, Proj>> Pred>
635 requires indirectly_writable<I, const T&>
636 constexpr I ranges::replace_if(I first, S last, Pred pred, const T& new_value, Proj proj = {}); // since C++20
637
638 template<input_range R, class T, class Proj = identity,
639 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
640 requires indirectly_writable<iterator_t<R>, const T&>
641 constexpr borrowed_iterator_t<R>
642 ranges::replace_if(R&& r, Pred pred, const T& new_value, Proj proj = {}); // since C++20
643
Nikolas Klausera203acb2022-08-03 23:30:50644 template<class T, class Proj = identity,
645 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
646 constexpr const T&
647 ranges::clamp(const T& v, const T& lo, const T& hi, Comp comp = {}, Proj proj = {}); // since C++20
648
Nikolas Klauserafd5a4f2022-06-15 14:24:43649 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
650 class Proj1 = identity, class Proj2 = identity,
651 indirect_strict_weak_order<projected<I1, Proj1>,
652 projected<I2, Proj2>> Comp = ranges::less>
653 constexpr bool
654 ranges::lexicographical_compare(I1 first1, S1 last1, I2 first2, S2 last2,
Mark de Weverde6827b2023-02-24 20:35:41655 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauserafd5a4f2022-06-15 14:24:43656
657 template<input_range R1, input_range R2, class Proj1 = identity,
658 class Proj2 = identity,
659 indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>,
660 projected<iterator_t<R2>, Proj2>> Comp = ranges::less>
661 constexpr bool
662 ranges::lexicographical_compare(R1&& r1, R2&& r2, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:41663 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauserafd5a4f2022-06-15 14:24:43664
Nikolas Klauser2c3bbac2022-06-23 10:23:41665 template<bidirectional_iterator I1, sentinel_for<I1> S1, bidirectional_iterator I2>
666 requires indirectly_movable<I1, I2>
667 constexpr ranges::move_backward_result<I1, I2>
668 ranges::move_backward(I1 first, S1 last, I2 result); // since C++20
669
670 template<bidirectional_range R, bidirectional_iterator I>
671 requires indirectly_movable<iterator_t<R>, I>
672 constexpr ranges::move_backward_result<borrowed_iterator_t<R>, I>
673 ranges::move_backward(R&& r, I result); // since C++20
674
675 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O>
676 requires indirectly_movable<I, O>
677 constexpr ranges::move_result<I, O>
678 ranges::move(I first, S last, O result); // since C++20
679
680 template<input_range R, weakly_incrementable O>
681 requires indirectly_movable<iterator_t<R>, O>
682 constexpr ranges::move_result<borrowed_iterator_t<R>, O>
683 ranges::move(R&& r, O result); // since C++20
684
Konstantin Varlamov065202f2022-07-20 08:57:13685 template<class I, class O1, class O2>
686 using partition_copy_result = in_out_out_result<I, O1, O2>; // since C++20
687
688 template<input_iterator I, sentinel_for<I> S,
689 weakly_incrementable O1, weakly_incrementable O2,
690 class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
691 requires indirectly_copyable<I, O1> && indirectly_copyable<I, O2>
692 constexpr partition_copy_result<I, O1, O2>
693 partition_copy(I first, S last, O1 out_true, O2 out_false, Pred pred,
Mark de Weverde6827b2023-02-24 20:35:41694 Proj proj = {}); // since C++20
Konstantin Varlamov065202f2022-07-20 08:57:13695
696 template<input_range R, weakly_incrementable O1, weakly_incrementable O2,
697 class Proj = identity,
698 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
699 requires indirectly_copyable<iterator_t<R>, O1> &&
700 indirectly_copyable<iterator_t<R>, O2>
701 constexpr partition_copy_result<borrowed_iterator_t<R>, O1, O2>
Mark de Weverde6827b2023-02-24 20:35:41702 partition_copy(R&& r, O1 out_true, O2 out_false, Pred pred, Proj proj = {}); // since C++20
Konstantin Varlamov065202f2022-07-20 08:57:13703
704 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
705 indirect_unary_predicate<projected<I, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:41706 constexpr I partition_point(I first, S last, Pred pred, Proj proj = {}); // since C++20
Konstantin Varlamov065202f2022-07-20 08:57:13707
708 template<forward_range R, class Proj = identity,
709 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
710 constexpr borrowed_iterator_t<R>
Mark de Weverde6827b2023-02-24 20:35:41711 partition_point(R&& r, Pred pred, Proj proj = {}); // since C++20
Konstantin Varlamov065202f2022-07-20 08:57:13712
Hui Xie25607d12022-06-26 15:13:43713 template<class I1, class I2, class O>
714 using merge_result = in_in_out_result<I1, I2, O>; // since C++20
715
716 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
717 weakly_incrementable O, class Comp = ranges::less, class Proj1 = identity,
718 class Proj2 = identity>
719 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
720 constexpr merge_result<I1, I2, O>
721 merge(I1 first1, S1 last1, I2 first2, S2 last2, O result,
722 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
723
724 template<input_range R1, input_range R2, weakly_incrementable O, class Comp = ranges::less,
725 class Proj1 = identity, class Proj2 = identity>
726 requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
727 constexpr merge_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
728 merge(R1&& r1, R2&& r2, O result,
729 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauser2c3bbac2022-06-23 10:23:41730
Nikolas Klauserf8cbe3cdf2022-07-06 12:03:00731 template<permutable I, sentinel_for<I> S, class T, class Proj = identity>
732 requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
733 constexpr subrange<I> ranges::remove(I first, S last, const T& value, Proj proj = {}); // since C++20
734
735 template<forward_range R, class T, class Proj = identity>
736 requires permutable<iterator_t<R>> &&
737 indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
738 constexpr borrowed_subrange_t<R>
739 ranges::remove(R&& r, const T& value, Proj proj = {}); // since C++20
740
741 template<permutable I, sentinel_for<I> S, class Proj = identity,
742 indirect_unary_predicate<projected<I, Proj>> Pred>
743 constexpr subrange<I> ranges::remove_if(I first, S last, Pred pred, Proj proj = {}); // since C++20
744
745 template<forward_range R, class Proj = identity,
746 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
747 requires permutable<iterator_t<R>>
748 constexpr borrowed_subrange_t<R>
749 ranges::remove_if(R&& r, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser7d426a32022-07-11 15:07:35750
Hui Xie1cdec6c2022-06-26 15:13:43751 template<class I, class O>
Nikolas Klauser7d426a32022-07-11 15:07:35752 using set_difference_result = in_out_result<I, O>; // since C++20
Hui Xie1cdec6c2022-06-26 15:13:43753
754 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
755 weakly_incrementable O, class Comp = ranges::less,
756 class Proj1 = identity, class Proj2 = identity>
757 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
758 constexpr set_difference_result<I1, O>
759 set_difference(I1 first1, S1 last1, I2 first2, S2 last2, O result,
760 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
761
762 template<input_range R1, input_range R2, weakly_incrementable O,
763 class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
764 requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
765 constexpr set_difference_result<borrowed_iterator_t<R1>, O>
766 set_difference(R1&& r1, R2&& r2, O result,
767 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauserf8cbe3cdf2022-07-06 12:03:00768
Hui Xie96b674f2022-07-08 14:21:40769 template<class I1, class I2, class O>
770 using set_intersection_result = in_in_out_result<I1, I2, O>; // since C++20
771
772 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
773 weakly_incrementable O, class Comp = ranges::less,
774 class Proj1 = identity, class Proj2 = identity>
775 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
776 constexpr set_intersection_result<I1, I2, O>
777 set_intersection(I1 first1, S1 last1, I2 first2, S2 last2, O result,
778 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
779
780 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
781 weakly_incrementable O, class Comp = ranges::less,
782 class Proj1 = identity, class Proj2 = identity>
783 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
784 constexpr set_intersection_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
785 set_intersection(R1&& r1, R2&& r2, O result,
786 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
787
Nikolas Klauser7d426a32022-07-11 15:07:35788 template <class _InIter, class _OutIter>
789 using reverse_copy_result = in_out_result<_InIter, _OutIter>; // since C++20
790
791 template<bidirectional_iterator I, sentinel_for<I> S, weakly_incrementable O>
792 requires indirectly_copyable<I, O>
793 constexpr ranges::reverse_copy_result<I, O>
794 ranges::reverse_copy(I first, S last, O result); // since C++20
795
796 template<bidirectional_range R, weakly_incrementable O>
797 requires indirectly_copyable<iterator_t<R>, O>
798 constexpr ranges::reverse_copy_result<borrowed_iterator_t<R>, O>
799 ranges::reverse_copy(R&& r, O result); // since C++20
800
Konstantin Varlamov36c746c2022-08-03 23:04:14801 template<permutable I, sentinel_for<I> S>
802 constexpr subrange<I> rotate(I first, I middle, S last); // since C++20
803
804 template<forward_range R>
805 requires permutable<iterator_t<R>>
Mark de Weverde6827b2023-02-24 20:35:41806 constexpr borrowed_subrange_t<R> rotate(R&& r, iterator_t<R> middle); // since C++20
Konstantin Varlamov36c746c2022-08-03 23:04:14807
Nikolas Klauser7d426a32022-07-11 15:07:35808 template <class _InIter, class _OutIter>
809 using rotate_copy_result = in_out_result<_InIter, _OutIter>; // since C++20
810
811 template<forward_iterator I, sentinel_for<I> S, weakly_incrementable O>
812 requires indirectly_copyable<I, O>
813 constexpr ranges::rotate_copy_result<I, O>
814 ranges::rotate_copy(I first, I middle, S last, O result); // since C++20
815
816 template<forward_range R, weakly_incrementable O>
817 requires indirectly_copyable<iterator_t<R>, O>
818 constexpr ranges::rotate_copy_result<borrowed_iterator_t<R>, O>
819 ranges::rotate_copy(R&& r, iterator_t<R> middle, O result); // since C++20
820
Konstantin Varlamov6bdb6422022-08-03 05:33:12821 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Gen>
822 requires (forward_iterator<I> || random_access_iterator<O>) &&
823 indirectly_copyable<I, O> &&
824 uniform_random_bit_generator<remove_reference_t<Gen>>
Mark de Weverde6827b2023-02-24 20:35:41825 O sample(I first, S last, O out, iter_difference_t<I> n, Gen&& g); // since C++20
Konstantin Varlamov6bdb6422022-08-03 05:33:12826
827 template<input_range R, weakly_incrementable O, class Gen>
828 requires (forward_range<R> || random_access_iterator<O>) &&
829 indirectly_copyable<iterator_t<R>, O> &&
830 uniform_random_bit_generator<remove_reference_t<Gen>>
Mark de Weverde6827b2023-02-24 20:35:41831 O sample(R&& r, O out, range_difference_t<R> n, Gen&& g); // since C++20
Konstantin Varlamov6bdb6422022-08-03 05:33:12832
Konstantin Varlamov14cf74d2022-07-22 16:58:56833 template<random_access_iterator I, sentinel_for<I> S, class Gen>
834 requires permutable<I> &&
835 uniform_random_bit_generator<remove_reference_t<Gen>>
Mark de Weverde6827b2023-02-24 20:35:41836 I shuffle(I first, S last, Gen&& g); // since C++20
Konstantin Varlamov14cf74d2022-07-22 16:58:56837
838 template<random_access_range R, class Gen>
839 requires permutable<iterator_t<R>> &&
840 uniform_random_bit_generator<remove_reference_t<Gen>>
Mark de Weverde6827b2023-02-24 20:35:41841 borrowed_iterator_t<R> shuffle(R&& r, Gen&& g); // since C++20
Konstantin Varlamov14cf74d2022-07-22 16:58:56842
Nikolas Klauser101d1e92022-07-13 16:07:26843 template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2,
Nikolas Klauser4038c852022-08-04 17:54:13844 sentinel_for<I2> S2, class Proj1 = identity, class Proj2 = identity,
845 indirect_equivalence_relation<projected<I1, Proj1>,
846 projected<I2, Proj2>> Pred = ranges::equal_to>
847 constexpr bool ranges::is_permutation(I1 first1, S1 last1, I2 first2, S2 last2,
848 Pred pred = {},
Mark de Weverde6827b2023-02-24 20:35:41849 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauser4038c852022-08-04 17:54:13850
851 template<forward_range R1, forward_range R2,
852 class Proj1 = identity, class Proj2 = identity,
853 indirect_equivalence_relation<projected<iterator_t<R1>, Proj1>,
854 projected<iterator_t<R2>, Proj2>> Pred = ranges::equal_to>
855 constexpr bool ranges::is_permutation(R1&& r1, R2&& r2, Pred pred = {},
Mark de Weverde6827b2023-02-24 20:35:41856 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauser4038c852022-08-04 17:54:13857
858 template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2,
Nikolas Klauser101d1e92022-07-13 16:07:26859 sentinel_for<I2> S2, class Pred = ranges::equal_to,
860 class Proj1 = identity, class Proj2 = identity>
861 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
862 constexpr subrange<I1>
863 ranges::search(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
864 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
865
866 template<forward_range R1, forward_range R2, class Pred = ranges::equal_to,
867 class Proj1 = identity, class Proj2 = identity>
868 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
869 constexpr borrowed_subrange_t<R1>
870 ranges::search(R1&& r1, R2&& r2, Pred pred = {},
871 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
872
873 template<forward_iterator I, sentinel_for<I> S, class T,
874 class Pred = ranges::equal_to, class Proj = identity>
875 requires indirectly_comparable<I, const T*, Pred, Proj>
876 constexpr subrange<I>
877 ranges::search_n(I first, S last, iter_difference_t<I> count,
878 const T& value, Pred pred = {}, Proj proj = {}); // since C++20
879
880 template<forward_range R, class T, class Pred = ranges::equal_to,
881 class Proj = identity>
882 requires indirectly_comparable<iterator_t<R>, const T*, Pred, Proj>
883 constexpr borrowed_subrange_t<R>
884 ranges::search_n(R&& r, range_difference_t<R> count,
885 const T& value, Pred pred = {}, Proj proj = {}); // since C++20
886
Christopher Di Bella39034382023-12-20 05:57:50887 template<input_iterator I, sentinel_for<I> S, class T,
888 indirectly-binary-left-foldable<T, I> F>
889 constexpr auto ranges::fold_left(I first, S last, T init, F f); // since C++23
890
891 template<input_range R, class T, indirectly-binary-left-foldable<T, iterator_t<R>> F>
892 constexpr auto fold_left(R&& r, T init, F f); // since C++23
893
894 template<class I, class T>
895 using fold_left_with_iter_result = in_value_result<I, T>; // since C++23
896
897 template<input_iterator I, sentinel_for<I> S, class T,
898 indirectly-binary-left-foldable<T, I> F>
899 constexpr see below fold_left_with_iter(I first, S last, T init, F f); // since C++23
900
901 template<input_range R, class T, indirectly-binary-left-foldable<T, iterator_t<R>> F>
902 constexpr see below fold_left_with_iter(R&& r, T init, F f); // since C++23
903
Nikolas Klauser101d1e92022-07-13 16:07:26904 template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2,
905 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
906 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
907 constexpr subrange<I1>
908 ranges::find_end(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
909 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
910
911 template<forward_range R1, forward_range R2,
912 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
913 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
914 constexpr borrowed_subrange_t<R1>
915 ranges::find_end(R1&& r1, R2&& r2, Pred pred = {},
916 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
917
Hui Xiea5c06382022-07-11 22:39:59918 template<class I1, class I2, class O>
919 using set_symmetric_difference_result = in_in_out_result<I1, I2, O>; // since C++20
920
921 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
922 weakly_incrementable O, class Comp = ranges::less,
923 class Proj1 = identity, class Proj2 = identity>
924 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
925 constexpr set_symmetric_difference_result<I1, I2, O>
926 set_symmetric_difference(I1 first1, S1 last1, I2 first2, S2 last2, O result,
927 Comp comp = {}, Proj1 proj1 = {},
928 Proj2 proj2 = {}); // since C++20
Hui Xie8a617492022-07-27 12:20:16929
Hui Xiea5c06382022-07-11 22:39:59930 template<input_range R1, input_range R2, weakly_incrementable O,
931 class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
932 requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
933 constexpr set_symmetric_difference_result<borrowed_iterator_t<R1>,
934 borrowed_iterator_t<R2>, O>
935 set_symmetric_difference(R1&& r1, R2&& r2, O result, Comp comp = {},
936 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Hui Xie0f6364b82022-07-14 19:35:15937
938 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
939 indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
940 constexpr subrange<I>
941 equal_range(I first, S last, const T& value, Comp comp = {}, Proj proj = {}); // since C++20
Hui Xie8a617492022-07-27 12:20:16942
Hui Xie0f6364b82022-07-14 19:35:15943 template<forward_range R, class T, class Proj = identity,
944 indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
945 ranges::less>
946 constexpr borrowed_subrange_t<R>
947 equal_range(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20
Hui Xie8a617492022-07-27 12:20:16948
Hui Xie3151b952022-07-13 16:20:22949 template<class I1, class I2, class O>
950 using set_union_result = in_in_out_result<I1, I2, O>; // since C++20
951
952 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
953 weakly_incrementable O, class Comp = ranges::less,
954 class Proj1 = identity, class Proj2 = identity>
955 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
956 constexpr set_union_result<I1, I2, O>
957 set_union(I1 first1, S1 last1, I2 first2, S2 last2, O result, Comp comp = {},
958 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
959
960 template<input_range R1, input_range R2, weakly_incrementable O,
961 class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
962 requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
963 constexpr set_union_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
964 set_union(R1&& r1, R2&& r2, O result, Comp comp = {},
965 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Hui Xiec5599642022-07-19 19:54:35966
967 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
968 class Proj1 = identity, class Proj2 = identity,
969 indirect_strict_weak_order<projected<I1, Proj1>, projected<I2, Proj2>> Comp =
970 ranges::less>
971 constexpr bool includes(I1 first1, S1 last1, I2 first2, S2 last2, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:41972 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Hui Xie8a617492022-07-27 12:20:16973
Hui Xiec5599642022-07-19 19:54:35974 template<input_range R1, input_range R2, class Proj1 = identity,
975 class Proj2 = identity,
976 indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>,
977 projected<iterator_t<R2>, Proj2>> Comp = ranges::less>
978 constexpr bool includes(R1&& r1, R2&& r2, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:41979 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Hui Xie8a617492022-07-27 12:20:16980
981 template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
982 class Proj = identity>
983 requires sortable<I, Comp, Proj>
Mark de Weverde6827b2023-02-24 20:35:41984 I inplace_merge(I first, I middle, S last, Comp comp = {}, Proj proj = {}); // since C++20
Hui Xie8a617492022-07-27 12:20:16985
986 template<bidirectional_range R, class Comp = ranges::less, class Proj = identity>
987 requires sortable<iterator_t<R>, Comp, Proj>
988 borrowed_iterator_t<R>
989 inplace_merge(R&& r, iterator_t<R> middle, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:41990 Proj proj = {}); // since C++20
Hui Xie72f57e32022-07-23 00:44:25991
992 template<permutable I, sentinel_for<I> S, class Proj = identity,
993 indirect_equivalence_relation<projected<I, Proj>> C = ranges::equal_to>
Mark de Weverde6827b2023-02-24 20:35:41994 constexpr subrange<I> unique(I first, S last, C comp = {}, Proj proj = {}); // since C++20
Hui Xie72f57e32022-07-23 00:44:25995
996 template<forward_range R, class Proj = identity,
997 indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to>
998 requires permutable<iterator_t<R>>
999 constexpr borrowed_subrange_t<R>
Mark de Weverde6827b2023-02-24 20:35:411000 unique(R&& r, C comp = {}, Proj proj = {}); // since C++20
Hui Xie72f57e32022-07-23 00:44:251001
1002 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Proj = identity,
1003 indirect_equivalence_relation<projected<I, Proj>> C = ranges::equal_to>
1004 requires indirectly_copyable<I, O> &&
1005 (forward_iterator<I> ||
1006 (input_iterator<O> && same_as<iter_value_t<I>, iter_value_t<O>>) ||
1007 indirectly_copyable_storable<I, O>)
1008 constexpr unique_copy_result<I, O>
Mark de Weverde6827b2023-02-24 20:35:411009 unique_copy(I first, S last, O result, C comp = {}, Proj proj = {}); // since C++20
Hui Xie72f57e32022-07-23 00:44:251010
1011 template<input_range R, weakly_incrementable O, class Proj = identity,
1012 indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to>
1013 requires indirectly_copyable<iterator_t<R>, O> &&
1014 (forward_iterator<iterator_t<R>> ||
1015 (input_iterator<O> && same_as<range_value_t<R>, iter_value_t<O>>) ||
1016 indirectly_copyable_storable<iterator_t<R>, O>)
1017 constexpr unique_copy_result<borrowed_iterator_t<R>, O>
Mark de Weverde6827b2023-02-24 20:35:411018 unique_copy(R&& r, O result, C comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591019
1020 template<class I, class O>
Mark de Weverde6827b2023-02-24 20:35:411021 using remove_copy_result = in_out_result<I, O>; // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591022
1023 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class T,
1024 class Proj = identity>
1025 indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
1026 constexpr remove_copy_result<I, O>
Mark de Weverde6827b2023-02-24 20:35:411027 remove_copy(I first, S last, O result, const T& value, Proj proj = {}); // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591028
1029 template<input_range R, weakly_incrementable O, class T, class Proj = identity>
1030 requires indirectly_copyable<iterator_t<R>, O> &&
1031 indirect_binary_predicate<ranges::equal_to,
1032 projected<iterator_t<R>, Proj>, const T*>
1033 constexpr remove_copy_result<borrowed_iterator_t<R>, O>
Mark de Weverde6827b2023-02-24 20:35:411034 remove_copy(R&& r, O result, const T& value, Proj proj = {}); // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591035
1036 template<class I, class O>
Mark de Weverde6827b2023-02-24 20:35:411037 using remove_copy_if_result = in_out_result<I, O>; // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591038
1039 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O,
1040 class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
1041 requires indirectly_copyable<I, O>
1042 constexpr remove_copy_if_result<I, O>
Mark de Weverde6827b2023-02-24 20:35:411043 remove_copy_if(I first, S last, O result, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591044
1045 template<input_range R, weakly_incrementable O, class Proj = identity,
1046 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
1047 requires indirectly_copyable<iterator_t<R>, O>
1048 constexpr remove_copy_if_result<borrowed_iterator_t<R>, O>
Mark de Weverde6827b2023-02-24 20:35:411049 remove_copy_if(R&& r, O result, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591050
Nikolas Klauser93172c12022-08-03 05:25:001051 template<class I, class O>
Mark de Weverde6827b2023-02-24 20:35:411052 using replace_copy_result = in_out_result<I, O>; // since C++20
Nikolas Klauser93172c12022-08-03 05:25:001053
1054 template<input_iterator I, sentinel_for<I> S, class T1, class T2,
1055 output_iterator<const T2&> O, class Proj = identity>
1056 requires indirectly_copyable<I, O> &&
1057 indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*>
1058 constexpr replace_copy_result<I, O>
1059 replace_copy(I first, S last, O result, const T1& old_value, const T2& new_value,
Mark de Weverde6827b2023-02-24 20:35:411060 Proj proj = {}); // since C++20
Nikolas Klauser93172c12022-08-03 05:25:001061
1062 template<input_range R, class T1, class T2, output_iterator<const T2&> O,
1063 class Proj = identity>
1064 requires indirectly_copyable<iterator_t<R>, O> &&
1065 indirect_binary_predicate<ranges::equal_to,
1066 projected<iterator_t<R>, Proj>, const T1*>
1067 constexpr replace_copy_result<borrowed_iterator_t<R>, O>
1068 replace_copy(R&& r, O result, const T1& old_value, const T2& new_value,
Mark de Weverde6827b2023-02-24 20:35:411069 Proj proj = {}); // since C++20
Nikolas Klauser93172c12022-08-03 05:25:001070
1071 template<class I, class O>
Mark de Weverde6827b2023-02-24 20:35:411072 using replace_copy_if_result = in_out_result<I, O>; // since C++20
Nikolas Klauser93172c12022-08-03 05:25:001073
1074 template<input_iterator I, sentinel_for<I> S, class T, output_iterator<const T&> O,
1075 class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
1076 requires indirectly_copyable<I, O>
1077 constexpr replace_copy_if_result<I, O>
1078 replace_copy_if(I first, S last, O result, Pred pred, const T& new_value,
Mark de Weverde6827b2023-02-24 20:35:411079 Proj proj = {}); // since C++20
Nikolas Klauser93172c12022-08-03 05:25:001080
1081 template<input_range R, class T, output_iterator<const T&> O, class Proj = identity,
1082 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
1083 requires indirectly_copyable<iterator_t<R>, O>
1084 constexpr replace_copy_if_result<borrowed_iterator_t<R>, O>
1085 replace_copy_if(R&& r, O result, Pred pred, const T& new_value,
Mark de Weverde6827b2023-02-24 20:35:411086 Proj proj = {}); // since C++20
Nikolas Klauser93172c12022-08-03 05:25:001087
Nikolas Klauser68264b62022-08-03 05:40:131088 template<class I>
Mark de Weverde6827b2023-02-24 20:35:411089 using prev_permutation_result = in_found_result<I>; // since C++20
Nikolas Klauser68264b62022-08-03 05:40:131090
1091 template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
1092 class Proj = identity>
1093 requires sortable<I, Comp, Proj>
1094 constexpr ranges::prev_permutation_result<I>
Mark de Weverde6827b2023-02-24 20:35:411095 ranges::prev_permutation(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser68264b62022-08-03 05:40:131096
1097 template<bidirectional_range R, class Comp = ranges::less,
1098 class Proj = identity>
1099 requires sortable<iterator_t<R>, Comp, Proj>
1100 constexpr ranges::prev_permutation_result<borrowed_iterator_t<R>>
Mark de Weverde6827b2023-02-24 20:35:411101 ranges::prev_permutation(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser68264b62022-08-03 05:40:131102
1103 template<class I>
Mark de Weverde6827b2023-02-24 20:35:411104 using next_permutation_result = in_found_result<I>; // since C++20
Nikolas Klauser68264b62022-08-03 05:40:131105
1106 template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
1107 class Proj = identity>
1108 requires sortable<I, Comp, Proj>
1109 constexpr ranges::next_permutation_result<I>
Mark de Weverde6827b2023-02-24 20:35:411110 ranges::next_permutation(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser68264b62022-08-03 05:40:131111
1112 template<bidirectional_range R, class Comp = ranges::less,
1113 class Proj = identity>
1114 requires sortable<iterator_t<R>, Comp, Proj>
1115 constexpr ranges::next_permutation_result<borrowed_iterator_t<R>>
Mark de Weverde6827b2023-02-24 20:35:411116 ranges::next_permutation(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser68264b62022-08-03 05:40:131117
Nikolas Klauserd3729bb2022-01-14 01:55:511118}
1119
Nikolas Klauser68264b62022-08-03 05:40:131120template <class InputIterator, class Predicate>
Marshall Clow706ffef2018-01-15 17:20:361121 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161122 all_of(InputIterator first, InputIterator last, Predicate pred);
1123
1124template <class InputIterator, class Predicate>
Marshall Clow706ffef2018-01-15 17:20:361125 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161126 any_of(InputIterator first, InputIterator last, Predicate pred);
1127
1128template <class InputIterator, class Predicate>
Marshall Clow706ffef2018-01-15 17:20:361129 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161130 none_of(InputIterator first, InputIterator last, Predicate pred);
1131
1132template <class InputIterator, class Function>
Marshall Clow1b9a4ff2018-01-22 20:44:331133 constexpr Function // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161134 for_each(InputIterator first, InputIterator last, Function f);
1135
Marshall Clowd5c65ff2017-05-25 02:29:541136template<class InputIterator, class Size, class Function>
Marshall Clow1b9a4ff2018-01-22 20:44:331137 constexpr InputIterator // constexpr in C++20
1138 for_each_n(InputIterator first, Size n, Function f); // C++17
Marshall Clowd5c65ff2017-05-25 02:29:541139
Howard Hinnant3e519522010-05-11 19:42:161140template <class InputIterator, class T>
Marshall Clow86944282018-01-15 19:26:051141 constexpr InputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161142 find(InputIterator first, InputIterator last, const T& value);
1143
1144template <class InputIterator, class Predicate>
Marshall Clow86944282018-01-15 19:26:051145 constexpr InputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161146 find_if(InputIterator first, InputIterator last, Predicate pred);
1147
1148template<class InputIterator, class Predicate>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181149 constexpr InputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161150 find_if_not(InputIterator first, InputIterator last, Predicate pred);
1151
1152template <class ForwardIterator1, class ForwardIterator2>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181153 constexpr ForwardIterator1 // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161154 find_end(ForwardIterator1 first1, ForwardIterator1 last1,
1155 ForwardIterator2 first2, ForwardIterator2 last2);
1156
1157template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181158 constexpr ForwardIterator1 // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161159 find_end(ForwardIterator1 first1, ForwardIterator1 last1,
1160 ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
1161
1162template <class ForwardIterator1, class ForwardIterator2>
Marshall Clow86944282018-01-15 19:26:051163 constexpr ForwardIterator1 // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161164 find_first_of(ForwardIterator1 first1, ForwardIterator1 last1,
1165 ForwardIterator2 first2, ForwardIterator2 last2);
1166
1167template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
Marshall Clow86944282018-01-15 19:26:051168 constexpr ForwardIterator1 // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161169 find_first_of(ForwardIterator1 first1, ForwardIterator1 last1,
1170 ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
1171
1172template <class ForwardIterator>
Marshall Clow86944282018-01-15 19:26:051173 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161174 adjacent_find(ForwardIterator first, ForwardIterator last);
1175
1176template <class ForwardIterator, class BinaryPredicate>
Marshall Clow86944282018-01-15 19:26:051177 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161178 adjacent_find(ForwardIterator first, ForwardIterator last, BinaryPredicate pred);
1179
1180template <class InputIterator, class T>
Marshall Clow056f15e2018-01-15 19:40:341181 constexpr typename iterator_traits<InputIterator>::difference_type // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161182 count(InputIterator first, InputIterator last, const T& value);
1183
1184template <class InputIterator, class Predicate>
Marshall Clow056f15e2018-01-15 19:40:341185 constexpr typename iterator_traits<InputIterator>::difference_type // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161186 count_if(InputIterator first, InputIterator last, Predicate pred);
1187
1188template <class InputIterator1, class InputIterator2>
Marshall Clow6538e28d2018-01-16 02:04:101189 constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161190 mismatch(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2);
1191
Marshall Clow0b0bbd22013-05-09 21:14:231192template <class InputIterator1, class InputIterator2>
Marshall Clow6538e28d2018-01-16 02:04:101193 constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20
Aditya Kumar331fb802016-08-25 11:52:381194 mismatch(InputIterator1 first1, InputIterator1 last1,
Marshall Clow0b0bbd22013-05-09 21:14:231195 InputIterator2 first2, InputIterator2 last2); // **C++14**
1196
Howard Hinnant3e519522010-05-11 19:42:161197template <class InputIterator1, class InputIterator2, class BinaryPredicate>
Marshall Clow6538e28d2018-01-16 02:04:101198 constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161199 mismatch(InputIterator1 first1, InputIterator1 last1,
1200 InputIterator2 first2, BinaryPredicate pred);
1201
Marshall Clow0b0bbd22013-05-09 21:14:231202template <class InputIterator1, class InputIterator2, class BinaryPredicate>
Marshall Clow6538e28d2018-01-16 02:04:101203 constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20
Marshall Clow0b0bbd22013-05-09 21:14:231204 mismatch(InputIterator1 first1, InputIterator1 last1,
1205 InputIterator2 first2, InputIterator2 last2,
1206 BinaryPredicate pred); // **C++14**
1207
Howard Hinnant3e519522010-05-11 19:42:161208template <class InputIterator1, class InputIterator2>
Marshall Clow6538e28d2018-01-16 02:04:101209 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161210 equal(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2);
1211
Marshall Clow0b0bbd22013-05-09 21:14:231212template <class InputIterator1, class InputIterator2>
Marshall Clow6538e28d2018-01-16 02:04:101213 constexpr bool // constexpr in C++20
Aditya Kumar331fb802016-08-25 11:52:381214 equal(InputIterator1 first1, InputIterator1 last1,
Marshall Clow0b0bbd22013-05-09 21:14:231215 InputIterator2 first2, InputIterator2 last2); // **C++14**
1216
Howard Hinnant3e519522010-05-11 19:42:161217template <class InputIterator1, class InputIterator2, class BinaryPredicate>
Marshall Clow6538e28d2018-01-16 02:04:101218 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161219 equal(InputIterator1 first1, InputIterator1 last1,
1220 InputIterator2 first2, BinaryPredicate pred);
1221
Marshall Clow0b0bbd22013-05-09 21:14:231222template <class InputIterator1, class InputIterator2, class BinaryPredicate>
Marshall Clow6538e28d2018-01-16 02:04:101223 constexpr bool // constexpr in C++20
Marshall Clow0b0bbd22013-05-09 21:14:231224 equal(InputIterator1 first1, InputIterator1 last1,
1225 InputIterator2 first2, InputIterator2 last2,
1226 BinaryPredicate pred); // **C++14**
1227
Howard Hinnant3e519522010-05-11 19:42:161228template<class ForwardIterator1, class ForwardIterator2>
Marshall Clow49c76432018-01-15 16:16:321229 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161230 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
1231 ForwardIterator2 first2);
1232
Marshall Clow0b0bbd22013-05-09 21:14:231233template<class ForwardIterator1, class ForwardIterator2>
Marshall Clow49c76432018-01-15 16:16:321234 constexpr bool // constexpr in C++20
Marshall Clow0b0bbd22013-05-09 21:14:231235 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
1236 ForwardIterator2 first2, ForwardIterator2 last2); // **C++14**
1237
Howard Hinnant3e519522010-05-11 19:42:161238template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
Marshall Clow49c76432018-01-15 16:16:321239 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161240 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
1241 ForwardIterator2 first2, BinaryPredicate pred);
1242
Marshall Clow0b0bbd22013-05-09 21:14:231243template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
Marshall Clow49c76432018-01-15 16:16:321244 constexpr bool // constexpr in C++20
Marshall Clow0b0bbd22013-05-09 21:14:231245 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
1246 ForwardIterator2 first2, ForwardIterator2 last2,
1247 BinaryPredicate pred); // **C++14**
1248
Howard Hinnant3e519522010-05-11 19:42:161249template <class ForwardIterator1, class ForwardIterator2>
Marshall Clow12f0a772018-01-16 15:48:271250 constexpr ForwardIterator1 // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161251 search(ForwardIterator1 first1, ForwardIterator1 last1,
1252 ForwardIterator2 first2, ForwardIterator2 last2);
1253
1254template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
Marshall Clow12f0a772018-01-16 15:48:271255 constexpr ForwardIterator1 // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161256 search(ForwardIterator1 first1, ForwardIterator1 last1,
1257 ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
1258
1259template <class ForwardIterator, class Size, class T>
Marshall Clow12f0a772018-01-16 15:48:271260 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161261 search_n(ForwardIterator first, ForwardIterator last, Size count, const T& value);
1262
1263template <class ForwardIterator, class Size, class T, class BinaryPredicate>
Marshall Clow12f0a772018-01-16 15:48:271264 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161265 search_n(ForwardIterator first, ForwardIterator last,
1266 Size count, const T& value, BinaryPredicate pred);
1267
1268template <class InputIterator, class OutputIterator>
Louis Dionne13c90a52019-11-06 12:02:411269 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161270 copy(InputIterator first, InputIterator last, OutputIterator result);
1271
1272template<class InputIterator, class OutputIterator, class Predicate>
Louis Dionne13c90a52019-11-06 12:02:411273 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161274 copy_if(InputIterator first, InputIterator last,
1275 OutputIterator result, Predicate pred);
1276
1277template<class InputIterator, class Size, class OutputIterator>
Louis Dionne13c90a52019-11-06 12:02:411278 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161279 copy_n(InputIterator first, Size n, OutputIterator result);
1280
1281template <class BidirectionalIterator1, class BidirectionalIterator2>
Louis Dionne13c90a52019-11-06 12:02:411282 constexpr BidirectionalIterator2 // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161283 copy_backward(BidirectionalIterator1 first, BidirectionalIterator1 last,
1284 BidirectionalIterator2 result);
1285
Konstantin Varlamov79a2b4b2022-06-28 18:59:591286// [alg.move], move
1287template<class InputIterator, class OutputIterator>
1288 constexpr OutputIterator move(InputIterator first, InputIterator last,
1289 OutputIterator result);
1290
1291template<class BidirectionalIterator1, class BidirectionalIterator2>
1292 constexpr BidirectionalIterator2
1293 move_backward(BidirectionalIterator1 first, BidirectionalIterator1 last,
1294 BidirectionalIterator2 result);
1295
Howard Hinnant3e519522010-05-11 19:42:161296template <class ForwardIterator1, class ForwardIterator2>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181297 constexpr ForwardIterator2 // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161298 swap_ranges(ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2);
1299
Konstantin Varlamov79a2b4b2022-06-28 18:59:591300namespace ranges {
1301 template<class I1, class I2>
1302 using swap_ranges_result = in_in_result<I1, I2>;
1303
Nikolas Klauser9d905312022-02-10 12:33:031304template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2>
1305 requires indirectly_swappable<I1, I2>
1306 constexpr ranges::swap_ranges_result<I1, I2>
Konstantin Varlamov79a2b4b2022-06-28 18:59:591307 swap_ranges(I1 first1, S1 last1, I2 first2, S2 last2);
Nikolas Klauser9d905312022-02-10 12:33:031308
1309template<input_range R1, input_range R2>
1310 requires indirectly_swappable<iterator_t<R1>, iterator_t<R2>>
1311 constexpr ranges::swap_ranges_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
Konstantin Varlamov79a2b4b2022-06-28 18:59:591312 swap_ranges(R1&& r1, R2&& r2);
1313}
Nikolas Klauser9d905312022-02-10 12:33:031314
Howard Hinnant3e519522010-05-11 19:42:161315template <class ForwardIterator1, class ForwardIterator2>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181316 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161317 iter_swap(ForwardIterator1 a, ForwardIterator2 b);
1318
1319template <class InputIterator, class OutputIterator, class UnaryOperation>
Marshall Clow99894b62018-01-19 17:45:391320 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161321 transform(InputIterator first, InputIterator last, OutputIterator result, UnaryOperation op);
1322
1323template <class InputIterator1, class InputIterator2, class OutputIterator, class BinaryOperation>
Marshall Clow99894b62018-01-19 17:45:391324 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161325 transform(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2,
1326 OutputIterator result, BinaryOperation binary_op);
1327
1328template <class ForwardIterator, class T>
Marshall Clow12c74232018-01-19 18:07:291329 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161330 replace(ForwardIterator first, ForwardIterator last, const T& old_value, const T& new_value);
1331
1332template <class ForwardIterator, class Predicate, class T>
Marshall Clow12c74232018-01-19 18:07:291333 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161334 replace_if(ForwardIterator first, ForwardIterator last, Predicate pred, const T& new_value);
1335
1336template <class InputIterator, class OutputIterator, class T>
Marshall Clow12c74232018-01-19 18:07:291337 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161338 replace_copy(InputIterator first, InputIterator last, OutputIterator result,
1339 const T& old_value, const T& new_value);
1340
1341template <class InputIterator, class OutputIterator, class Predicate, class T>
Marshall Clow12c74232018-01-19 18:07:291342 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161343 replace_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred, const T& new_value);
1344
1345template <class ForwardIterator, class T>
Marshall Clow4bfb9312018-01-20 20:14:321346 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161347 fill(ForwardIterator first, ForwardIterator last, const T& value);
1348
1349template <class OutputIterator, class Size, class T>
Marshall Clow4bfb9312018-01-20 20:14:321350 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161351 fill_n(OutputIterator first, Size n, const T& value);
1352
1353template <class ForwardIterator, class Generator>
Marshall Clow4bfb9312018-01-20 20:14:321354 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161355 generate(ForwardIterator first, ForwardIterator last, Generator gen);
1356
1357template <class OutputIterator, class Size, class Generator>
Marshall Clow4bfb9312018-01-20 20:14:321358 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161359 generate_n(OutputIterator first, Size n, Generator gen);
1360
1361template <class ForwardIterator, class T>
Marshall Clowe8ea8292018-01-22 21:43:041362 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161363 remove(ForwardIterator first, ForwardIterator last, const T& value);
1364
1365template <class ForwardIterator, class Predicate>
Marshall Clowe8ea8292018-01-22 21:43:041366 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161367 remove_if(ForwardIterator first, ForwardIterator last, Predicate pred);
1368
1369template <class InputIterator, class OutputIterator, class T>
Marshall Clowe8ea8292018-01-22 21:43:041370 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161371 remove_copy(InputIterator first, InputIterator last, OutputIterator result, const T& value);
1372
1373template <class InputIterator, class OutputIterator, class Predicate>
Marshall Clowe8ea8292018-01-22 21:43:041374 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161375 remove_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred);
1376
1377template <class ForwardIterator>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181378 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161379 unique(ForwardIterator first, ForwardIterator last);
1380
1381template <class ForwardIterator, class BinaryPredicate>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181382 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161383 unique(ForwardIterator first, ForwardIterator last, BinaryPredicate pred);
1384
1385template <class InputIterator, class OutputIterator>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181386 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161387 unique_copy(InputIterator first, InputIterator last, OutputIterator result);
1388
1389template <class InputIterator, class OutputIterator, class BinaryPredicate>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181390 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161391 unique_copy(InputIterator first, InputIterator last, OutputIterator result, BinaryPredicate pred);
1392
1393template <class BidirectionalIterator>
Arthur O'Dwyerf851db32020-12-17 05:01:081394 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161395 reverse(BidirectionalIterator first, BidirectionalIterator last);
1396
1397template <class BidirectionalIterator, class OutputIterator>
Marshall Clowe8ea8292018-01-22 21:43:041398 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161399 reverse_copy(BidirectionalIterator first, BidirectionalIterator last, OutputIterator result);
1400
1401template <class ForwardIterator>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181402 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161403 rotate(ForwardIterator first, ForwardIterator middle, ForwardIterator last);
1404
1405template <class ForwardIterator, class OutputIterator>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181406 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161407 rotate_copy(ForwardIterator first, ForwardIterator middle, ForwardIterator last, OutputIterator result);
1408
1409template <class RandomAccessIterator>
1410 void
Marshall Clow0f37a412017-03-23 13:43:371411 random_shuffle(RandomAccessIterator first, RandomAccessIterator last); // deprecated in C++14, removed in C++17
Howard Hinnant3e519522010-05-11 19:42:161412
1413template <class RandomAccessIterator, class RandomNumberGenerator>
1414 void
Marshall Clow06965c12014-03-03 06:14:191415 random_shuffle(RandomAccessIterator first, RandomAccessIterator last,
Marshall Clow0f37a412017-03-23 13:43:371416 RandomNumberGenerator& rand); // deprecated in C++14, removed in C++17
Howard Hinnant3e519522010-05-11 19:42:161417
Eric Fiseliere7154702016-08-28 22:14:371418template<class PopulationIterator, class SampleIterator,
1419 class Distance, class UniformRandomBitGenerator>
1420 SampleIterator sample(PopulationIterator first, PopulationIterator last,
1421 SampleIterator out, Distance n,
1422 UniformRandomBitGenerator&& g); // C++17
1423
Howard Hinnantf9d540b2010-05-26 17:49:341424template<class RandomAccessIterator, class UniformRandomNumberGenerator>
1425 void shuffle(RandomAccessIterator first, RandomAccessIterator last,
Howard Hinnantfb340102010-11-18 01:47:021426 UniformRandomNumberGenerator&& g);
Howard Hinnantf9d540b2010-05-26 17:49:341427
Arthur O'Dwyer3fbd3ea2020-12-26 06:39:031428template<class ForwardIterator>
1429 constexpr ForwardIterator
1430 shift_left(ForwardIterator first, ForwardIterator last,
1431 typename iterator_traits<ForwardIterator>::difference_type n); // C++20
1432
1433template<class ForwardIterator>
1434 constexpr ForwardIterator
1435 shift_right(ForwardIterator first, ForwardIterator last,
1436 typename iterator_traits<ForwardIterator>::difference_type n); // C++20
1437
Howard Hinnant3e519522010-05-11 19:42:161438template <class InputIterator, class Predicate>
Marshall Clow49c76432018-01-15 16:16:321439 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161440 is_partitioned(InputIterator first, InputIterator last, Predicate pred);
1441
1442template <class ForwardIterator, class Predicate>
Arthur O'Dwyerf851db32020-12-17 05:01:081443 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161444 partition(ForwardIterator first, ForwardIterator last, Predicate pred);
1445
1446template <class InputIterator, class OutputIterator1,
1447 class OutputIterator2, class Predicate>
Marshall Clow1b9a4ff2018-01-22 20:44:331448 constexpr pair<OutputIterator1, OutputIterator2> // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161449 partition_copy(InputIterator first, InputIterator last,
1450 OutputIterator1 out_true, OutputIterator2 out_false,
1451 Predicate pred);
1452
1453template <class ForwardIterator, class Predicate>
1454 ForwardIterator
1455 stable_partition(ForwardIterator first, ForwardIterator last, Predicate pred);
1456
1457template<class ForwardIterator, class Predicate>
Marshall Clowd57c03d2018-01-16 02:34:411458 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161459 partition_point(ForwardIterator first, ForwardIterator last, Predicate pred);
1460
1461template <class ForwardIterator>
Marshall Clow49c76432018-01-15 16:16:321462 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161463 is_sorted(ForwardIterator first, ForwardIterator last);
1464
1465template <class ForwardIterator, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181466 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161467 is_sorted(ForwardIterator first, ForwardIterator last, Compare comp);
1468
1469template<class ForwardIterator>
Marshall Clow056f15e2018-01-15 19:40:341470 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161471 is_sorted_until(ForwardIterator first, ForwardIterator last);
1472
1473template <class ForwardIterator, class Compare>
Marshall Clow056f15e2018-01-15 19:40:341474 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161475 is_sorted_until(ForwardIterator first, ForwardIterator last, Compare comp);
1476
1477template <class RandomAccessIterator>
Arthur O'Dwyer493f1402020-12-20 20:21:421478 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161479 sort(RandomAccessIterator first, RandomAccessIterator last);
1480
1481template <class RandomAccessIterator, class Compare>
Arthur O'Dwyer493f1402020-12-20 20:21:421482 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161483 sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1484
1485template <class RandomAccessIterator>
1486 void
1487 stable_sort(RandomAccessIterator first, RandomAccessIterator last);
1488
1489template <class RandomAccessIterator, class Compare>
1490 void
1491 stable_sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1492
1493template <class RandomAccessIterator>
Arthur O'Dwyer5386aa22020-12-17 05:26:181494 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161495 partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last);
1496
1497template <class RandomAccessIterator, class Compare>
Arthur O'Dwyer5386aa22020-12-17 05:26:181498 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161499 partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last, Compare comp);
1500
1501template <class InputIterator, class RandomAccessIterator>
Arthur O'Dwyer5386aa22020-12-17 05:26:181502 constexpr RandomAccessIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161503 partial_sort_copy(InputIterator first, InputIterator last,
1504 RandomAccessIterator result_first, RandomAccessIterator result_last);
1505
1506template <class InputIterator, class RandomAccessIterator, class Compare>
Arthur O'Dwyer5386aa22020-12-17 05:26:181507 constexpr RandomAccessIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161508 partial_sort_copy(InputIterator first, InputIterator last,
1509 RandomAccessIterator result_first, RandomAccessIterator result_last, Compare comp);
1510
1511template <class RandomAccessIterator>
Arthur O'Dwyer5d956562021-02-04 23:12:521512 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161513 nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last);
1514
1515template <class RandomAccessIterator, class Compare>
Arthur O'Dwyer5d956562021-02-04 23:12:521516 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161517 nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last, Compare comp);
1518
1519template <class ForwardIterator, class T>
Marshall Clowd57c03d2018-01-16 02:34:411520 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161521 lower_bound(ForwardIterator first, ForwardIterator last, const T& value);
1522
1523template <class ForwardIterator, class T, class Compare>
Marshall Clowd57c03d2018-01-16 02:34:411524 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161525 lower_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
1526
1527template <class ForwardIterator, class T>
Marshall Clowd57c03d2018-01-16 02:34:411528 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161529 upper_bound(ForwardIterator first, ForwardIterator last, const T& value);
1530
1531template <class ForwardIterator, class T, class Compare>
Marshall Clowd57c03d2018-01-16 02:34:411532 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161533 upper_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
1534
1535template <class ForwardIterator, class T>
Marshall Clowd57c03d2018-01-16 02:34:411536 constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161537 equal_range(ForwardIterator first, ForwardIterator last, const T& value);
1538
1539template <class ForwardIterator, class T, class Compare>
Marshall Clowd57c03d2018-01-16 02:34:411540 constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161541 equal_range(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
1542
1543template <class ForwardIterator, class T>
Marshall Clowd57c03d2018-01-16 02:34:411544 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161545 binary_search(ForwardIterator first, ForwardIterator last, const T& value);
1546
1547template <class ForwardIterator, class T, class Compare>
Marshall Clow8da1a482018-01-22 23:10:401548 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161549 binary_search(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
1550
1551template <class InputIterator1, class InputIterator2, class OutputIterator>
Arthur O'Dwyer14098cf2020-12-04 18:47:121552 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161553 merge(InputIterator1 first1, InputIterator1 last1,
1554 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1555
1556template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
Arthur O'Dwyer14098cf2020-12-04 18:47:121557 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161558 merge(InputIterator1 first1, InputIterator1 last1,
1559 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1560
1561template <class BidirectionalIterator>
1562 void
1563 inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last);
1564
1565template <class BidirectionalIterator, class Compare>
1566 void
1567 inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last, Compare comp);
1568
1569template <class InputIterator1, class InputIterator2>
Marshall Clow8da1a482018-01-22 23:10:401570 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161571 includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2);
1572
1573template <class InputIterator1, class InputIterator2, class Compare>
Marshall Clow8da1a482018-01-22 23:10:401574 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161575 includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, Compare comp);
1576
1577template <class InputIterator1, class InputIterator2, class OutputIterator>
Arthur O'Dwyer14098cf2020-12-04 18:47:121578 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161579 set_union(InputIterator1 first1, InputIterator1 last1,
1580 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1581
1582template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
Arthur O'Dwyer14098cf2020-12-04 18:47:121583 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161584 set_union(InputIterator1 first1, InputIterator1 last1,
1585 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1586
1587template <class InputIterator1, class InputIterator2, class OutputIterator>
Marshall Clow8da1a482018-01-22 23:10:401588 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161589 set_intersection(InputIterator1 first1, InputIterator1 last1,
1590 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1591
1592template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
Marshall Clow8da1a482018-01-22 23:10:401593 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161594 set_intersection(InputIterator1 first1, InputIterator1 last1,
1595 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1596
1597template <class InputIterator1, class InputIterator2, class OutputIterator>
Arthur O'Dwyer14098cf2020-12-04 18:47:121598 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161599 set_difference(InputIterator1 first1, InputIterator1 last1,
1600 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1601
1602template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
Arthur O'Dwyer14098cf2020-12-04 18:47:121603 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161604 set_difference(InputIterator1 first1, InputIterator1 last1,
1605 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1606
1607template <class InputIterator1, class InputIterator2, class OutputIterator>
Arthur O'Dwyer14098cf2020-12-04 18:47:121608 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161609 set_symmetric_difference(InputIterator1 first1, InputIterator1 last1,
1610 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1611
1612template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
Arthur O'Dwyer14098cf2020-12-04 18:47:121613 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161614 set_symmetric_difference(InputIterator1 first1, InputIterator1 last1,
1615 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1616
1617template <class RandomAccessIterator>
Arthur O'Dwyer5386aa22020-12-17 05:26:181618 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161619 push_heap(RandomAccessIterator first, RandomAccessIterator last);
1620
1621template <class RandomAccessIterator, class Compare>
Arthur O'Dwyer5386aa22020-12-17 05:26:181622 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161623 push_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1624
1625template <class RandomAccessIterator>
Arthur O'Dwyer5386aa22020-12-17 05:26:181626 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161627 pop_heap(RandomAccessIterator first, RandomAccessIterator last);
1628
1629template <class RandomAccessIterator, class Compare>
Arthur O'Dwyer5386aa22020-12-17 05:26:181630 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161631 pop_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1632
1633template <class RandomAccessIterator>
Arthur O'Dwyer5386aa22020-12-17 05:26:181634 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161635 make_heap(RandomAccessIterator first, RandomAccessIterator last);
1636
1637template <class RandomAccessIterator, class Compare>
Arthur O'Dwyer5386aa22020-12-17 05:26:181638 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161639 make_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1640
1641template <class RandomAccessIterator>
Arthur O'Dwyer5386aa22020-12-17 05:26:181642 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161643 sort_heap(RandomAccessIterator first, RandomAccessIterator last);
1644
1645template <class RandomAccessIterator, class Compare>
Arthur O'Dwyer5386aa22020-12-17 05:26:181646 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161647 sort_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1648
Howard Hinnantb3371f62010-08-22 00:02:431649template <class RandomAccessIterator>
Marshall Clow49c76432018-01-15 16:16:321650 constexpr bool // constexpr in C++20
Howard Hinnantb3371f62010-08-22 00:02:431651 is_heap(RandomAccessIterator first, RandomAccessiterator last);
Howard Hinnant3e519522010-05-11 19:42:161652
Howard Hinnantb3371f62010-08-22 00:02:431653template <class RandomAccessIterator, class Compare>
Marshall Clow49c76432018-01-15 16:16:321654 constexpr bool // constexpr in C++20
Howard Hinnantb3371f62010-08-22 00:02:431655 is_heap(RandomAccessIterator first, RandomAccessiterator last, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161656
Howard Hinnantb3371f62010-08-22 00:02:431657template <class RandomAccessIterator>
Marshall Clow49c76432018-01-15 16:16:321658 constexpr RandomAccessIterator // constexpr in C++20
Howard Hinnantb3371f62010-08-22 00:02:431659 is_heap_until(RandomAccessIterator first, RandomAccessiterator last);
Howard Hinnant3e519522010-05-11 19:42:161660
Howard Hinnantb3371f62010-08-22 00:02:431661template <class RandomAccessIterator, class Compare>
Marshall Clow49c76432018-01-15 16:16:321662 constexpr RandomAccessIterator // constexpr in C++20
Howard Hinnantb3371f62010-08-22 00:02:431663 is_heap_until(RandomAccessIterator first, RandomAccessiterator last, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161664
Howard Hinnant4eb27b72010-08-21 20:10:011665template <class ForwardIterator>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181666 constexpr ForwardIterator // constexpr in C++14
1667 min_element(ForwardIterator first, ForwardIterator last);
Howard Hinnant4eb27b72010-08-21 20:10:011668
1669template <class ForwardIterator, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181670 constexpr ForwardIterator // constexpr in C++14
1671 min_element(ForwardIterator first, ForwardIterator last, Compare comp);
Howard Hinnant4eb27b72010-08-21 20:10:011672
Howard Hinnant3e519522010-05-11 19:42:161673template <class T>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181674 constexpr const T& // constexpr in C++14
1675 min(const T& a, const T& b);
Howard Hinnant3e519522010-05-11 19:42:161676
1677template <class T, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181678 constexpr const T& // constexpr in C++14
1679 min(const T& a, const T& b, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161680
Howard Hinnant4eb27b72010-08-21 20:10:011681template<class T>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181682 constexpr T // constexpr in C++14
1683 min(initializer_list<T> t);
Howard Hinnant4eb27b72010-08-21 20:10:011684
1685template<class T, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181686 constexpr T // constexpr in C++14
1687 min(initializer_list<T> t, Compare comp);
Howard Hinnant4eb27b72010-08-21 20:10:011688
Marshall Clow146c14a2016-03-07 22:43:491689template<class T>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181690 constexpr const T& clamp(const T& v, const T& lo, const T& hi); // C++17
Marshall Clow146c14a2016-03-07 22:43:491691
1692template<class T, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181693 constexpr const T& clamp(const T& v, const T& lo, const T& hi, Compare comp); // C++17
Marshall Clow146c14a2016-03-07 22:43:491694
Howard Hinnant4eb27b72010-08-21 20:10:011695template <class ForwardIterator>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181696 constexpr ForwardIterator // constexpr in C++14
1697 max_element(ForwardIterator first, ForwardIterator last);
Howard Hinnant4eb27b72010-08-21 20:10:011698
1699template <class ForwardIterator, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181700 constexpr ForwardIterator // constexpr in C++14
1701 max_element(ForwardIterator first, ForwardIterator last, Compare comp);
Howard Hinnant4eb27b72010-08-21 20:10:011702
Howard Hinnant3e519522010-05-11 19:42:161703template <class T>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181704 constexpr const T& // constexpr in C++14
1705 max(const T& a, const T& b);
Howard Hinnant3e519522010-05-11 19:42:161706
1707template <class T, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181708 constexpr const T& // constexpr in C++14
1709 max(const T& a, const T& b, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161710
Howard Hinnant4eb27b72010-08-21 20:10:011711template<class T>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181712 constexpr T // constexpr in C++14
1713 max(initializer_list<T> t);
Howard Hinnant3e519522010-05-11 19:42:161714
Howard Hinnant4eb27b72010-08-21 20:10:011715template<class T, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181716 constexpr T // constexpr in C++14
1717 max(initializer_list<T> t, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161718
Howard Hinnant4eb27b72010-08-21 20:10:011719template<class ForwardIterator>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181720 constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++14
1721 minmax_element(ForwardIterator first, ForwardIterator last);
Howard Hinnant3e519522010-05-11 19:42:161722
Howard Hinnant4eb27b72010-08-21 20:10:011723template<class ForwardIterator, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181724 constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++14
1725 minmax_element(ForwardIterator first, ForwardIterator last, Compare comp);
Howard Hinnant4eb27b72010-08-21 20:10:011726
1727template<class T>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181728 constexpr pair<const T&, const T&> // constexpr in C++14
1729 minmax(const T& a, const T& b);
Howard Hinnant4eb27b72010-08-21 20:10:011730
1731template<class T, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181732 constexpr pair<const T&, const T&> // constexpr in C++14
1733 minmax(const T& a, const T& b, Compare comp);
Howard Hinnant4eb27b72010-08-21 20:10:011734
1735template<class T>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181736 constexpr pair<T, T> // constexpr in C++14
1737 minmax(initializer_list<T> t);
Howard Hinnant4eb27b72010-08-21 20:10:011738
1739template<class T, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181740 constexpr pair<T, T> // constexpr in C++14
1741 minmax(initializer_list<T> t, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161742
1743template <class InputIterator1, class InputIterator2>
Marshall Clow1b9a4ff2018-01-22 20:44:331744 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161745 lexicographical_compare(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2);
1746
1747template <class InputIterator1, class InputIterator2, class Compare>
Marshall Clow1b9a4ff2018-01-22 20:44:331748 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161749 lexicographical_compare(InputIterator1 first1, InputIterator1 last1,
1750 InputIterator2 first2, InputIterator2 last2, Compare comp);
1751
Adrian Vogelsgesang2a067572022-08-04 22:21:271752template<class InputIterator1, class InputIterator2, class Cmp>
1753 constexpr auto
1754 lexicographical_compare_three_way(InputIterator1 first1, InputIterator1 last1,
1755 InputIterator2 first2, InputIterator2 last2,
1756 Cmp comp)
1757 -> decltype(comp(*b1, *b2)); // since C++20
1758
1759template<class InputIterator1, class InputIterator2>
1760 constexpr auto
1761 lexicographical_compare_three_way(InputIterator1 first1, InputIterator1 last1,
1762 InputIterator2 first2, InputIterator2 last2); // since C++20
1763
Howard Hinnant3e519522010-05-11 19:42:161764template <class BidirectionalIterator>
Arthur O'Dwyerf851db32020-12-17 05:01:081765 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161766 next_permutation(BidirectionalIterator first, BidirectionalIterator last);
1767
1768template <class BidirectionalIterator, class Compare>
Arthur O'Dwyerf851db32020-12-17 05:01:081769 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161770 next_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp);
1771
1772template <class BidirectionalIterator>
Arthur O'Dwyerf851db32020-12-17 05:01:081773 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161774 prev_permutation(BidirectionalIterator first, BidirectionalIterator last);
1775
1776template <class BidirectionalIterator, class Compare>
Arthur O'Dwyerf851db32020-12-17 05:01:081777 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161778 prev_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161779} // std
1780
1781*/
1782
Louis Dionne385cc252022-03-25 16:55:361783#include <__assert> // all public C++ headers provide the assertion handler
Howard Hinnant3e519522010-05-11 19:42:161784#include <__config>
Marshall Clowf56972e2018-09-12 19:41:401785#include <version>
Howard Hinnant5d1a7012013-08-14 18:00:201786
Louis Dionne134723e2021-06-17 15:30:111787#include <__algorithm/adjacent_find.h>
1788#include <__algorithm/all_of.h>
1789#include <__algorithm/any_of.h>
1790#include <__algorithm/binary_search.h>
1791#include <__algorithm/clamp.h>
1792#include <__algorithm/comp.h>
1793#include <__algorithm/comp_ref_type.h>
1794#include <__algorithm/copy.h>
1795#include <__algorithm/copy_backward.h>
1796#include <__algorithm/copy_if.h>
1797#include <__algorithm/copy_n.h>
1798#include <__algorithm/count.h>
1799#include <__algorithm/count_if.h>
1800#include <__algorithm/equal.h>
1801#include <__algorithm/equal_range.h>
Louis Dionne134723e2021-06-17 15:30:111802#include <__algorithm/fill.h>
Arthur O'Dwyer4d81a462022-01-07 14:45:051803#include <__algorithm/fill_n.h>
Louis Dionne134723e2021-06-17 15:30:111804#include <__algorithm/find.h>
1805#include <__algorithm/find_end.h>
1806#include <__algorithm/find_first_of.h>
1807#include <__algorithm/find_if.h>
1808#include <__algorithm/find_if_not.h>
Christopher Di Bella39034382023-12-20 05:57:501809#include <__algorithm/fold.h>
Louis Dionne134723e2021-06-17 15:30:111810#include <__algorithm/for_each.h>
1811#include <__algorithm/for_each_n.h>
Louis Dionne134723e2021-06-17 15:30:111812#include <__algorithm/generate.h>
Arthur O'Dwyer4d81a462022-01-07 14:45:051813#include <__algorithm/generate_n.h>
Louis Dionne134723e2021-06-17 15:30:111814#include <__algorithm/half_positive.h>
Nikolas Klauser68f41312022-02-21 22:07:021815#include <__algorithm/in_found_result.h>
Nikolas Klauser1e77b392022-02-11 16:01:581816#include <__algorithm/in_fun_result.h>
Nikolas Klauserf3514af2022-01-25 10:21:471817#include <__algorithm/in_in_out_result.h>
Nikolas Klauserd3729bb2022-01-14 01:55:511818#include <__algorithm/in_in_result.h>
Nikolas Klauser610979b2022-02-03 01:17:031819#include <__algorithm/in_out_out_result.h>
Konstantin Varlamov8d23b742022-01-11 06:49:371820#include <__algorithm/in_out_result.h>
Louis Dionne134723e2021-06-17 15:30:111821#include <__algorithm/includes.h>
1822#include <__algorithm/inplace_merge.h>
1823#include <__algorithm/is_heap.h>
1824#include <__algorithm/is_heap_until.h>
1825#include <__algorithm/is_partitioned.h>
1826#include <__algorithm/is_permutation.h>
1827#include <__algorithm/is_sorted.h>
1828#include <__algorithm/is_sorted_until.h>
Christopher Di Bella6adbc832021-06-05 02:47:471829#include <__algorithm/iter_swap.h>
Louis Dionne134723e2021-06-17 15:30:111830#include <__algorithm/lexicographical_compare.h>
Adrian Vogelsgesang2a067572022-08-04 22:21:271831#include <__algorithm/lexicographical_compare_three_way.h>
Louis Dionne134723e2021-06-17 15:30:111832#include <__algorithm/lower_bound.h>
1833#include <__algorithm/make_heap.h>
1834#include <__algorithm/max.h>
1835#include <__algorithm/max_element.h>
1836#include <__algorithm/merge.h>
1837#include <__algorithm/min.h>
1838#include <__algorithm/min_element.h>
Nikolas Klauser807766b2022-02-21 21:48:361839#include <__algorithm/min_max_result.h>
Louis Dionne134723e2021-06-17 15:30:111840#include <__algorithm/minmax.h>
1841#include <__algorithm/minmax_element.h>
1842#include <__algorithm/mismatch.h>
1843#include <__algorithm/move.h>
1844#include <__algorithm/move_backward.h>
1845#include <__algorithm/next_permutation.h>
1846#include <__algorithm/none_of.h>
1847#include <__algorithm/nth_element.h>
1848#include <__algorithm/partial_sort.h>
1849#include <__algorithm/partial_sort_copy.h>
1850#include <__algorithm/partition.h>
1851#include <__algorithm/partition_copy.h>
1852#include <__algorithm/partition_point.h>
1853#include <__algorithm/pop_heap.h>
1854#include <__algorithm/prev_permutation.h>
Nikolas Klausere7e37112023-05-05 15:41:131855#include <__algorithm/pstl_any_all_none_of.h>
Nikolas Klauser7ace54e2023-05-15 17:38:011856#include <__algorithm/pstl_copy.h>
Nikolas Klauser7a3b5282023-06-06 15:42:401857#include <__algorithm/pstl_count.h>
Nikolas Klausered27a4e2023-11-28 21:02:181858#include <__algorithm/pstl_equal.h>
Nikolas Klausere7e37112023-05-05 15:41:131859#include <__algorithm/pstl_fill.h>
1860#include <__algorithm/pstl_find.h>
1861#include <__algorithm/pstl_for_each.h>
Nikolas Klausercd916102023-06-09 20:45:341862#include <__algorithm/pstl_generate.h>
Nikolas Klauser3a7876f2023-06-13 17:50:381863#include <__algorithm/pstl_is_partitioned.h>
Nikolas Klauserbf63b152023-05-30 16:27:101864#include <__algorithm/pstl_merge.h>
Nikolas Klauserd2a46e62023-10-22 08:23:221865#include <__algorithm/pstl_move.h>
Nikolas Klauser51131ed2023-06-06 15:43:221866#include <__algorithm/pstl_replace.h>
Nikolas Klauser5d7f3462023-10-23 10:35:121867#include <__algorithm/pstl_rotate_copy.h>
Nikolas Klauser37e5baf2023-07-20 21:45:191868#include <__algorithm/pstl_sort.h>
Nikolas Klauserd51a84b2023-06-01 22:05:111869#include <__algorithm/pstl_stable_sort.h>
Nikolas Klauser6851d072023-05-15 14:07:451870#include <__algorithm/pstl_transform.h>
Louis Dionne134723e2021-06-17 15:30:111871#include <__algorithm/push_heap.h>
Nikolas Klauser916e9052022-06-08 10:14:121872#include <__algorithm/ranges_adjacent_find.h>
Nikolas Klauser0e3dc1a2022-05-26 14:42:461873#include <__algorithm/ranges_all_of.h>
1874#include <__algorithm/ranges_any_of.h>
Nikolas Klauser81715862022-06-05 19:15:161875#include <__algorithm/ranges_binary_search.h>
Nikolas Klausera203acb2022-08-03 23:30:501876#include <__algorithm/ranges_clamp.h>
ZijunZhaoCCKfdd089b2023-12-20 00:34:191877#include <__algorithm/ranges_contains.h>
Nikolas Klauser1d837502022-04-15 11:43:401878#include <__algorithm/ranges_copy.h>
1879#include <__algorithm/ranges_copy_backward.h>
1880#include <__algorithm/ranges_copy_if.h>
1881#include <__algorithm/ranges_copy_n.h>
Nikolas Klauser1306b102022-04-07 11:02:021882#include <__algorithm/ranges_count.h>
1883#include <__algorithm/ranges_count_if.h>
Zijun Zhao0218ea42023-09-18 18:28:111884#include <__algorithm/ranges_ends_with.h>
Nikolas Klauser569d6632022-05-25 09:09:431885#include <__algorithm/ranges_equal.h>
Hui Xie0f6364b82022-07-14 19:35:151886#include <__algorithm/ranges_equal_range.h>
Nikolas Klauser7af89a32022-05-21 16:26:291887#include <__algorithm/ranges_fill.h>
1888#include <__algorithm/ranges_fill_n.h>
Nikolas Klauseree0f8c42022-03-12 00:45:351889#include <__algorithm/ranges_find.h>
Nikolas Klauser101d1e92022-07-13 16:07:261890#include <__algorithm/ranges_find_end.h>
Nikolas Klauserb79b2b62022-06-06 11:57:341891#include <__algorithm/ranges_find_first_of.h>
Nikolas Klauseree0f8c42022-03-12 00:45:351892#include <__algorithm/ranges_find_if.h>
1893#include <__algorithm/ranges_find_if_not.h>
Nikolas Klauser80045e92022-05-04 18:27:071894#include <__algorithm/ranges_for_each.h>
1895#include <__algorithm/ranges_for_each_n.h>
Konstantin Varlamovead73022022-07-26 22:50:141896#include <__algorithm/ranges_generate.h>
1897#include <__algorithm/ranges_generate_n.h>
Hui Xiec5599642022-07-19 19:54:351898#include <__algorithm/ranges_includes.h>
Hui Xie8a617492022-07-27 12:20:161899#include <__algorithm/ranges_inplace_merge.h>
Konstantin Varlamovd406c642022-07-26 23:11:091900#include <__algorithm/ranges_is_heap.h>
1901#include <__algorithm/ranges_is_heap_until.h>
Nikolas Klauser37ba1b92022-05-04 12:19:091902#include <__algorithm/ranges_is_partitioned.h>
Nikolas Klauser4038c852022-08-04 17:54:131903#include <__algorithm/ranges_is_permutation.h>
Nikolas Klauser11e3ad22022-05-26 14:08:551904#include <__algorithm/ranges_is_sorted.h>
1905#include <__algorithm/ranges_is_sorted_until.h>
Nikolas Klauserafd5a4f2022-06-15 14:24:431906#include <__algorithm/ranges_lexicographical_compare.h>
Nikolas Klauser81715862022-06-05 19:15:161907#include <__algorithm/ranges_lower_bound.h>
Konstantin Varlamovc945bd02022-07-08 20:46:271908#include <__algorithm/ranges_make_heap.h>
Nikolas Klausere476df52022-04-03 07:17:011909#include <__algorithm/ranges_max.h>
Nikolas Klauser205557c2022-03-07 16:01:521910#include <__algorithm/ranges_max_element.h>
Hui Xie25607d12022-06-26 15:13:431911#include <__algorithm/ranges_merge.h>
Nikolas Klauserf83d8332022-03-18 01:57:081912#include <__algorithm/ranges_min.h>
Nikolas Klauser3b470d12022-02-11 12:11:571913#include <__algorithm/ranges_min_element.h>
Nikolas Klauser58d9ab72022-04-13 20:59:091914#include <__algorithm/ranges_minmax.h>
1915#include <__algorithm/ranges_minmax_element.h>
Nikolas Klauserc2cd15a2022-03-08 22:12:351916#include <__algorithm/ranges_mismatch.h>
Nikolas Klauser2c3bbac2022-06-23 10:23:411917#include <__algorithm/ranges_move.h>
1918#include <__algorithm/ranges_move_backward.h>
Nikolas Klauser68264b62022-08-03 05:40:131919#include <__algorithm/ranges_next_permutation.h>
Nikolas Klauser0e3dc1a2022-05-26 14:42:461920#include <__algorithm/ranges_none_of.h>
Konstantin Varlamov23c73282022-07-08 03:35:511921#include <__algorithm/ranges_nth_element.h>
varconst5dd19ad2022-07-20 03:10:021922#include <__algorithm/ranges_partial_sort.h>
Konstantin Varlamovdb7d7952022-07-30 09:42:051923#include <__algorithm/ranges_partial_sort_copy.h>
Konstantin Varlamov8ed702b2022-07-19 04:05:511924#include <__algorithm/ranges_partition.h>
Konstantin Varlamov065202f2022-07-20 08:57:131925#include <__algorithm/ranges_partition_copy.h>
1926#include <__algorithm/ranges_partition_point.h>
Konstantin Varlamovc945bd02022-07-08 20:46:271927#include <__algorithm/ranges_pop_heap.h>
Nikolas Klauser68264b62022-08-03 05:40:131928#include <__algorithm/ranges_prev_permutation.h>
Konstantin Varlamovc945bd02022-07-08 20:46:271929#include <__algorithm/ranges_push_heap.h>
Nikolas Klauserf8cbe3cdf2022-07-06 12:03:001930#include <__algorithm/ranges_remove.h>
Nikolas Klauser760d2b42022-08-03 05:13:591931#include <__algorithm/ranges_remove_copy.h>
1932#include <__algorithm/ranges_remove_copy_if.h>
Nikolas Klauserf8cbe3cdf2022-07-06 12:03:001933#include <__algorithm/ranges_remove_if.h>
Nikolas Klauserff6d5de2022-06-07 07:42:101934#include <__algorithm/ranges_replace.h>
Nikolas Klauser93172c12022-08-03 05:25:001935#include <__algorithm/ranges_replace_copy.h>
1936#include <__algorithm/ranges_replace_copy_if.h>
Nikolas Klauserff6d5de2022-06-07 07:42:101937#include <__algorithm/ranges_replace_if.h>
Nikolas Klauser1d1a1912022-05-24 08:32:501938#include <__algorithm/ranges_reverse.h>
Nikolas Klauser7d426a32022-07-11 15:07:351939#include <__algorithm/ranges_reverse_copy.h>
Konstantin Varlamov36c746c2022-08-03 23:04:141940#include <__algorithm/ranges_rotate.h>
Nikolas Klauser7d426a32022-07-11 15:07:351941#include <__algorithm/ranges_rotate_copy.h>
Konstantin Varlamov6bdb6422022-08-03 05:33:121942#include <__algorithm/ranges_sample.h>
Nikolas Klauser101d1e92022-07-13 16:07:261943#include <__algorithm/ranges_search.h>
1944#include <__algorithm/ranges_search_n.h>
Hui Xie1cdec6c2022-06-26 15:13:431945#include <__algorithm/ranges_set_difference.h>
Hui Xie96b674f2022-07-08 14:21:401946#include <__algorithm/ranges_set_intersection.h>
Hui Xiea5c06382022-07-11 22:39:591947#include <__algorithm/ranges_set_symmetric_difference.h>
Hui Xie3151b952022-07-13 16:20:221948#include <__algorithm/ranges_set_union.h>
Konstantin Varlamov14cf74d2022-07-22 16:58:561949#include <__algorithm/ranges_shuffle.h>
Konstantin Varlamovff3989e2022-06-16 22:20:531950#include <__algorithm/ranges_sort.h>
Konstantin Varlamovc945bd02022-07-08 20:46:271951#include <__algorithm/ranges_sort_heap.h>
Konstantin Varlamov8ed702b2022-07-19 04:05:511952#include <__algorithm/ranges_stable_partition.h>
Konstantin Varlamov94c7b892022-07-01 23:34:081953#include <__algorithm/ranges_stable_sort.h>
zijunzhao20517552023-05-08 22:04:001954#include <__algorithm/ranges_starts_with.h>
Nikolas Klauser9d905312022-02-10 12:33:031955#include <__algorithm/ranges_swap_ranges.h>
Nikolas Klauser3ba85482022-04-05 09:05:361956#include <__algorithm/ranges_transform.h>
Hui Xie72f57e32022-07-23 00:44:251957#include <__algorithm/ranges_unique.h>
1958#include <__algorithm/ranges_unique_copy.h>
Nikolas Klauser81715862022-06-05 19:15:161959#include <__algorithm/ranges_upper_bound.h>
Louis Dionne134723e2021-06-17 15:30:111960#include <__algorithm/remove.h>
1961#include <__algorithm/remove_copy.h>
1962#include <__algorithm/remove_copy_if.h>
1963#include <__algorithm/remove_if.h>
1964#include <__algorithm/replace.h>
1965#include <__algorithm/replace_copy.h>
1966#include <__algorithm/replace_copy_if.h>
1967#include <__algorithm/replace_if.h>
1968#include <__algorithm/reverse.h>
1969#include <__algorithm/reverse_copy.h>
1970#include <__algorithm/rotate.h>
1971#include <__algorithm/rotate_copy.h>
1972#include <__algorithm/sample.h>
1973#include <__algorithm/search.h>
1974#include <__algorithm/search_n.h>
1975#include <__algorithm/set_difference.h>
1976#include <__algorithm/set_intersection.h>
1977#include <__algorithm/set_symmetric_difference.h>
1978#include <__algorithm/set_union.h>
1979#include <__algorithm/shift_left.h>
1980#include <__algorithm/shift_right.h>
1981#include <__algorithm/shuffle.h>
1982#include <__algorithm/sift_down.h>
1983#include <__algorithm/sort.h>
1984#include <__algorithm/sort_heap.h>
1985#include <__algorithm/stable_partition.h>
1986#include <__algorithm/stable_sort.h>
Christopher Di Bella6adbc832021-06-05 02:47:471987#include <__algorithm/swap_ranges.h>
Louis Dionne134723e2021-06-17 15:30:111988#include <__algorithm/transform.h>
Louis Dionne134723e2021-06-17 15:30:111989#include <__algorithm/unique.h>
Arthur O'Dwyer4d81a462022-01-07 14:45:051990#include <__algorithm/unique_copy.h>
Louis Dionne134723e2021-06-17 15:30:111991#include <__algorithm/unwrap_iter.h>
1992#include <__algorithm/upper_bound.h>
Eric Fiselierc1bd9192014-08-10 23:53:081993
Nikolas Klauserdb1978b2022-06-16 20:43:461994// standard-mandated includes
Nikolas Klauser473a1602022-09-22 16:05:081995
1996// [algorithm.syn]
Nikolas Klauserdb1978b2022-06-16 20:43:461997#include <initializer_list>
1998
Howard Hinnant073458b2011-10-17 20:05:101999#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
Arthur O'Dwyerfa6b9e42022-02-02 01:16:402000# pragma GCC system_header
Howard Hinnant073458b2011-10-17 20:05:102001#endif
Howard Hinnant3e519522010-05-11 19:42:162002
Mark de Wevere31c2a12022-09-02 15:53:282003#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
Nikolas Klauserd5e26772022-09-04 22:01:152004# include <atomic>
Nikolas Klauser40a20ae2023-01-08 14:26:322005# include <bit>
Nikolas Klauser89b356f2022-11-02 19:27:422006# include <concepts>
Nikolas Klauser75196f82023-01-08 15:47:532007# include <cstdlib>
varconst5629d492023-01-14 00:56:582008# include <cstring>
Mark de Wevere31c2a12022-09-02 15:53:282009# include <iterator>
Nikolas Klauserd5e26772022-09-04 22:01:152010# include <memory>
2011# include <stdexcept>
Nikolas Klausere698c592022-12-26 15:24:012012# include <type_traits>
Mark de Wevere31c2a12022-09-02 15:53:282013# include <utility>
2014#endif
2015
Louis Dionne4cd6ca12021-04-20 16:03:322016#endif // _LIBCPP_ALGORITHM