blob: 1a75dc0dacb22b4a8d455f3a91e1a72dc9c66afa [file] [log] [blame]
Howard Hinnantc51e1022010-05-11 19:42:16 +00001// -*- C++ -*-
Louis Dionne9bd93882021-11-17 16:25:01 -05002//===----------------------------------------------------------------------===//
Howard Hinnantc51e1022010-05-11 19:42:16 +00003//
Chandler Carruthd2012102019-01-19 10:56:40 +00004// 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 Hinnantc51e1022010-05-11 19:42:16 +00007//
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 Klauserf74be4e2022-01-14 02:55:51 +010021namespace ranges {
Nikolas Klauser671b4752022-02-11 17:01:58 +010022 template <class I, class F>
Nikolas Klauser2e263162022-02-21 22:48:36 +010023 struct in_fun_result; // since C++20
Nikolas Klauser671b4752022-02-11 17:01:58 +010024
Nikolas Klauserf74be4e2022-01-14 02:55:51 +010025 template <class I1, class I2>
Nikolas Klauser2e263162022-02-21 22:48:36 +010026 struct in_in_result; // since C++20
Nikolas Klauser05e2cd82022-01-25 11:21:47 +010027
28 template <class I1, class I2, class O>
Nikolas Klauser2e263162022-02-21 22:48:36 +010029 struct in_in_out_result; // since C++20
Nikolas Klauser61ce8162022-02-03 02:17:03 +010030
31 template <class I, class O1, class O2>
32 struct in_out_out_result; // since C++20
Nikolas Klauser671b4752022-02-11 17:01:58 +010033
Nikolas Klauser2e263162022-02-21 22:48:36 +010034 template <class I1, class I2>
35 struct min_max_result; // since C++20
36
Nikolas Klauserdd5ad212022-02-21 23:07:02 +010037 template <class I>
38 struct in_found_result; // since C++20
39
Nikolas Klauser0a62a172022-02-11 13:11:57 +010040 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
41 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> // since C++20
42 constexpr I min_element(I first, S last, Comp comp = {}, Proj proj = {});
43
44 template<forward_range R, class Proj = identity,
45 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> // since C++20
46 constexpr borrowed_iterator_t<R> min_element(R&& r, Comp comp = {}, Proj proj = {});
Nikolas Klauser12fc9bf2022-03-08 23:12:35 +010047
48 template <input_iterator I1, sentinel_for<_I1> S1, input_iterator I2, sentinel_for<_I2> S2,
49 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
50 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
51 constexpr mismatch_result<_I1, _I2>
52 mismatch()(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}) // since C++20
53
54 template <input_range R1, input_range R2,
55 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
56 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
57 constexpr mismatch_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
58 mismatch(R1&& r1, R2&& r2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}) // since C++20
Nikolas Klauser37d076e2022-03-12 01:45:35 +010059
Nikolas Klauser37d076e2022-03-12 01:45:35 +010060 requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
61 constexpr I find(I first, S last, const T& value, Proj proj = {}); // since C++20
62
63 template<input_range R, class T, class Proj = identity>
64 requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
65 constexpr borrowed_iterator_t<R>
66 find(R&& r, const T& value, Proj proj = {}); // since C++20
67
68 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
69 indirect_unary_predicate<projected<I, Proj>> Pred>
70 constexpr I find_if(I first, S last, Pred pred, Proj proj = {}); // since C++20
71
72 template<input_range R, class Proj = identity,
73 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
74 constexpr borrowed_iterator_t<R>
75 find_if(R&& r, Pred pred, Proj proj = {}); // since C++20
76
77 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
78 indirect_unary_predicate<projected<I, Proj>> Pred>
79 constexpr I find_if_not(I first, S last, Pred pred, Proj proj = {}); // since C++20
80
81 template<input_range R, class Proj = identity,
82 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
83 constexpr borrowed_iterator_t<R>
84 find_if_not(R&& r, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser3559e452022-03-18 02:57:08 +010085
Nikolas Klauser573cd6f2022-04-03 09:17:01 +020086 template<class T, class Proj = identity,
87 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
88 constexpr const T& min(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser3559e452022-03-18 02:57:08 +010089
Nikolas Klauser573cd6f2022-04-03 09:17:01 +020090 template<copyable T, class Proj = identity,
91 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
92 constexpr T min(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser3559e452022-03-18 02:57:08 +010093
94 template<input_range R, class Proj = identity,
95 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
96 requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
97 constexpr range_value_t<R>
98 min(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser573cd6f2022-04-03 09:17:01 +020099
100 template<class T, class Proj = identity,
101 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
102 constexpr const T& max(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20
103
104 template<copyable T, class Proj = identity,
105 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
106 constexpr T max(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20
107
108 template<input_range R, class Proj = identity,
109 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
110 requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
111 constexpr range_value_t<R>
112 max(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser559a1772022-04-05 11:05:36 +0200113
114 template<class I, class O>
115 using unary_transform_result = in_out_result<I, O>; // since C++20
116
117 template<class I1, class I2, class O>
118 using binary_transform_result = in_in_out_result<I1, I2, O>; // since C++20
119
120 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O,
121 copy_constructible F, class Proj = identity>
122 requires indirectly_writable<O, indirect_result_t<F&, projected<I, Proj>>>
123 constexpr ranges::unary_transform_result<I, O>
124 transform(I first1, S last1, O result, F op, Proj proj = {}); // since C++20
125
126 template<input_range R, weakly_incrementable O, copy_constructible F,
127 class Proj = identity>
128 requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R>, Proj>>>
129 constexpr ranges::unary_transform_result<borrowed_iterator_t<R>, O>
130 transform(R&& r, O result, F op, Proj proj = {}); // since C++20
131
132 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
133 weakly_incrementable O, copy_constructible F, class Proj1 = identity,
134 class Proj2 = identity>
135 requires indirectly_writable<O, indirect_result_t<F&, projected<I1, Proj1>,
136 projected<I2, Proj2>>>
137 constexpr ranges::binary_transform_result<I1, I2, O>
138 transform(I1 first1, S1 last1, I2 first2, S2 last2, O result,
139 F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
140
141 template<input_range R1, input_range R2, weakly_incrementable O,
142 copy_constructible F, class Proj1 = identity, class Proj2 = identity>
143 requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R1>, Proj1>,
144 projected<iterator_t<R2>, Proj2>>>
145 constexpr ranges::binary_transform_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
146 transform(R1&& r1, R2&& r2, O result,
147 F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauserf1373d02022-04-07 13:02:02 +0200148
149 template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity>
150 requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
151 constexpr iter_difference_t<I>
152 count(I first, S last, const T& value, Proj proj = {}); // since C++20
153
154 template<input_range R, class T, class Proj = identity>
155 requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
156 constexpr range_difference_t<R>
157 count(R&& r, const T& value, Proj proj = {}); // since C++20
158
159 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
160 indirect_unary_predicate<projected<I, Proj>> Pred>
161 constexpr iter_difference_t<I>
162 count_if(I first, S last, Pred pred, Proj proj = {}); // since C++20
163
164 template<input_range R, class Proj = identity,
165 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
166 constexpr range_difference_t<R>
167 count_if(R&& r, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser0a2f44f2022-04-13 22:59:09 +0200168
169 template<class T, class Proj = identity,
170 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
171 constexpr ranges::minmax_result<const T&>
172 minmax(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20
173
174 template<copyable T, class Proj = identity,
175 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
176 constexpr ranges::minmax_result<T>
177 minmax(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20
178
179 template<input_range R, class Proj = identity,
180 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
181 requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
182 constexpr ranges::minmax_result<range_value_t<R>>
183 minmax(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
184
185 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
186 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
187 constexpr ranges::minmax_element_result<I>
188 minmax_element(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
189
190 template<forward_range R, class Proj = identity,
191 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
192 constexpr ranges::minmax_element_result<borrowed_iterator_t<R>>
193 minmax_element(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauserd959d842022-04-15 13:43:40 +0200194
195 template<class I, class O>
196 using copy_result = in_out_result<I, O>; // since C++20
197
198 template<class I, class O>
199 using copy_n_result = in_out_result<I, O>; // since C++20
200
201 template<class I, class O>
202 using copy_if_result = in_out_result<I, O>; // since C++20
203
204 template<class I1, class I2>
205 using copy_backward_result = in_out_result<I1, I2>; // since C++20
206
207 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O>
208 requires indirectly_copyable<I, O>
209 constexpr ranges::copy_result<I, O> ranges::copy(I first, S last, O result); // since C++20
210
211 template<input_range R, weakly_incrementable O>
212 requires indirectly_copyable<iterator_t<R>, O>
213 constexpr ranges::copy_result<borrowed_iterator_t<R>, O> ranges::copy(R&& r, O result); // since C++20
214
215 template<input_iterator I, weakly_incrementable O>
216 requires indirectly_copyable<I, O>
217 constexpr ranges::copy_n_result<I, O>
218 ranges::copy_n(I first, iter_difference_t<I> n, O result); // since C++20
219
220 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Proj = identity,
221 indirect_unary_predicate<projected<I, Proj>> Pred>
222 requires indirectly_copyable<I, O>
223 constexpr ranges::copy_if_result<I, O>
224 ranges::copy_if(I first, S last, O result, Pred pred, Proj proj = {}); // since C++20
225
226 template<input_range R, weakly_incrementable O, class Proj = identity,
227 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
228 requires indirectly_copyable<iterator_t<R>, O>
229 constexpr ranges::copy_if_result<borrowed_iterator_t<R>, O>
230 ranges::copy_if(R&& r, O result, Pred pred, Proj proj = {}); // since C++20
231
232 template<bidirectional_iterator I1, sentinel_for<I1> S1, bidirectional_iterator I2>
233 requires indirectly_copyable<I1, I2>
234 constexpr ranges::copy_backward_result<I1, I2>
235 ranges::copy_backward(I1 first, S1 last, I2 result); // since C++20
236
237 template<bidirectional_range R, bidirectional_iterator I>
238 requires indirectly_copyable<iterator_t<R>, I>
239 constexpr ranges::copy_backward_result<borrowed_iterator_t<R>, I>
240 ranges::copy_backward(R&& r, I result); // since C++20
Nikolas Klauser58de98c2022-05-04 20:27:07 +0200241
242 template<class I, class F>
243 using for_each_result = in_fun_result<I, F>; // since C++20
244
245 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
246 indirectly_unary_invocable<projected<I, Proj>> Fun>
247 constexpr ranges::for_each_result<I, Fun>
248 ranges::for_each(I first, S last, Fun f, Proj proj = {}); // since C++20
249
250 template<input_range R, class Proj = identity,
251 indirectly_unary_invocable<projected<iterator_t<R>, Proj>> Fun>
252 constexpr ranges::for_each_result<borrowed_iterator_t<R>, Fun>
253 ranges::for_each(R&& r, Fun f, Proj proj = {}); // since C++20
254
255 template<input_iterator I, class Proj = identity,
256 indirectly_unary_invocable<projected<I, Proj>> Fun>
257 constexpr ranges::for_each_n_result<I, Fun>
258 ranges::for_each_n(I first, iter_difference_t<I> n, Fun f, Proj proj = {}); // since C++20
Nikolas Klauserbb9049d2022-05-04 14:19:09 +0200259
260 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
261 indirect_unary_predicate<projected<I, Proj>> Pred>
262 constexpr bool ranges::is_partitioned(I first, S last, Pred pred, Proj proj = {}); // since C++20
263
264 template<input_range R, class Proj = identity,
265 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
266 constexpr bool ranges::is_partitioned(R&& r, Pred pred, Proj proj = {}); // since C++20
267
Nikolas Klauserf74be4e2022-01-14 02:55:51 +0100268}
269
Marshall Clowd607fdb2018-01-15 17:20:36 +0000270 constexpr bool // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000271 all_of(InputIterator first, InputIterator last, Predicate pred);
272
273template <class InputIterator, class Predicate>
Marshall Clowd607fdb2018-01-15 17:20:36 +0000274 constexpr bool // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000275 any_of(InputIterator first, InputIterator last, Predicate pred);
276
277template <class InputIterator, class Predicate>
Marshall Clowd607fdb2018-01-15 17:20:36 +0000278 constexpr bool // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000279 none_of(InputIterator first, InputIterator last, Predicate pred);
280
281template <class InputIterator, class Function>
Marshall Clow5492c8a2018-01-22 20:44:33 +0000282 constexpr Function // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000283 for_each(InputIterator first, InputIterator last, Function f);
284
Marshall Clowde0169c2017-05-25 02:29:54 +0000285template<class InputIterator, class Size, class Function>
Marshall Clow5492c8a2018-01-22 20:44:33 +0000286 constexpr InputIterator // constexpr in C++20
287 for_each_n(InputIterator first, Size n, Function f); // C++17
Marshall Clowde0169c2017-05-25 02:29:54 +0000288
Howard Hinnantc51e1022010-05-11 19:42:16 +0000289template <class InputIterator, class T>
Marshall Clowee0161e2018-01-15 19:26:05 +0000290 constexpr InputIterator // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000291 find(InputIterator first, InputIterator last, const T& value);
292
293template <class InputIterator, class Predicate>
Marshall Clowee0161e2018-01-15 19:26:05 +0000294 constexpr InputIterator // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000295 find_if(InputIterator first, InputIterator last, Predicate pred);
296
297template<class InputIterator, class Predicate>
Arthur O'Dwyer20353a72020-12-02 20:02:18 -0500298 constexpr InputIterator // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000299 find_if_not(InputIterator first, InputIterator last, Predicate pred);
300
301template <class ForwardIterator1, class ForwardIterator2>
Arthur O'Dwyer20353a72020-12-02 20:02:18 -0500302 constexpr ForwardIterator1 // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000303 find_end(ForwardIterator1 first1, ForwardIterator1 last1,
304 ForwardIterator2 first2, ForwardIterator2 last2);
305
306template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
Arthur O'Dwyer20353a72020-12-02 20:02:18 -0500307 constexpr ForwardIterator1 // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000308 find_end(ForwardIterator1 first1, ForwardIterator1 last1,
309 ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
310
311template <class ForwardIterator1, class ForwardIterator2>
Marshall Clowee0161e2018-01-15 19:26:05 +0000312 constexpr ForwardIterator1 // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000313 find_first_of(ForwardIterator1 first1, ForwardIterator1 last1,
314 ForwardIterator2 first2, ForwardIterator2 last2);
315
316template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
Marshall Clowee0161e2018-01-15 19:26:05 +0000317 constexpr ForwardIterator1 // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000318 find_first_of(ForwardIterator1 first1, ForwardIterator1 last1,
319 ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
320
321template <class ForwardIterator>
Marshall Clowee0161e2018-01-15 19:26:05 +0000322 constexpr ForwardIterator // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000323 adjacent_find(ForwardIterator first, ForwardIterator last);
324
325template <class ForwardIterator, class BinaryPredicate>
Marshall Clowee0161e2018-01-15 19:26:05 +0000326 constexpr ForwardIterator // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000327 adjacent_find(ForwardIterator first, ForwardIterator last, BinaryPredicate pred);
328
329template <class InputIterator, class T>
Marshall Clow3c0558f2018-01-15 19:40:34 +0000330 constexpr typename iterator_traits<InputIterator>::difference_type // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000331 count(InputIterator first, InputIterator last, const T& value);
332
333template <class InputIterator, class Predicate>
Marshall Clow3c0558f2018-01-15 19:40:34 +0000334 constexpr typename iterator_traits<InputIterator>::difference_type // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000335 count_if(InputIterator first, InputIterator last, Predicate pred);
336
337template <class InputIterator1, class InputIterator2>
Marshall Clow30bf3022018-01-16 02:04:10 +0000338 constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000339 mismatch(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2);
340
Marshall Clow96b42b22013-05-09 21:14:23 +0000341template <class InputIterator1, class InputIterator2>
Marshall Clow30bf3022018-01-16 02:04:10 +0000342 constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20
Aditya Kumar3a0179a2016-08-25 11:52:38 +0000343 mismatch(InputIterator1 first1, InputIterator1 last1,
Marshall Clow96b42b22013-05-09 21:14:23 +0000344 InputIterator2 first2, InputIterator2 last2); // **C++14**
345
Howard Hinnantc51e1022010-05-11 19:42:16 +0000346template <class InputIterator1, class InputIterator2, class BinaryPredicate>
Marshall Clow30bf3022018-01-16 02:04:10 +0000347 constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000348 mismatch(InputIterator1 first1, InputIterator1 last1,
349 InputIterator2 first2, BinaryPredicate pred);
350
Marshall Clow96b42b22013-05-09 21:14:23 +0000351template <class InputIterator1, class InputIterator2, class BinaryPredicate>
Marshall Clow30bf3022018-01-16 02:04:10 +0000352 constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20
Marshall Clow96b42b22013-05-09 21:14:23 +0000353 mismatch(InputIterator1 first1, InputIterator1 last1,
354 InputIterator2 first2, InputIterator2 last2,
355 BinaryPredicate pred); // **C++14**
356
Howard Hinnantc51e1022010-05-11 19:42:16 +0000357template <class InputIterator1, class InputIterator2>
Marshall Clow30bf3022018-01-16 02:04:10 +0000358 constexpr bool // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000359 equal(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2);
360
Marshall Clow96b42b22013-05-09 21:14:23 +0000361template <class InputIterator1, class InputIterator2>
Marshall Clow30bf3022018-01-16 02:04:10 +0000362 constexpr bool // constexpr in C++20
Aditya Kumar3a0179a2016-08-25 11:52:38 +0000363 equal(InputIterator1 first1, InputIterator1 last1,
Marshall Clow96b42b22013-05-09 21:14:23 +0000364 InputIterator2 first2, InputIterator2 last2); // **C++14**
365
Howard Hinnantc51e1022010-05-11 19:42:16 +0000366template <class InputIterator1, class InputIterator2, class BinaryPredicate>
Marshall Clow30bf3022018-01-16 02:04:10 +0000367 constexpr bool // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000368 equal(InputIterator1 first1, InputIterator1 last1,
369 InputIterator2 first2, BinaryPredicate pred);
370
Marshall Clow96b42b22013-05-09 21:14:23 +0000371template <class InputIterator1, class InputIterator2, class BinaryPredicate>
Marshall Clow30bf3022018-01-16 02:04:10 +0000372 constexpr bool // constexpr in C++20
Marshall Clow96b42b22013-05-09 21:14:23 +0000373 equal(InputIterator1 first1, InputIterator1 last1,
374 InputIterator2 first2, InputIterator2 last2,
375 BinaryPredicate pred); // **C++14**
376
Howard Hinnantc51e1022010-05-11 19:42:16 +0000377template<class ForwardIterator1, class ForwardIterator2>
Marshall Clow96d050a2018-01-15 16:16:32 +0000378 constexpr bool // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000379 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
380 ForwardIterator2 first2);
381
Marshall Clow96b42b22013-05-09 21:14:23 +0000382template<class ForwardIterator1, class ForwardIterator2>
Marshall Clow96d050a2018-01-15 16:16:32 +0000383 constexpr bool // constexpr in C++20
Marshall Clow96b42b22013-05-09 21:14:23 +0000384 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
385 ForwardIterator2 first2, ForwardIterator2 last2); // **C++14**
386
Howard Hinnantc51e1022010-05-11 19:42:16 +0000387template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
Marshall Clow96d050a2018-01-15 16:16:32 +0000388 constexpr bool // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000389 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
390 ForwardIterator2 first2, BinaryPredicate pred);
391
Marshall Clow96b42b22013-05-09 21:14:23 +0000392template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
Marshall Clow96d050a2018-01-15 16:16:32 +0000393 constexpr bool // constexpr in C++20
Marshall Clow96b42b22013-05-09 21:14:23 +0000394 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
395 ForwardIterator2 first2, ForwardIterator2 last2,
396 BinaryPredicate pred); // **C++14**
397
Howard Hinnantc51e1022010-05-11 19:42:16 +0000398template <class ForwardIterator1, class ForwardIterator2>
Marshall Clow323fc5b2018-01-16 15:48:27 +0000399 constexpr ForwardIterator1 // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000400 search(ForwardIterator1 first1, ForwardIterator1 last1,
401 ForwardIterator2 first2, ForwardIterator2 last2);
402
403template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
Marshall Clow323fc5b2018-01-16 15:48:27 +0000404 constexpr ForwardIterator1 // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000405 search(ForwardIterator1 first1, ForwardIterator1 last1,
406 ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
407
408template <class ForwardIterator, class Size, class T>
Marshall Clow323fc5b2018-01-16 15:48:27 +0000409 constexpr ForwardIterator // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000410 search_n(ForwardIterator first, ForwardIterator last, Size count, const T& value);
411
412template <class ForwardIterator, class Size, class T, class BinaryPredicate>
Marshall Clow323fc5b2018-01-16 15:48:27 +0000413 constexpr ForwardIterator // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000414 search_n(ForwardIterator first, ForwardIterator last,
415 Size count, const T& value, BinaryPredicate pred);
416
417template <class InputIterator, class OutputIterator>
Louis Dionne65b433b2019-11-06 12:02:41 +0000418 constexpr OutputIterator // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000419 copy(InputIterator first, InputIterator last, OutputIterator result);
420
421template<class InputIterator, class OutputIterator, class Predicate>
Louis Dionne65b433b2019-11-06 12:02:41 +0000422 constexpr OutputIterator // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000423 copy_if(InputIterator first, InputIterator last,
424 OutputIterator result, Predicate pred);
425
426template<class InputIterator, class Size, class OutputIterator>
Louis Dionne65b433b2019-11-06 12:02:41 +0000427 constexpr OutputIterator // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000428 copy_n(InputIterator first, Size n, OutputIterator result);
429
430template <class BidirectionalIterator1, class BidirectionalIterator2>
Louis Dionne65b433b2019-11-06 12:02:41 +0000431 constexpr BidirectionalIterator2 // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000432 copy_backward(BidirectionalIterator1 first, BidirectionalIterator1 last,
433 BidirectionalIterator2 result);
434
435template <class ForwardIterator1, class ForwardIterator2>
Arthur O'Dwyer20353a72020-12-02 20:02:18 -0500436 constexpr ForwardIterator2 // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000437 swap_ranges(ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2);
438
Nikolas Klauser4ceab5f2022-02-10 13:33:03 +0100439template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2>
440 requires indirectly_swappable<I1, I2>
441 constexpr ranges::swap_ranges_result<I1, I2>
442 ranges::swap_ranges(I1 first1, S1 last1, I2 first2, S2 last2);
443
444template<input_range R1, input_range R2>
445 requires indirectly_swappable<iterator_t<R1>, iterator_t<R2>>
446 constexpr ranges::swap_ranges_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
447 ranges::swap_ranges(R1&& r1, R2&& r2);
448
Howard Hinnantc51e1022010-05-11 19:42:16 +0000449template <class ForwardIterator1, class ForwardIterator2>
Arthur O'Dwyer20353a72020-12-02 20:02:18 -0500450 constexpr void // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000451 iter_swap(ForwardIterator1 a, ForwardIterator2 b);
452
453template <class InputIterator, class OutputIterator, class UnaryOperation>
Marshall Clow31427c62018-01-19 17:45:39 +0000454 constexpr OutputIterator // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000455 transform(InputIterator first, InputIterator last, OutputIterator result, UnaryOperation op);
456
457template <class InputIterator1, class InputIterator2, class OutputIterator, class BinaryOperation>
Marshall Clow31427c62018-01-19 17:45:39 +0000458 constexpr OutputIterator // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000459 transform(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2,
460 OutputIterator result, BinaryOperation binary_op);
461
462template <class ForwardIterator, class T>
Marshall Clow01bbbd22018-01-19 18:07:29 +0000463 constexpr void // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000464 replace(ForwardIterator first, ForwardIterator last, const T& old_value, const T& new_value);
465
466template <class ForwardIterator, class Predicate, class T>
Marshall Clow01bbbd22018-01-19 18:07:29 +0000467 constexpr void // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000468 replace_if(ForwardIterator first, ForwardIterator last, Predicate pred, const T& new_value);
469
470template <class InputIterator, class OutputIterator, class T>
Marshall Clow01bbbd22018-01-19 18:07:29 +0000471 constexpr OutputIterator // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000472 replace_copy(InputIterator first, InputIterator last, OutputIterator result,
473 const T& old_value, const T& new_value);
474
475template <class InputIterator, class OutputIterator, class Predicate, class T>
Marshall Clow01bbbd22018-01-19 18:07:29 +0000476 constexpr OutputIterator // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000477 replace_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred, const T& new_value);
478
479template <class ForwardIterator, class T>
Marshall Clowe9cdc5c2018-01-20 20:14:32 +0000480 constexpr void // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000481 fill(ForwardIterator first, ForwardIterator last, const T& value);
482
483template <class OutputIterator, class Size, class T>
Marshall Clowe9cdc5c2018-01-20 20:14:32 +0000484 constexpr OutputIterator // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000485 fill_n(OutputIterator first, Size n, const T& value);
486
487template <class ForwardIterator, class Generator>
Marshall Clowe9cdc5c2018-01-20 20:14:32 +0000488 constexpr void // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000489 generate(ForwardIterator first, ForwardIterator last, Generator gen);
490
491template <class OutputIterator, class Size, class Generator>
Marshall Clowe9cdc5c2018-01-20 20:14:32 +0000492 constexpr OutputIterator // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000493 generate_n(OutputIterator first, Size n, Generator gen);
494
495template <class ForwardIterator, class T>
Marshall Clow7c0fbd82018-01-22 21:43:04 +0000496 constexpr ForwardIterator // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000497 remove(ForwardIterator first, ForwardIterator last, const T& value);
498
499template <class ForwardIterator, class Predicate>
Marshall Clow7c0fbd82018-01-22 21:43:04 +0000500 constexpr ForwardIterator // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000501 remove_if(ForwardIterator first, ForwardIterator last, Predicate pred);
502
503template <class InputIterator, class OutputIterator, class T>
Marshall Clow7c0fbd82018-01-22 21:43:04 +0000504 constexpr OutputIterator // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000505 remove_copy(InputIterator first, InputIterator last, OutputIterator result, const T& value);
506
507template <class InputIterator, class OutputIterator, class Predicate>
Marshall Clow7c0fbd82018-01-22 21:43:04 +0000508 constexpr OutputIterator // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000509 remove_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred);
510
511template <class ForwardIterator>
Arthur O'Dwyer20353a72020-12-02 20:02:18 -0500512 constexpr ForwardIterator // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000513 unique(ForwardIterator first, ForwardIterator last);
514
515template <class ForwardIterator, class BinaryPredicate>
Arthur O'Dwyer20353a72020-12-02 20:02:18 -0500516 constexpr ForwardIterator // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000517 unique(ForwardIterator first, ForwardIterator last, BinaryPredicate pred);
518
519template <class InputIterator, class OutputIterator>
Arthur O'Dwyer20353a72020-12-02 20:02:18 -0500520 constexpr OutputIterator // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000521 unique_copy(InputIterator first, InputIterator last, OutputIterator result);
522
523template <class InputIterator, class OutputIterator, class BinaryPredicate>
Arthur O'Dwyer20353a72020-12-02 20:02:18 -0500524 constexpr OutputIterator // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000525 unique_copy(InputIterator first, InputIterator last, OutputIterator result, BinaryPredicate pred);
526
527template <class BidirectionalIterator>
Arthur O'Dwyere50e7472020-12-17 00:01:08 -0500528 constexpr void // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000529 reverse(BidirectionalIterator first, BidirectionalIterator last);
530
531template <class BidirectionalIterator, class OutputIterator>
Marshall Clow7c0fbd82018-01-22 21:43:04 +0000532 constexpr OutputIterator // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000533 reverse_copy(BidirectionalIterator first, BidirectionalIterator last, OutputIterator result);
534
535template <class ForwardIterator>
Arthur O'Dwyer20353a72020-12-02 20:02:18 -0500536 constexpr ForwardIterator // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000537 rotate(ForwardIterator first, ForwardIterator middle, ForwardIterator last);
538
539template <class ForwardIterator, class OutputIterator>
Arthur O'Dwyer20353a72020-12-02 20:02:18 -0500540 constexpr OutputIterator // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000541 rotate_copy(ForwardIterator first, ForwardIterator middle, ForwardIterator last, OutputIterator result);
542
543template <class RandomAccessIterator>
544 void
Marshall Clowfac06e52017-03-23 13:43:37 +0000545 random_shuffle(RandomAccessIterator first, RandomAccessIterator last); // deprecated in C++14, removed in C++17
Howard Hinnantc51e1022010-05-11 19:42:16 +0000546
547template <class RandomAccessIterator, class RandomNumberGenerator>
548 void
Marshall Clow83f35392014-03-03 06:14:19 +0000549 random_shuffle(RandomAccessIterator first, RandomAccessIterator last,
Marshall Clowfac06e52017-03-23 13:43:37 +0000550 RandomNumberGenerator& rand); // deprecated in C++14, removed in C++17
Howard Hinnantc51e1022010-05-11 19:42:16 +0000551
Eric Fiselier1208fcd2016-08-28 22:14:37 +0000552template<class PopulationIterator, class SampleIterator,
553 class Distance, class UniformRandomBitGenerator>
554 SampleIterator sample(PopulationIterator first, PopulationIterator last,
555 SampleIterator out, Distance n,
556 UniformRandomBitGenerator&& g); // C++17
557
Howard Hinnant578ac0f2010-05-26 17:49:34 +0000558template<class RandomAccessIterator, class UniformRandomNumberGenerator>
559 void shuffle(RandomAccessIterator first, RandomAccessIterator last,
Howard Hinnanta5e71782010-11-18 01:47:02 +0000560 UniformRandomNumberGenerator&& g);
Howard Hinnant578ac0f2010-05-26 17:49:34 +0000561
Arthur O'Dwyercea050d2020-12-26 01:39:03 -0500562template<class ForwardIterator>
563 constexpr ForwardIterator
564 shift_left(ForwardIterator first, ForwardIterator last,
565 typename iterator_traits<ForwardIterator>::difference_type n); // C++20
566
567template<class ForwardIterator>
568 constexpr ForwardIterator
569 shift_right(ForwardIterator first, ForwardIterator last,
570 typename iterator_traits<ForwardIterator>::difference_type n); // C++20
571
Howard Hinnantc51e1022010-05-11 19:42:16 +0000572template <class InputIterator, class Predicate>
Marshall Clow96d050a2018-01-15 16:16:32 +0000573 constexpr bool // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000574 is_partitioned(InputIterator first, InputIterator last, Predicate pred);
575
576template <class ForwardIterator, class Predicate>
Arthur O'Dwyere50e7472020-12-17 00:01:08 -0500577 constexpr ForwardIterator // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000578 partition(ForwardIterator first, ForwardIterator last, Predicate pred);
579
580template <class InputIterator, class OutputIterator1,
581 class OutputIterator2, class Predicate>
Marshall Clow5492c8a2018-01-22 20:44:33 +0000582 constexpr pair<OutputIterator1, OutputIterator2> // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000583 partition_copy(InputIterator first, InputIterator last,
584 OutputIterator1 out_true, OutputIterator2 out_false,
585 Predicate pred);
586
587template <class ForwardIterator, class Predicate>
588 ForwardIterator
589 stable_partition(ForwardIterator first, ForwardIterator last, Predicate pred);
590
591template<class ForwardIterator, class Predicate>
Marshall Clowe00916c2018-01-16 02:34:41 +0000592 constexpr ForwardIterator // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000593 partition_point(ForwardIterator first, ForwardIterator last, Predicate pred);
594
595template <class ForwardIterator>
Marshall Clow96d050a2018-01-15 16:16:32 +0000596 constexpr bool // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000597 is_sorted(ForwardIterator first, ForwardIterator last);
598
599template <class ForwardIterator, class Compare>
Arthur O'Dwyer20353a72020-12-02 20:02:18 -0500600 constexpr bool // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000601 is_sorted(ForwardIterator first, ForwardIterator last, Compare comp);
602
603template<class ForwardIterator>
Marshall Clow3c0558f2018-01-15 19:40:34 +0000604 constexpr ForwardIterator // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000605 is_sorted_until(ForwardIterator first, ForwardIterator last);
606
607template <class ForwardIterator, class Compare>
Marshall Clow3c0558f2018-01-15 19:40:34 +0000608 constexpr ForwardIterator // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000609 is_sorted_until(ForwardIterator first, ForwardIterator last, Compare comp);
610
611template <class RandomAccessIterator>
Arthur O'Dwyer1bb0f672020-12-20 15:21:42 -0500612 constexpr void // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000613 sort(RandomAccessIterator first, RandomAccessIterator last);
614
615template <class RandomAccessIterator, class Compare>
Arthur O'Dwyer1bb0f672020-12-20 15:21:42 -0500616 constexpr void // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000617 sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
618
619template <class RandomAccessIterator>
620 void
621 stable_sort(RandomAccessIterator first, RandomAccessIterator last);
622
623template <class RandomAccessIterator, class Compare>
624 void
625 stable_sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
626
627template <class RandomAccessIterator>
Arthur O'Dwyer2dfea5d2020-12-17 00:26:18 -0500628 constexpr void // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000629 partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last);
630
631template <class RandomAccessIterator, class Compare>
Arthur O'Dwyer2dfea5d2020-12-17 00:26:18 -0500632 constexpr void // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000633 partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last, Compare comp);
634
635template <class InputIterator, class RandomAccessIterator>
Arthur O'Dwyer2dfea5d2020-12-17 00:26:18 -0500636 constexpr RandomAccessIterator // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000637 partial_sort_copy(InputIterator first, InputIterator last,
638 RandomAccessIterator result_first, RandomAccessIterator result_last);
639
640template <class InputIterator, class RandomAccessIterator, class Compare>
Arthur O'Dwyer2dfea5d2020-12-17 00:26:18 -0500641 constexpr RandomAccessIterator // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000642 partial_sort_copy(InputIterator first, InputIterator last,
643 RandomAccessIterator result_first, RandomAccessIterator result_last, Compare comp);
644
645template <class RandomAccessIterator>
Arthur O'Dwyer4f5717b2021-02-04 18:12:52 -0500646 constexpr void // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000647 nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last);
648
649template <class RandomAccessIterator, class Compare>
Arthur O'Dwyer4f5717b2021-02-04 18:12:52 -0500650 constexpr void // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000651 nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last, Compare comp);
652
653template <class ForwardIterator, class T>
Marshall Clowe00916c2018-01-16 02:34:41 +0000654 constexpr ForwardIterator // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000655 lower_bound(ForwardIterator first, ForwardIterator last, const T& value);
656
657template <class ForwardIterator, class T, class Compare>
Marshall Clowe00916c2018-01-16 02:34:41 +0000658 constexpr ForwardIterator // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000659 lower_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
660
661template <class ForwardIterator, class T>
Marshall Clowe00916c2018-01-16 02:34:41 +0000662 constexpr ForwardIterator // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000663 upper_bound(ForwardIterator first, ForwardIterator last, const T& value);
664
665template <class ForwardIterator, class T, class Compare>
Marshall Clowe00916c2018-01-16 02:34:41 +0000666 constexpr ForwardIterator // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000667 upper_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
668
669template <class ForwardIterator, class T>
Marshall Clowe00916c2018-01-16 02:34:41 +0000670 constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000671 equal_range(ForwardIterator first, ForwardIterator last, const T& value);
672
673template <class ForwardIterator, class T, class Compare>
Marshall Clowe00916c2018-01-16 02:34:41 +0000674 constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000675 equal_range(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
676
677template <class ForwardIterator, class T>
Marshall Clowe00916c2018-01-16 02:34:41 +0000678 constexpr bool // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000679 binary_search(ForwardIterator first, ForwardIterator last, const T& value);
680
681template <class ForwardIterator, class T, class Compare>
Marshall Clowc0b7f972018-01-22 23:10:40 +0000682 constexpr bool // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000683 binary_search(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
684
685template <class InputIterator1, class InputIterator2, class OutputIterator>
Arthur O'Dwyer5afc5692020-12-04 13:47:12 -0500686 constexpr OutputIterator // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000687 merge(InputIterator1 first1, InputIterator1 last1,
688 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
689
690template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
Arthur O'Dwyer5afc5692020-12-04 13:47:12 -0500691 constexpr OutputIterator // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000692 merge(InputIterator1 first1, InputIterator1 last1,
693 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
694
695template <class BidirectionalIterator>
696 void
697 inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last);
698
699template <class BidirectionalIterator, class Compare>
700 void
701 inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last, Compare comp);
702
703template <class InputIterator1, class InputIterator2>
Marshall Clowc0b7f972018-01-22 23:10:40 +0000704 constexpr bool // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000705 includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2);
706
707template <class InputIterator1, class InputIterator2, class Compare>
Marshall Clowc0b7f972018-01-22 23:10:40 +0000708 constexpr bool // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000709 includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, Compare comp);
710
711template <class InputIterator1, class InputIterator2, class OutputIterator>
Arthur O'Dwyer5afc5692020-12-04 13:47:12 -0500712 constexpr OutputIterator // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000713 set_union(InputIterator1 first1, InputIterator1 last1,
714 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
715
716template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
Arthur O'Dwyer5afc5692020-12-04 13:47:12 -0500717 constexpr OutputIterator // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000718 set_union(InputIterator1 first1, InputIterator1 last1,
719 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
720
721template <class InputIterator1, class InputIterator2, class OutputIterator>
Marshall Clowc0b7f972018-01-22 23:10:40 +0000722 constexpr OutputIterator // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000723 set_intersection(InputIterator1 first1, InputIterator1 last1,
724 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
725
726template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
Marshall Clowc0b7f972018-01-22 23:10:40 +0000727 constexpr OutputIterator // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000728 set_intersection(InputIterator1 first1, InputIterator1 last1,
729 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
730
731template <class InputIterator1, class InputIterator2, class OutputIterator>
Arthur O'Dwyer5afc5692020-12-04 13:47:12 -0500732 constexpr OutputIterator // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000733 set_difference(InputIterator1 first1, InputIterator1 last1,
734 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
735
736template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
Arthur O'Dwyer5afc5692020-12-04 13:47:12 -0500737 constexpr OutputIterator // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000738 set_difference(InputIterator1 first1, InputIterator1 last1,
739 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
740
741template <class InputIterator1, class InputIterator2, class OutputIterator>
Arthur O'Dwyer5afc5692020-12-04 13:47:12 -0500742 constexpr OutputIterator // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000743 set_symmetric_difference(InputIterator1 first1, InputIterator1 last1,
744 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
745
746template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
Arthur O'Dwyer5afc5692020-12-04 13:47:12 -0500747 constexpr OutputIterator // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000748 set_symmetric_difference(InputIterator1 first1, InputIterator1 last1,
749 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
750
751template <class RandomAccessIterator>
Arthur O'Dwyer2dfea5d2020-12-17 00:26:18 -0500752 constexpr void // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000753 push_heap(RandomAccessIterator first, RandomAccessIterator last);
754
755template <class RandomAccessIterator, class Compare>
Arthur O'Dwyer2dfea5d2020-12-17 00:26:18 -0500756 constexpr void // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000757 push_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
758
759template <class RandomAccessIterator>
Arthur O'Dwyer2dfea5d2020-12-17 00:26:18 -0500760 constexpr void // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000761 pop_heap(RandomAccessIterator first, RandomAccessIterator last);
762
763template <class RandomAccessIterator, class Compare>
Arthur O'Dwyer2dfea5d2020-12-17 00:26:18 -0500764 constexpr void // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000765 pop_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
766
767template <class RandomAccessIterator>
Arthur O'Dwyer2dfea5d2020-12-17 00:26:18 -0500768 constexpr void // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000769 make_heap(RandomAccessIterator first, RandomAccessIterator last);
770
771template <class RandomAccessIterator, class Compare>
Arthur O'Dwyer2dfea5d2020-12-17 00:26:18 -0500772 constexpr void // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000773 make_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
774
775template <class RandomAccessIterator>
Arthur O'Dwyer2dfea5d2020-12-17 00:26:18 -0500776 constexpr void // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000777 sort_heap(RandomAccessIterator first, RandomAccessIterator last);
778
779template <class RandomAccessIterator, class Compare>
Arthur O'Dwyer2dfea5d2020-12-17 00:26:18 -0500780 constexpr void // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000781 sort_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
782
Howard Hinnant3b6579a2010-08-22 00:02:43 +0000783template <class RandomAccessIterator>
Marshall Clow96d050a2018-01-15 16:16:32 +0000784 constexpr bool // constexpr in C++20
Howard Hinnant3b6579a2010-08-22 00:02:43 +0000785 is_heap(RandomAccessIterator first, RandomAccessiterator last);
Howard Hinnantc51e1022010-05-11 19:42:16 +0000786
Howard Hinnant3b6579a2010-08-22 00:02:43 +0000787template <class RandomAccessIterator, class Compare>
Marshall Clow96d050a2018-01-15 16:16:32 +0000788 constexpr bool // constexpr in C++20
Howard Hinnant3b6579a2010-08-22 00:02:43 +0000789 is_heap(RandomAccessIterator first, RandomAccessiterator last, Compare comp);
Howard Hinnantc51e1022010-05-11 19:42:16 +0000790
Howard Hinnant3b6579a2010-08-22 00:02:43 +0000791template <class RandomAccessIterator>
Marshall Clow96d050a2018-01-15 16:16:32 +0000792 constexpr RandomAccessIterator // constexpr in C++20
Howard Hinnant3b6579a2010-08-22 00:02:43 +0000793 is_heap_until(RandomAccessIterator first, RandomAccessiterator last);
Howard Hinnantc51e1022010-05-11 19:42:16 +0000794
Howard Hinnant3b6579a2010-08-22 00:02:43 +0000795template <class RandomAccessIterator, class Compare>
Marshall Clow96d050a2018-01-15 16:16:32 +0000796 constexpr RandomAccessIterator // constexpr in C++20
Howard Hinnant3b6579a2010-08-22 00:02:43 +0000797 is_heap_until(RandomAccessIterator first, RandomAccessiterator last, Compare comp);
Howard Hinnantc51e1022010-05-11 19:42:16 +0000798
Howard Hinnantb120e7a2010-08-21 20:10:01 +0000799template <class ForwardIterator>
Arthur O'Dwyer20353a72020-12-02 20:02:18 -0500800 constexpr ForwardIterator // constexpr in C++14
801 min_element(ForwardIterator first, ForwardIterator last);
Howard Hinnantb120e7a2010-08-21 20:10:01 +0000802
803template <class ForwardIterator, class Compare>
Arthur O'Dwyer20353a72020-12-02 20:02:18 -0500804 constexpr ForwardIterator // constexpr in C++14
805 min_element(ForwardIterator first, ForwardIterator last, Compare comp);
Howard Hinnantb120e7a2010-08-21 20:10:01 +0000806
Howard Hinnantc51e1022010-05-11 19:42:16 +0000807template <class T>
Arthur O'Dwyer20353a72020-12-02 20:02:18 -0500808 constexpr const T& // constexpr in C++14
809 min(const T& a, const T& b);
Howard Hinnantc51e1022010-05-11 19:42:16 +0000810
811template <class T, class Compare>
Arthur O'Dwyer20353a72020-12-02 20:02:18 -0500812 constexpr const T& // constexpr in C++14
813 min(const T& a, const T& b, Compare comp);
Howard Hinnantc51e1022010-05-11 19:42:16 +0000814
Howard Hinnantb120e7a2010-08-21 20:10:01 +0000815template<class T>
Arthur O'Dwyer20353a72020-12-02 20:02:18 -0500816 constexpr T // constexpr in C++14
817 min(initializer_list<T> t);
Howard Hinnantb120e7a2010-08-21 20:10:01 +0000818
819template<class T, class Compare>
Arthur O'Dwyer20353a72020-12-02 20:02:18 -0500820 constexpr T // constexpr in C++14
821 min(initializer_list<T> t, Compare comp);
Howard Hinnantb120e7a2010-08-21 20:10:01 +0000822
Marshall Clow3e18d0e2016-03-07 22:43:49 +0000823template<class T>
Arthur O'Dwyer20353a72020-12-02 20:02:18 -0500824 constexpr const T& clamp(const T& v, const T& lo, const T& hi); // C++17
Marshall Clow3e18d0e2016-03-07 22:43:49 +0000825
826template<class T, class Compare>
Arthur O'Dwyer20353a72020-12-02 20:02:18 -0500827 constexpr const T& clamp(const T& v, const T& lo, const T& hi, Compare comp); // C++17
Marshall Clow3e18d0e2016-03-07 22:43:49 +0000828
Howard Hinnantb120e7a2010-08-21 20:10:01 +0000829template <class ForwardIterator>
Arthur O'Dwyer20353a72020-12-02 20:02:18 -0500830 constexpr ForwardIterator // constexpr in C++14
831 max_element(ForwardIterator first, ForwardIterator last);
Howard Hinnantb120e7a2010-08-21 20:10:01 +0000832
833template <class ForwardIterator, class Compare>
Arthur O'Dwyer20353a72020-12-02 20:02:18 -0500834 constexpr ForwardIterator // constexpr in C++14
835 max_element(ForwardIterator first, ForwardIterator last, Compare comp);
Howard Hinnantb120e7a2010-08-21 20:10:01 +0000836
Howard Hinnantc51e1022010-05-11 19:42:16 +0000837template <class T>
Arthur O'Dwyer20353a72020-12-02 20:02:18 -0500838 constexpr const T& // constexpr in C++14
839 max(const T& a, const T& b);
Howard Hinnantc51e1022010-05-11 19:42:16 +0000840
841template <class T, class Compare>
Arthur O'Dwyer20353a72020-12-02 20:02:18 -0500842 constexpr const T& // constexpr in C++14
843 max(const T& a, const T& b, Compare comp);
Howard Hinnantc51e1022010-05-11 19:42:16 +0000844
Howard Hinnantb120e7a2010-08-21 20:10:01 +0000845template<class T>
Arthur O'Dwyer20353a72020-12-02 20:02:18 -0500846 constexpr T // constexpr in C++14
847 max(initializer_list<T> t);
Howard Hinnantc51e1022010-05-11 19:42:16 +0000848
Howard Hinnantb120e7a2010-08-21 20:10:01 +0000849template<class T, class Compare>
Arthur O'Dwyer20353a72020-12-02 20:02:18 -0500850 constexpr T // constexpr in C++14
851 max(initializer_list<T> t, Compare comp);
Howard Hinnantc51e1022010-05-11 19:42:16 +0000852
Howard Hinnantb120e7a2010-08-21 20:10:01 +0000853template<class ForwardIterator>
Arthur O'Dwyer20353a72020-12-02 20:02:18 -0500854 constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++14
855 minmax_element(ForwardIterator first, ForwardIterator last);
Howard Hinnantc51e1022010-05-11 19:42:16 +0000856
Howard Hinnantb120e7a2010-08-21 20:10:01 +0000857template<class ForwardIterator, class Compare>
Arthur O'Dwyer20353a72020-12-02 20:02:18 -0500858 constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++14
859 minmax_element(ForwardIterator first, ForwardIterator last, Compare comp);
Howard Hinnantb120e7a2010-08-21 20:10:01 +0000860
861template<class T>
Arthur O'Dwyer20353a72020-12-02 20:02:18 -0500862 constexpr pair<const T&, const T&> // constexpr in C++14
863 minmax(const T& a, const T& b);
Howard Hinnantb120e7a2010-08-21 20:10:01 +0000864
865template<class T, class Compare>
Arthur O'Dwyer20353a72020-12-02 20:02:18 -0500866 constexpr pair<const T&, const T&> // constexpr in C++14
867 minmax(const T& a, const T& b, Compare comp);
Howard Hinnantb120e7a2010-08-21 20:10:01 +0000868
869template<class T>
Arthur O'Dwyer20353a72020-12-02 20:02:18 -0500870 constexpr pair<T, T> // constexpr in C++14
871 minmax(initializer_list<T> t);
Howard Hinnantb120e7a2010-08-21 20:10:01 +0000872
873template<class T, class Compare>
Arthur O'Dwyer20353a72020-12-02 20:02:18 -0500874 constexpr pair<T, T> // constexpr in C++14
875 minmax(initializer_list<T> t, Compare comp);
Howard Hinnantc51e1022010-05-11 19:42:16 +0000876
877template <class InputIterator1, class InputIterator2>
Marshall Clow5492c8a2018-01-22 20:44:33 +0000878 constexpr bool // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000879 lexicographical_compare(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2);
880
881template <class InputIterator1, class InputIterator2, class Compare>
Marshall Clow5492c8a2018-01-22 20:44:33 +0000882 constexpr bool // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000883 lexicographical_compare(InputIterator1 first1, InputIterator1 last1,
884 InputIterator2 first2, InputIterator2 last2, Compare comp);
885
886template <class BidirectionalIterator>
Arthur O'Dwyere50e7472020-12-17 00:01:08 -0500887 constexpr bool // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000888 next_permutation(BidirectionalIterator first, BidirectionalIterator last);
889
890template <class BidirectionalIterator, class Compare>
Arthur O'Dwyere50e7472020-12-17 00:01:08 -0500891 constexpr bool // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000892 next_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp);
893
894template <class BidirectionalIterator>
Arthur O'Dwyere50e7472020-12-17 00:01:08 -0500895 constexpr bool // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000896 prev_permutation(BidirectionalIterator first, BidirectionalIterator last);
897
898template <class BidirectionalIterator, class Compare>
Arthur O'Dwyere50e7472020-12-17 00:01:08 -0500899 constexpr bool // constexpr in C++20
Howard Hinnantc51e1022010-05-11 19:42:16 +0000900 prev_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp);
Howard Hinnantc51e1022010-05-11 19:42:16 +0000901} // std
902
903*/
904
Louis Dionneb4fce352022-03-25 12:55:36 -0400905#include <__assert> // all public C++ headers provide the assertion handler
Arthur O'Dwyer3693d7a2022-02-04 13:09:30 -0500906#include <__bits>
Howard Hinnantc51e1022010-05-11 19:42:16 +0000907#include <__config>
Louis Dionnea60dd872021-06-17 11:30:11 -0400908#include <__debug>
Howard Hinnant60e5cf42012-07-26 17:09:09 +0000909#include <cstddef>
Arthur O'Dwyeref181602021-05-19 11:57:04 -0400910#include <cstring>
Arthur O'Dwyeref181602021-05-19 11:57:04 -0400911#include <initializer_list>
912#include <iterator>
913#include <memory>
914#include <type_traits>
Marshall Clow0a1e7502018-09-12 19:41:40 +0000915#include <version>
Howard Hinnantea382952013-08-14 18:00:20 +0000916
Louis Dionnea60dd872021-06-17 11:30:11 -0400917#include <__algorithm/adjacent_find.h>
918#include <__algorithm/all_of.h>
919#include <__algorithm/any_of.h>
920#include <__algorithm/binary_search.h>
921#include <__algorithm/clamp.h>
922#include <__algorithm/comp.h>
923#include <__algorithm/comp_ref_type.h>
924#include <__algorithm/copy.h>
925#include <__algorithm/copy_backward.h>
926#include <__algorithm/copy_if.h>
927#include <__algorithm/copy_n.h>
928#include <__algorithm/count.h>
929#include <__algorithm/count_if.h>
930#include <__algorithm/equal.h>
931#include <__algorithm/equal_range.h>
Louis Dionnea60dd872021-06-17 11:30:11 -0400932#include <__algorithm/fill.h>
Arthur O'Dwyer65077c02022-01-07 09:45:05 -0500933#include <__algorithm/fill_n.h>
Louis Dionnea60dd872021-06-17 11:30:11 -0400934#include <__algorithm/find.h>
935#include <__algorithm/find_end.h>
936#include <__algorithm/find_first_of.h>
937#include <__algorithm/find_if.h>
938#include <__algorithm/find_if_not.h>
939#include <__algorithm/for_each.h>
940#include <__algorithm/for_each_n.h>
Louis Dionnea60dd872021-06-17 11:30:11 -0400941#include <__algorithm/generate.h>
Arthur O'Dwyer65077c02022-01-07 09:45:05 -0500942#include <__algorithm/generate_n.h>
Louis Dionnea60dd872021-06-17 11:30:11 -0400943#include <__algorithm/half_positive.h>
Nikolas Klauserdd5ad212022-02-21 23:07:02 +0100944#include <__algorithm/in_found_result.h>
Nikolas Klauser671b4752022-02-11 17:01:58 +0100945#include <__algorithm/in_fun_result.h>
Nikolas Klauser05e2cd82022-01-25 11:21:47 +0100946#include <__algorithm/in_in_out_result.h>
Nikolas Klauserf74be4e2022-01-14 02:55:51 +0100947#include <__algorithm/in_in_result.h>
Nikolas Klauser61ce8162022-02-03 02:17:03 +0100948#include <__algorithm/in_out_out_result.h>
Konstantin Varlamov74736812022-01-10 22:49:37 -0800949#include <__algorithm/in_out_result.h>
Louis Dionnea60dd872021-06-17 11:30:11 -0400950#include <__algorithm/includes.h>
951#include <__algorithm/inplace_merge.h>
952#include <__algorithm/is_heap.h>
953#include <__algorithm/is_heap_until.h>
954#include <__algorithm/is_partitioned.h>
955#include <__algorithm/is_permutation.h>
956#include <__algorithm/is_sorted.h>
957#include <__algorithm/is_sorted_until.h>
Christopher Di Bella41f26e82021-06-05 02:47:47 +0000958#include <__algorithm/iter_swap.h>
Louis Dionnea60dd872021-06-17 11:30:11 -0400959#include <__algorithm/lexicographical_compare.h>
960#include <__algorithm/lower_bound.h>
961#include <__algorithm/make_heap.h>
962#include <__algorithm/max.h>
963#include <__algorithm/max_element.h>
964#include <__algorithm/merge.h>
965#include <__algorithm/min.h>
966#include <__algorithm/min_element.h>
Nikolas Klauser2e263162022-02-21 22:48:36 +0100967#include <__algorithm/min_max_result.h>
Louis Dionnea60dd872021-06-17 11:30:11 -0400968#include <__algorithm/minmax.h>
969#include <__algorithm/minmax_element.h>
970#include <__algorithm/mismatch.h>
971#include <__algorithm/move.h>
972#include <__algorithm/move_backward.h>
973#include <__algorithm/next_permutation.h>
974#include <__algorithm/none_of.h>
975#include <__algorithm/nth_element.h>
976#include <__algorithm/partial_sort.h>
977#include <__algorithm/partial_sort_copy.h>
978#include <__algorithm/partition.h>
979#include <__algorithm/partition_copy.h>
980#include <__algorithm/partition_point.h>
981#include <__algorithm/pop_heap.h>
982#include <__algorithm/prev_permutation.h>
983#include <__algorithm/push_heap.h>
Nikolas Klauserd959d842022-04-15 13:43:40 +0200984#include <__algorithm/ranges_copy.h>
985#include <__algorithm/ranges_copy_backward.h>
986#include <__algorithm/ranges_copy_if.h>
987#include <__algorithm/ranges_copy_n.h>
Nikolas Klauserf1373d02022-04-07 13:02:02 +0200988#include <__algorithm/ranges_count.h>
989#include <__algorithm/ranges_count_if.h>
Nikolas Klauser37d076e2022-03-12 01:45:35 +0100990#include <__algorithm/ranges_find.h>
991#include <__algorithm/ranges_find_if.h>
992#include <__algorithm/ranges_find_if_not.h>
Nikolas Klauser58de98c2022-05-04 20:27:07 +0200993#include <__algorithm/ranges_for_each.h>
994#include <__algorithm/ranges_for_each_n.h>
Nikolas Klauserbb9049d2022-05-04 14:19:09 +0200995#include <__algorithm/ranges_is_partitioned.h>
Nikolas Klauser573cd6f2022-04-03 09:17:01 +0200996#include <__algorithm/ranges_max.h>
Nikolas Klauserf2a69ea2022-03-07 17:01:52 +0100997#include <__algorithm/ranges_max_element.h>
Nikolas Klauser3559e452022-03-18 02:57:08 +0100998#include <__algorithm/ranges_min.h>
Nikolas Klauser0a62a172022-02-11 13:11:57 +0100999#include <__algorithm/ranges_min_element.h>
Nikolas Klauser0a2f44f2022-04-13 22:59:09 +02001000#include <__algorithm/ranges_minmax.h>
1001#include <__algorithm/ranges_minmax_element.h>
Nikolas Klauser12fc9bf2022-03-08 23:12:35 +01001002#include <__algorithm/ranges_mismatch.h>
Nikolas Klauser4ceab5f2022-02-10 13:33:03 +01001003#include <__algorithm/ranges_swap_ranges.h>
Nikolas Klauser559a1772022-04-05 11:05:36 +02001004#include <__algorithm/ranges_transform.h>
Louis Dionnea60dd872021-06-17 11:30:11 -04001005#include <__algorithm/remove.h>
1006#include <__algorithm/remove_copy.h>
1007#include <__algorithm/remove_copy_if.h>
1008#include <__algorithm/remove_if.h>
1009#include <__algorithm/replace.h>
1010#include <__algorithm/replace_copy.h>
1011#include <__algorithm/replace_copy_if.h>
1012#include <__algorithm/replace_if.h>
1013#include <__algorithm/reverse.h>
1014#include <__algorithm/reverse_copy.h>
1015#include <__algorithm/rotate.h>
1016#include <__algorithm/rotate_copy.h>
1017#include <__algorithm/sample.h>
1018#include <__algorithm/search.h>
1019#include <__algorithm/search_n.h>
1020#include <__algorithm/set_difference.h>
1021#include <__algorithm/set_intersection.h>
1022#include <__algorithm/set_symmetric_difference.h>
1023#include <__algorithm/set_union.h>
1024#include <__algorithm/shift_left.h>
1025#include <__algorithm/shift_right.h>
1026#include <__algorithm/shuffle.h>
1027#include <__algorithm/sift_down.h>
1028#include <__algorithm/sort.h>
1029#include <__algorithm/sort_heap.h>
1030#include <__algorithm/stable_partition.h>
1031#include <__algorithm/stable_sort.h>
Christopher Di Bella41f26e82021-06-05 02:47:47 +00001032#include <__algorithm/swap_ranges.h>
Louis Dionnea60dd872021-06-17 11:30:11 -04001033#include <__algorithm/transform.h>
Louis Dionnea60dd872021-06-17 11:30:11 -04001034#include <__algorithm/unique.h>
Arthur O'Dwyer65077c02022-01-07 09:45:05 -05001035#include <__algorithm/unique_copy.h>
Louis Dionnea60dd872021-06-17 11:30:11 -04001036#include <__algorithm/unwrap_iter.h>
1037#include <__algorithm/upper_bound.h>
Eric Fiselier14b6de92014-08-10 23:53:08 +00001038
Howard Hinnantaaaa52b2011-10-17 20:05:10 +00001039#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
Arthur O'Dwyer6eeaa002022-02-01 20:16:40 -05001040# pragma GCC system_header
Howard Hinnantaaaa52b2011-10-17 20:05:10 +00001041#endif
Howard Hinnantc51e1022010-05-11 19:42:16 +00001042
Louis Dionne59d0b3c2019-08-05 18:29:14 +00001043#if defined(_LIBCPP_HAS_PARALLEL_ALGORITHMS) && _LIBCPP_STD_VER >= 17
Louis Dionned53d8c02019-08-06 21:11:24 +00001044# include <__pstl_algorithm>
Louis Dionne59d0b3c2019-08-05 18:29:14 +00001045#endif
1046
Louis Dionne2b1ceaa2021-04-20 12:03:32 -04001047#endif // _LIBCPP_ALGORITHM