blob: 698e6f5cb7ad1f1df53eefc7685c9a1cde067adb [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
nicole mazzuca04760bf2024-07-19 16:42:16105 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity>
106 requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
107 constexpr subrange<I> find_last(I first, S last, const T& value, Proj proj = {}); // since C++23
108
109 template<forward_range R, class T, class Proj = identity>
110 requires
111 indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
112 constexpr borrowed_subrange_t<R> find_last(R&& r, const T& value, Proj proj = {}); // since C++23
113
114 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
115 indirect_unary_predicate<projected<I, Proj>> Pred>
116 constexpr subrange<I> find_last_if(I first, S last, Pred pred, Proj proj = {}); // since C++23
117
118 template<forward_range R, class Proj = identity,
119 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
120 constexpr borrowed_subrange_t<R> find_last_if(R&& r, Pred pred, Proj proj = {}); // since C++23
121
122 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
123 indirect_unary_predicate<projected<I, Proj>> Pred>
124 constexpr subrange<I> find_last_if_not(I first, S last, Pred pred, Proj proj = {}); // since C++23
125
126 template<forward_range R, class Proj = identity,
127 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
128 constexpr borrowed_subrange_t<R> find_last_if_not(R&& r, Pred pred, Proj proj = {}); // since C++23
129
Nikolas Klausere476df52022-04-03 07:17:01130 template<class T, class Proj = identity,
131 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
Mark de Weverde6827b2023-02-24 20:35:41132 constexpr const T& min(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauserf83d8332022-03-18 01:57:08133
Nikolas Klausere476df52022-04-03 07:17:01134 template<copyable T, class Proj = identity,
135 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
Mark de Weverde6827b2023-02-24 20:35:41136 constexpr T min(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauserf83d8332022-03-18 01:57:08137
138 template<input_range R, class Proj = identity,
139 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
140 requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
141 constexpr range_value_t<R>
Mark de Weverde6827b2023-02-24 20:35:41142 min(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klausere476df52022-04-03 07:17:01143
144 template<class T, class Proj = identity,
145 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
Mark de Weverde6827b2023-02-24 20:35:41146 constexpr const T& max(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klausere476df52022-04-03 07:17:01147
148 template<copyable T, class Proj = identity,
149 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
Mark de Weverde6827b2023-02-24 20:35:41150 constexpr T max(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klausere476df52022-04-03 07:17:01151
152 template<input_range R, class Proj = identity,
153 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
154 requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
155 constexpr range_value_t<R>
Mark de Weverde6827b2023-02-24 20:35:41156 max(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser3ba85482022-04-05 09:05:36157
158 template<class I, class O>
Mark de Weverde6827b2023-02-24 20:35:41159 using unary_transform_result = in_out_result<I, O>; // since C++20
Nikolas Klauser3ba85482022-04-05 09:05:36160
161 template<class I1, class I2, class O>
Mark de Weverde6827b2023-02-24 20:35:41162 using binary_transform_result = in_in_out_result<I1, I2, O>; // since C++20
Nikolas Klauser3ba85482022-04-05 09:05:36163
164 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O,
165 copy_constructible F, class Proj = identity>
166 requires indirectly_writable<O, indirect_result_t<F&, projected<I, Proj>>>
167 constexpr ranges::unary_transform_result<I, O>
Mark de Weverde6827b2023-02-24 20:35:41168 transform(I first1, S last1, O result, F op, Proj proj = {}); // since C++20
Nikolas Klauser3ba85482022-04-05 09:05:36169
170 template<input_range R, weakly_incrementable O, copy_constructible F,
171 class Proj = identity>
172 requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R>, Proj>>>
173 constexpr ranges::unary_transform_result<borrowed_iterator_t<R>, O>
Mark de Weverde6827b2023-02-24 20:35:41174 transform(R&& r, O result, F op, Proj proj = {}); // since C++20
Nikolas Klauser3ba85482022-04-05 09:05:36175
176 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
177 weakly_incrementable O, copy_constructible F, class Proj1 = identity,
178 class Proj2 = identity>
179 requires indirectly_writable<O, indirect_result_t<F&, projected<I1, Proj1>,
180 projected<I2, Proj2>>>
181 constexpr ranges::binary_transform_result<I1, I2, O>
182 transform(I1 first1, S1 last1, I2 first2, S2 last2, O result,
Mark de Weverde6827b2023-02-24 20:35:41183 F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauser3ba85482022-04-05 09:05:36184
185 template<input_range R1, input_range R2, weakly_incrementable O,
186 copy_constructible F, class Proj1 = identity, class Proj2 = identity>
187 requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R1>, Proj1>,
188 projected<iterator_t<R2>, Proj2>>>
189 constexpr ranges::binary_transform_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
190 transform(R1&& r1, R2&& r2, O result,
Mark de Weverde6827b2023-02-24 20:35:41191 F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauser1306b102022-04-07 11:02:02192
193 template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity>
194 requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
195 constexpr iter_difference_t<I>
Mark de Weverde6827b2023-02-24 20:35:41196 count(I first, S last, const T& value, Proj proj = {}); // since C++20
Nikolas Klauser1306b102022-04-07 11:02:02197
198 template<input_range R, class T, class Proj = identity>
199 requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
200 constexpr range_difference_t<R>
Mark de Weverde6827b2023-02-24 20:35:41201 count(R&& r, const T& value, Proj proj = {}); // since C++20
Nikolas Klauser1306b102022-04-07 11:02:02202
203 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
204 indirect_unary_predicate<projected<I, Proj>> Pred>
205 constexpr iter_difference_t<I>
Mark de Weverde6827b2023-02-24 20:35:41206 count_if(I first, S last, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser1306b102022-04-07 11:02:02207
208 template<input_range R, class Proj = identity,
209 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
210 constexpr range_difference_t<R>
Mark de Weverde6827b2023-02-24 20:35:41211 count_if(R&& r, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser58d9ab72022-04-13 20:59:09212
Konstantin Varlamov79a2b4b2022-06-28 18:59:59213 template<class T>
214 using minmax_result = min_max_result<T>;
215
Nikolas Klauser58d9ab72022-04-13 20:59:09216 template<class T, class Proj = identity,
217 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
218 constexpr ranges::minmax_result<const T&>
Mark de Weverde6827b2023-02-24 20:35:41219 minmax(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser58d9ab72022-04-13 20:59:09220
221 template<copyable T, class Proj = identity,
222 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
223 constexpr ranges::minmax_result<T>
Mark de Weverde6827b2023-02-24 20:35:41224 minmax(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser58d9ab72022-04-13 20:59:09225
226 template<input_range R, class Proj = identity,
227 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
228 requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
229 constexpr ranges::minmax_result<range_value_t<R>>
Mark de Weverde6827b2023-02-24 20:35:41230 minmax(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser58d9ab72022-04-13 20:59:09231
Konstantin Varlamov79a2b4b2022-06-28 18:59:59232 template<class I>
233 using minmax_element_result = min_max_result<I>;
234
Nikolas Klauser58d9ab72022-04-13 20:59:09235 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
236 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
237 constexpr ranges::minmax_element_result<I>
Mark de Weverde6827b2023-02-24 20:35:41238 minmax_element(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser58d9ab72022-04-13 20:59:09239
240 template<forward_range R, class Proj = identity,
241 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
242 constexpr ranges::minmax_element_result<borrowed_iterator_t<R>>
Mark de Weverde6827b2023-02-24 20:35:41243 minmax_element(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser1d837502022-04-15 11:43:40244
ZijunZhaoCCKa6b846a2024-02-13 23:42:37245 template<forward_iterator I1, sentinel_for<I1> S1,
246 forward_iterator I2, sentinel_for<I2> S2,
247 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
248 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
249 constexpr bool contains_subrange(I1 first1, S1 last1, I2 first2, S2 last2,
250 Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23
251
252 template<forward_range R1, forward_range R2,
253 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
254 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
255 constexpr bool contains_subrange(R1&& r1, R2&& r2, Pred pred = {},
256 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23
257
Nikolas Klauser1d837502022-04-15 11:43:40258 template<class I, class O>
Mark de Weverde6827b2023-02-24 20:35:41259 using copy_result = in_out_result<I, O>; // since C++20
Nikolas Klauser1d837502022-04-15 11:43:40260
Konstantin Varlamov79a2b4b2022-06-28 18:59:59261 template<class I, class O>
Mark de Weverde6827b2023-02-24 20:35:41262 using copy_n_result = in_out_result<I, O>; // since C++20
Nikolas Klauser1d837502022-04-15 11:43:40263
264 template<class I, class O>
265 using copy_if_result = in_out_result<I, O>; // since C++20
266
267 template<class I1, class I2>
268 using copy_backward_result = in_out_result<I1, I2>; // since C++20
269
ZijunZhaoCCKfdd089b2023-12-20 00:34:19270 template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity>
271 requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
272 constexpr bool ranges::contains(I first, S last, const T& value, Proj proj = {}); // since C++23
273
274 template<input_range R, class T, class Proj = identity>
275 requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
276 constexpr bool ranges::contains(R&& r, const T& value, Proj proj = {}); // since C++23
277
Nikolas Klauser1d837502022-04-15 11:43:40278 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O>
279 requires indirectly_copyable<I, O>
280 constexpr ranges::copy_result<I, O> ranges::copy(I first, S last, O result); // since C++20
281
282 template<input_range R, weakly_incrementable O>
283 requires indirectly_copyable<iterator_t<R>, O>
284 constexpr ranges::copy_result<borrowed_iterator_t<R>, O> ranges::copy(R&& r, O result); // since C++20
285
286 template<input_iterator I, weakly_incrementable O>
287 requires indirectly_copyable<I, O>
288 constexpr ranges::copy_n_result<I, O>
289 ranges::copy_n(I first, iter_difference_t<I> n, O result); // since C++20
290
291 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Proj = identity,
292 indirect_unary_predicate<projected<I, Proj>> Pred>
293 requires indirectly_copyable<I, O>
294 constexpr ranges::copy_if_result<I, O>
295 ranges::copy_if(I first, S last, O result, Pred pred, Proj proj = {}); // since C++20
296
297 template<input_range R, weakly_incrementable O, class Proj = identity,
298 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
299 requires indirectly_copyable<iterator_t<R>, O>
300 constexpr ranges::copy_if_result<borrowed_iterator_t<R>, O>
301 ranges::copy_if(R&& r, O result, Pred pred, Proj proj = {}); // since C++20
302
303 template<bidirectional_iterator I1, sentinel_for<I1> S1, bidirectional_iterator I2>
304 requires indirectly_copyable<I1, I2>
305 constexpr ranges::copy_backward_result<I1, I2>
306 ranges::copy_backward(I1 first, S1 last, I2 result); // since C++20
307
308 template<bidirectional_range R, bidirectional_iterator I>
309 requires indirectly_copyable<iterator_t<R>, I>
310 constexpr ranges::copy_backward_result<borrowed_iterator_t<R>, I>
311 ranges::copy_backward(R&& r, I result); // since C++20
Nikolas Klauser80045e92022-05-04 18:27:07312
313 template<class I, class F>
314 using for_each_result = in_fun_result<I, F>; // since C++20
315
316 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
317 indirectly_unary_invocable<projected<I, Proj>> Fun>
318 constexpr ranges::for_each_result<I, Fun>
319 ranges::for_each(I first, S last, Fun f, Proj proj = {}); // since C++20
320
321 template<input_range R, class Proj = identity,
322 indirectly_unary_invocable<projected<iterator_t<R>, Proj>> Fun>
323 constexpr ranges::for_each_result<borrowed_iterator_t<R>, Fun>
324 ranges::for_each(R&& r, Fun f, Proj proj = {}); // since C++20
325
326 template<input_iterator I, class Proj = identity,
327 indirectly_unary_invocable<projected<I, Proj>> Fun>
328 constexpr ranges::for_each_n_result<I, Fun>
329 ranges::for_each_n(I first, iter_difference_t<I> n, Fun f, Proj proj = {}); // since C++20
Nikolas Klauser37ba1b92022-05-04 12:19:09330
331 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
332 indirect_unary_predicate<projected<I, Proj>> Pred>
333 constexpr bool ranges::is_partitioned(I first, S last, Pred pred, Proj proj = {}); // since C++20
334
335 template<input_range R, class Proj = identity,
336 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
337 constexpr bool ranges::is_partitioned(R&& r, Pred pred, Proj proj = {}); // since C++20
338
Konstantin Varlamovc945bd02022-07-08 20:46:27339 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
340 class Proj = identity>
341 requires sortable<I, Comp, Proj>
342 constexpr I
343 ranges::push_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
344
345 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
346 requires sortable<iterator_t<R>, Comp, Proj>
347 constexpr borrowed_iterator_t<R>
348 ranges::push_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
349
350 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
351 class Proj = identity>
352 requires sortable<I, Comp, Proj>
353 constexpr I
354 ranges::pop_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
355
356 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
357 requires sortable<iterator_t<R>, Comp, Proj>
358 constexpr borrowed_iterator_t<R>
359 ranges::pop_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
360
361 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
362 class Proj = identity>
363 requires sortable<I, Comp, Proj>
364 constexpr I
365 ranges::make_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
366
367 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
368 requires sortable<iterator_t<R>, Comp, Proj>
369 constexpr borrowed_iterator_t<R>
370 ranges::make_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
371
372 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
373 class Proj = identity>
374 requires sortable<I, Comp, Proj>
375 constexpr I
376 ranges::sort_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
377
378 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
379 requires sortable<iterator_t<R>, Comp, Proj>
380 constexpr borrowed_iterator_t<R>
381 ranges::sort_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
382
Konstantin Varlamovd406c642022-07-26 23:11:09383 template<random_access_iterator I, sentinel_for<I> S, class Proj = identity,
384 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
Mark de Weverde6827b2023-02-24 20:35:41385 constexpr bool is_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
Konstantin Varlamovd406c642022-07-26 23:11:09386
387 template<random_access_range R, class Proj = identity,
388 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
Mark de Weverde6827b2023-02-24 20:35:41389 constexpr bool is_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Konstantin Varlamovd406c642022-07-26 23:11:09390
391 template<random_access_iterator I, sentinel_for<I> S, class Proj = identity,
392 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
Mark de Weverde6827b2023-02-24 20:35:41393 constexpr I is_heap_until(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
Konstantin Varlamovd406c642022-07-26 23:11:09394
395 template<random_access_range R, class Proj = identity,
396 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
397 constexpr borrowed_iterator_t<R>
Mark de Weverde6827b2023-02-24 20:35:41398 is_heap_until(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Konstantin Varlamovd406c642022-07-26 23:11:09399
Nikolas Klauser1d1a1912022-05-24 08:32:50400 template<bidirectional_iterator I, sentinel_for<I> S>
401 requires permutable<I>
402 constexpr I ranges::reverse(I first, S last); // since C++20
403
404 template<bidirectional_range R>
405 requires permutable<iterator_t<R>>
406 constexpr borrowed_iterator_t<R> ranges::reverse(R&& r); // since C++20
407
Konstantin Varlamovff3989e2022-06-16 22:20:53408 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
409 class Proj = identity>
410 requires sortable<I, Comp, Proj>
411 constexpr I
Konstantin Varlamov94c7b892022-07-01 23:34:08412 ranges::sort(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
Konstantin Varlamovff3989e2022-06-16 22:20:53413
414 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
415 requires sortable<iterator_t<R>, Comp, Proj>
416 constexpr borrowed_iterator_t<R>
Konstantin Varlamov94c7b892022-07-01 23:34:08417 ranges::sort(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
418
419 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
420 class Proj = identity>
421 requires sortable<I, Comp, Proj>
422 I ranges::stable_sort(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
423
424 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
425 requires sortable<iterator_t<R>, Comp, Proj>
426 borrowed_iterator_t<R>
427 ranges::stable_sort(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Konstantin Varlamovff3989e2022-06-16 22:20:53428
varconst5dd19ad2022-07-20 03:10:02429 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
430 class Proj = identity>
431 requires sortable<I, Comp, Proj>
432 constexpr I
433 ranges::partial_sort(I first, I middle, S last, Comp comp = {}, Proj proj = {}); // since C++20
434
435 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
436 requires sortable<iterator_t<R>, Comp, Proj>
437 constexpr borrowed_iterator_t<R>
438 ranges::partial_sort(R&& r, iterator_t<R> middle, Comp comp = {}, Proj proj = {}); // since C++20
439
Nikolas Klauser7af89a32022-05-21 16:26:29440 template<class T, output_iterator<const T&> O, sentinel_for<O> S>
441 constexpr O ranges::fill(O first, S last, const T& value); // since C++20
442
443 template<class T, output_range<const T&> R>
444 constexpr borrowed_iterator_t<R> ranges::fill(R&& r, const T& value); // since C++20
445
446 template<class T, output_iterator<const T&> O>
447 constexpr O ranges::fill_n(O first, iter_difference_t<O> n, const T& value); // since C++20
Nikolas Klauser569d6632022-05-25 09:09:43448
Konstantin Varlamovead73022022-07-26 22:50:14449 template<input_or_output_iterator O, sentinel_for<O> S, copy_constructible F>
450 requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>>
Mark de Weverde6827b2023-02-24 20:35:41451 constexpr O generate(O first, S last, F gen); // since C++20
Konstantin Varlamovead73022022-07-26 22:50:14452
Nikolas Klausercd916102023-06-09 20:45:34453 template<class ExecutionPolicy, class ForwardIterator, class Generator>
454 void generate(ExecutionPolicy&& exec,
455 ForwardIterator first, ForwardIterator last,
456 Generator gen); // since C++17
457
Konstantin Varlamovead73022022-07-26 22:50:14458 template<class R, copy_constructible F>
459 requires invocable<F&> && output_range<R, invoke_result_t<F&>>
Mark de Weverde6827b2023-02-24 20:35:41460 constexpr borrowed_iterator_t<R> generate(R&& r, F gen); // since C++20
Konstantin Varlamovead73022022-07-26 22:50:14461
462 template<input_or_output_iterator O, copy_constructible F>
463 requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>>
Mark de Weverde6827b2023-02-24 20:35:41464 constexpr O generate_n(O first, iter_difference_t<O> n, F gen); // since C++20
Konstantin Varlamovead73022022-07-26 22:50:14465
Nikolas Klausercd916102023-06-09 20:45:34466 template<class ExecutionPolicy, class ForwardIterator, class Size, class Generator>
467 ForwardIterator generate_n(ExecutionPolicy&& exec,
468 ForwardIterator first, Size n, Generator gen); // since C++17
469
Nikolas Klauser569d6632022-05-25 09:09:43470 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
471 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
472 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
473 constexpr bool ranges::equal(I1 first1, S1 last1, I2 first2, S2 last2,
474 Pred pred = {},
475 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
476
477 template<input_range R1, input_range R2, class Pred = ranges::equal_to,
478 class Proj1 = identity, class Proj2 = identity>
479 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
480 constexpr bool ranges::equal(R1&& r1, R2&& r2, Pred pred = {},
481 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
482
Nikolas Klauser0e3dc1a2022-05-26 14:42:46483 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
484 indirect_unary_predicate<projected<I, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:41485 constexpr bool ranges::all_of(I first, S last, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser0e3dc1a2022-05-26 14:42:46486
487 template<input_range R, class Proj = identity,
488 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:41489 constexpr bool ranges::all_of(R&& r, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser0e3dc1a2022-05-26 14:42:46490
491 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
492 indirect_unary_predicate<projected<I, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:41493 constexpr bool ranges::any_of(I first, S last, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser0e3dc1a2022-05-26 14:42:46494
495 template<input_range R, class Proj = identity,
496 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:41497 constexpr bool ranges::any_of(R&& r, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser0e3dc1a2022-05-26 14:42:46498
Zijun Zhao0218ea42023-09-18 18:28:11499 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
500 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
501 requires (forward_iterator<I1> || sized_sentinel_for<S1, I1>) &&
502 (forward_iterator<I2> || sized_sentinel_for<S2, I2>) &&
503 indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
504 constexpr bool ranges::ends_with(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
505 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23
506
507 template<input_range R1, input_range R2, class Pred = ranges::equal_to, class Proj1 = identity,
508 class Proj2 = identity>
509 requires (forward_range<R1> || sized_range<R1>) &&
510 (forward_range<R2> || sized_range<R2>) &&
511 indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
512 constexpr bool ranges::ends_with(R1&& r1, R2&& r2, Pred pred = {},
513 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23
514
Nikolas Klauser0e3dc1a2022-05-26 14:42:46515 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
516 indirect_unary_predicate<projected<I, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:41517 constexpr bool ranges::none_of(I first, S last, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser0e3dc1a2022-05-26 14:42:46518
519 template<input_range R, class Proj = identity,
520 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:41521 constexpr bool ranges::none_of(R&& r, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser0e3dc1a2022-05-26 14:42:46522
zijunzhao20517552023-05-08 22:04:00523 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
524 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
525 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
526 constexpr bool ranges::starts_with(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
527 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23
528
529 template<input_range R1, input_range R2, class Pred = ranges::equal_to, class Proj1 = identity,
530 class Proj2 = identity>
531 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
532 constexpr bool ranges::starts_with(R1&& r1, R2&& r2, Pred pred = {},
533 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23
534
Konstantin Varlamovdb7d7952022-07-30 09:42:05535 template<input_iterator I1, sentinel_for<I1> S1,
536 random_access_iterator I2, sentinel_for<I2> S2,
537 class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
538 requires indirectly_copyable<I1, I2> && sortable<I2, Comp, Proj2> &&
539 indirect_strict_weak_order<Comp, projected<I1, Proj1>, projected<I2, Proj2>>
540 constexpr partial_sort_copy_result<I1, I2>
541 partial_sort_copy(I1 first, S1 last, I2 result_first, S2 result_last,
Mark de Weverde6827b2023-02-24 20:35:41542 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Konstantin Varlamovdb7d7952022-07-30 09:42:05543
544 template<input_range R1, random_access_range R2, class Comp = ranges::less,
545 class Proj1 = identity, class Proj2 = identity>
546 requires indirectly_copyable<iterator_t<R1>, iterator_t<R2>> &&
547 sortable<iterator_t<R2>, Comp, Proj2> &&
548 indirect_strict_weak_order<Comp, projected<iterator_t<R1>, Proj1>,
549 projected<iterator_t<R2>, Proj2>>
550 constexpr partial_sort_copy_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
551 partial_sort_copy(R1&& r, R2&& result_r, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:41552 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Konstantin Varlamovdb7d7952022-07-30 09:42:05553
Nikolas Klauser11e3ad22022-05-26 14:08:55554 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
555 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
556 constexpr bool ranges::is_sorted(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
557
558 template<forward_range R, class Proj = identity,
559 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
560 constexpr bool ranges::is_sorted(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
561
562 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
563 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
564 constexpr I ranges::is_sorted_until(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
565
566 template<forward_range R, class Proj = identity,
567 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
568 constexpr borrowed_iterator_t<R>
569 ranges::is_sorted_until(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser81715862022-06-05 19:15:16570
Konstantin Varlamov23c73282022-07-08 03:35:51571 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
572 class Proj = identity>
573 requires sortable<I, Comp, Proj>
574 constexpr I
Mark de Weverde6827b2023-02-24 20:35:41575 ranges::nth_element(I first, I nth, S last, Comp comp = {}, Proj proj = {}); // since C++20
Konstantin Varlamov23c73282022-07-08 03:35:51576
577 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
578 requires sortable<iterator_t<R>, Comp, Proj>
579 constexpr borrowed_iterator_t<R>
Mark de Weverde6827b2023-02-24 20:35:41580 ranges::nth_element(R&& r, iterator_t<R> nth, Comp comp = {}, Proj proj = {}); // since C++20
Konstantin Varlamov23c73282022-07-08 03:35:51581
Nikolas Klauser81715862022-06-05 19:15:16582 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
Mark de Weverde6827b2023-02-24 20:35:41583 indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less> // since C++20
584 constexpr I upper_bound(I first, S last, const T& value, Comp comp = {}, Proj proj = {});
Nikolas Klauser81715862022-06-05 19:15:16585
586 template<forward_range R, class T, class Proj = identity,
587 indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
588 ranges::less>
589 constexpr borrowed_iterator_t<R>
Mark de Weverde6827b2023-02-24 20:35:41590 upper_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser81715862022-06-05 19:15:16591
592 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
593 indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
594 constexpr I lower_bound(I first, S last, const T& value, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:41595 Proj proj = {}); // since C++20
Nikolas Klauser81715862022-06-05 19:15:16596 template<forward_range R, class T, class Proj = identity,
597 indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
598 ranges::less>
599 constexpr borrowed_iterator_t<R>
Mark de Weverde6827b2023-02-24 20:35:41600 lower_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser81715862022-06-05 19:15:16601
602 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
603 indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
604 constexpr bool binary_search(I first, S last, const T& value, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:41605 Proj proj = {}); // since C++20
Nikolas Klauserb79b2b62022-06-06 11:57:34606
Nikolas Klauser81715862022-06-05 19:15:16607 template<forward_range R, class T, class Proj = identity,
608 indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
609 ranges::less>
610 constexpr bool binary_search(R&& r, const T& value, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:41611 Proj proj = {}); // since C++20
Konstantin Varlamov8ed702b2022-07-19 04:05:51612
613 template<permutable I, sentinel_for<I> S, class Proj = identity,
614 indirect_unary_predicate<projected<I, Proj>> Pred>
615 constexpr subrange<I>
Mark de Weverde6827b2023-02-24 20:35:41616 partition(I first, S last, Pred pred, Proj proj = {}); // since C++20
Konstantin Varlamov8ed702b2022-07-19 04:05:51617
618 template<forward_range R, class Proj = identity,
619 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
620 requires permutable<iterator_t<R>>
621 constexpr borrowed_subrange_t<R>
Mark de Weverde6827b2023-02-24 20:35:41622 partition(R&& r, Pred pred, Proj proj = {}); // since C++20
Konstantin Varlamov8ed702b2022-07-19 04:05:51623
624 template<bidirectional_iterator I, sentinel_for<I> S, class Proj = identity,
625 indirect_unary_predicate<projected<I, Proj>> Pred>
626 requires permutable<I>
Mark de Weverde6827b2023-02-24 20:35:41627 subrange<I> stable_partition(I first, S last, Pred pred, Proj proj = {}); // since C++20
Konstantin Varlamov8ed702b2022-07-19 04:05:51628
629 template<bidirectional_range R, class Proj = identity,
630 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
631 requires permutable<iterator_t<R>>
Mark de Weverde6827b2023-02-24 20:35:41632 borrowed_subrange_t<R> stable_partition(R&& r, Pred pred, Proj proj = {}); // since C++20
Konstantin Varlamov8ed702b2022-07-19 04:05:51633
Nikolas Klauserb79b2b62022-06-06 11:57:34634 template<input_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2,
635 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
636 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
637 constexpr I1 ranges::find_first_of(I1 first1, S1 last1, I2 first2, S2 last2,
638 Pred pred = {},
639 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
640
641 template<input_range R1, forward_range R2,
642 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
643 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
644 constexpr borrowed_iterator_t<R1>
645 ranges::find_first_of(R1&& r1, R2&& r2,
646 Pred pred = {},
647 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauser81715862022-06-05 19:15:16648
Nikolas Klauser916e9052022-06-08 10:14:12649 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
650 indirect_binary_predicate<projected<I, Proj>,
651 projected<I, Proj>> Pred = ranges::equal_to>
Mark de Weverde6827b2023-02-24 20:35:41652 constexpr I ranges::adjacent_find(I first, S last, Pred pred = {}, Proj proj = {}); // since C++20
Nikolas Klauser916e9052022-06-08 10:14:12653
654 template<forward_range R, class Proj = identity,
655 indirect_binary_predicate<projected<iterator_t<R>, Proj>,
656 projected<iterator_t<R>, Proj>> Pred = ranges::equal_to>
657 constexpr borrowed_iterator_t<R> ranges::adjacent_find(R&& r, Pred pred = {}, Proj proj = {}); // since C++20
658
Nikolas Klauserff6d5de2022-06-07 07:42:10659 template<input_iterator I, sentinel_for<I> S, class T1, class T2, class Proj = identity>
660 requires indirectly_writable<I, const T2&> &&
661 indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*>
662 constexpr I
663 ranges::replace(I first, S last, const T1& old_value, const T2& new_value, Proj proj = {}); // since C++20
664
665 template<input_range R, class T1, class T2, class Proj = identity>
666 requires indirectly_writable<iterator_t<R>, const T2&> &&
667 indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T1*>
668 constexpr borrowed_iterator_t<R>
669 ranges::replace(R&& r, const T1& old_value, const T2& new_value, Proj proj = {}); // since C++20
670
671 template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity,
672 indirect_unary_predicate<projected<I, Proj>> Pred>
673 requires indirectly_writable<I, const T&>
674 constexpr I ranges::replace_if(I first, S last, Pred pred, const T& new_value, Proj proj = {}); // since C++20
675
676 template<input_range R, class T, class Proj = identity,
677 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
678 requires indirectly_writable<iterator_t<R>, const T&>
679 constexpr borrowed_iterator_t<R>
680 ranges::replace_if(R&& r, Pred pred, const T& new_value, Proj proj = {}); // since C++20
681
Nikolas Klausera203acb2022-08-03 23:30:50682 template<class T, class Proj = identity,
683 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
684 constexpr const T&
685 ranges::clamp(const T& v, const T& lo, const T& hi, Comp comp = {}, Proj proj = {}); // since C++20
686
Nikolas Klauserafd5a4f2022-06-15 14:24:43687 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
688 class Proj1 = identity, class Proj2 = identity,
689 indirect_strict_weak_order<projected<I1, Proj1>,
690 projected<I2, Proj2>> Comp = ranges::less>
691 constexpr bool
692 ranges::lexicographical_compare(I1 first1, S1 last1, I2 first2, S2 last2,
Mark de Weverde6827b2023-02-24 20:35:41693 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauserafd5a4f2022-06-15 14:24:43694
695 template<input_range R1, input_range R2, class Proj1 = identity,
696 class Proj2 = identity,
697 indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>,
698 projected<iterator_t<R2>, Proj2>> Comp = ranges::less>
699 constexpr bool
700 ranges::lexicographical_compare(R1&& r1, R2&& r2, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:41701 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauserafd5a4f2022-06-15 14:24:43702
Nikolas Klauser2c3bbac2022-06-23 10:23:41703 template<bidirectional_iterator I1, sentinel_for<I1> S1, bidirectional_iterator I2>
704 requires indirectly_movable<I1, I2>
705 constexpr ranges::move_backward_result<I1, I2>
706 ranges::move_backward(I1 first, S1 last, I2 result); // since C++20
707
708 template<bidirectional_range R, bidirectional_iterator I>
709 requires indirectly_movable<iterator_t<R>, I>
710 constexpr ranges::move_backward_result<borrowed_iterator_t<R>, I>
711 ranges::move_backward(R&& r, I result); // since C++20
712
713 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O>
714 requires indirectly_movable<I, O>
715 constexpr ranges::move_result<I, O>
716 ranges::move(I first, S last, O result); // since C++20
717
718 template<input_range R, weakly_incrementable O>
719 requires indirectly_movable<iterator_t<R>, O>
720 constexpr ranges::move_result<borrowed_iterator_t<R>, O>
721 ranges::move(R&& r, O result); // since C++20
722
Konstantin Varlamov065202f2022-07-20 08:57:13723 template<class I, class O1, class O2>
724 using partition_copy_result = in_out_out_result<I, O1, O2>; // since C++20
725
726 template<input_iterator I, sentinel_for<I> S,
727 weakly_incrementable O1, weakly_incrementable O2,
728 class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
729 requires indirectly_copyable<I, O1> && indirectly_copyable<I, O2>
730 constexpr partition_copy_result<I, O1, O2>
731 partition_copy(I first, S last, O1 out_true, O2 out_false, Pred pred,
Mark de Weverde6827b2023-02-24 20:35:41732 Proj proj = {}); // since C++20
Konstantin Varlamov065202f2022-07-20 08:57:13733
734 template<input_range R, weakly_incrementable O1, weakly_incrementable O2,
735 class Proj = identity,
736 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
737 requires indirectly_copyable<iterator_t<R>, O1> &&
738 indirectly_copyable<iterator_t<R>, O2>
739 constexpr partition_copy_result<borrowed_iterator_t<R>, O1, O2>
Mark de Weverde6827b2023-02-24 20:35:41740 partition_copy(R&& r, O1 out_true, O2 out_false, Pred pred, Proj proj = {}); // since C++20
Konstantin Varlamov065202f2022-07-20 08:57:13741
742 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
743 indirect_unary_predicate<projected<I, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:41744 constexpr I partition_point(I first, S last, Pred pred, Proj proj = {}); // since C++20
Konstantin Varlamov065202f2022-07-20 08:57:13745
746 template<forward_range R, class Proj = identity,
747 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
748 constexpr borrowed_iterator_t<R>
Mark de Weverde6827b2023-02-24 20:35:41749 partition_point(R&& r, Pred pred, Proj proj = {}); // since C++20
Konstantin Varlamov065202f2022-07-20 08:57:13750
Hui Xie25607d12022-06-26 15:13:43751 template<class I1, class I2, class O>
752 using merge_result = in_in_out_result<I1, I2, O>; // since C++20
753
754 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
755 weakly_incrementable O, class Comp = ranges::less, class Proj1 = identity,
756 class Proj2 = identity>
757 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
758 constexpr merge_result<I1, I2, O>
759 merge(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, class Comp = ranges::less,
763 class Proj1 = identity, class Proj2 = identity>
764 requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
765 constexpr merge_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
766 merge(R1&& r1, R2&& r2, O result,
767 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauser2c3bbac2022-06-23 10:23:41768
Nikolas Klauserf8cbe3cdf2022-07-06 12:03:00769 template<permutable I, sentinel_for<I> S, class T, class Proj = identity>
770 requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
771 constexpr subrange<I> ranges::remove(I first, S last, const T& value, Proj proj = {}); // since C++20
772
773 template<forward_range R, class T, class Proj = identity>
774 requires permutable<iterator_t<R>> &&
775 indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
776 constexpr borrowed_subrange_t<R>
777 ranges::remove(R&& r, const T& value, Proj proj = {}); // since C++20
778
779 template<permutable I, sentinel_for<I> S, class Proj = identity,
780 indirect_unary_predicate<projected<I, Proj>> Pred>
781 constexpr subrange<I> ranges::remove_if(I first, S last, Pred pred, Proj proj = {}); // since C++20
782
783 template<forward_range R, class Proj = identity,
784 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
785 requires permutable<iterator_t<R>>
786 constexpr borrowed_subrange_t<R>
787 ranges::remove_if(R&& r, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser7d426a32022-07-11 15:07:35788
Hui Xie1cdec6c2022-06-26 15:13:43789 template<class I, class O>
Nikolas Klauser7d426a32022-07-11 15:07:35790 using set_difference_result = in_out_result<I, O>; // since C++20
Hui Xie1cdec6c2022-06-26 15:13:43791
792 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
793 weakly_incrementable O, class Comp = ranges::less,
794 class Proj1 = identity, class Proj2 = identity>
795 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
796 constexpr set_difference_result<I1, O>
797 set_difference(I1 first1, S1 last1, I2 first2, S2 last2, O result,
798 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
799
800 template<input_range R1, input_range R2, weakly_incrementable O,
801 class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
802 requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
803 constexpr set_difference_result<borrowed_iterator_t<R1>, O>
804 set_difference(R1&& r1, R2&& r2, O result,
805 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauserf8cbe3cdf2022-07-06 12:03:00806
Hui Xie96b674f2022-07-08 14:21:40807 template<class I1, class I2, class O>
808 using set_intersection_result = in_in_out_result<I1, I2, O>; // since C++20
809
810 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
811 weakly_incrementable O, class Comp = ranges::less,
812 class Proj1 = identity, class Proj2 = identity>
813 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
814 constexpr set_intersection_result<I1, I2, O>
815 set_intersection(I1 first1, S1 last1, I2 first2, S2 last2, O result,
816 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
817
818 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
819 weakly_incrementable O, class Comp = ranges::less,
820 class Proj1 = identity, class Proj2 = identity>
821 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
822 constexpr set_intersection_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
823 set_intersection(R1&& r1, R2&& r2, O result,
824 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
825
Nikolas Klauser7d426a32022-07-11 15:07:35826 template <class _InIter, class _OutIter>
827 using reverse_copy_result = in_out_result<_InIter, _OutIter>; // since C++20
828
829 template<bidirectional_iterator I, sentinel_for<I> S, weakly_incrementable O>
830 requires indirectly_copyable<I, O>
831 constexpr ranges::reverse_copy_result<I, O>
832 ranges::reverse_copy(I first, S last, O result); // since C++20
833
834 template<bidirectional_range R, weakly_incrementable O>
835 requires indirectly_copyable<iterator_t<R>, O>
836 constexpr ranges::reverse_copy_result<borrowed_iterator_t<R>, O>
837 ranges::reverse_copy(R&& r, O result); // since C++20
838
Konstantin Varlamov36c746c2022-08-03 23:04:14839 template<permutable I, sentinel_for<I> S>
840 constexpr subrange<I> rotate(I first, I middle, S last); // since C++20
841
842 template<forward_range R>
843 requires permutable<iterator_t<R>>
Mark de Weverde6827b2023-02-24 20:35:41844 constexpr borrowed_subrange_t<R> rotate(R&& r, iterator_t<R> middle); // since C++20
Konstantin Varlamov36c746c2022-08-03 23:04:14845
Nikolas Klauser7d426a32022-07-11 15:07:35846 template <class _InIter, class _OutIter>
847 using rotate_copy_result = in_out_result<_InIter, _OutIter>; // since C++20
848
849 template<forward_iterator I, sentinel_for<I> S, weakly_incrementable O>
850 requires indirectly_copyable<I, O>
851 constexpr ranges::rotate_copy_result<I, O>
852 ranges::rotate_copy(I first, I middle, S last, O result); // since C++20
853
854 template<forward_range R, weakly_incrementable O>
855 requires indirectly_copyable<iterator_t<R>, O>
856 constexpr ranges::rotate_copy_result<borrowed_iterator_t<R>, O>
857 ranges::rotate_copy(R&& r, iterator_t<R> middle, O result); // since C++20
858
Konstantin Varlamov6bdb6422022-08-03 05:33:12859 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Gen>
860 requires (forward_iterator<I> || random_access_iterator<O>) &&
861 indirectly_copyable<I, O> &&
862 uniform_random_bit_generator<remove_reference_t<Gen>>
Mark de Weverde6827b2023-02-24 20:35:41863 O sample(I first, S last, O out, iter_difference_t<I> n, Gen&& g); // since C++20
Konstantin Varlamov6bdb6422022-08-03 05:33:12864
865 template<input_range R, weakly_incrementable O, class Gen>
866 requires (forward_range<R> || random_access_iterator<O>) &&
867 indirectly_copyable<iterator_t<R>, O> &&
868 uniform_random_bit_generator<remove_reference_t<Gen>>
Mark de Weverde6827b2023-02-24 20:35:41869 O sample(R&& r, O out, range_difference_t<R> n, Gen&& g); // since C++20
Konstantin Varlamov6bdb6422022-08-03 05:33:12870
Konstantin Varlamov14cf74d2022-07-22 16:58:56871 template<random_access_iterator I, sentinel_for<I> S, class Gen>
872 requires permutable<I> &&
873 uniform_random_bit_generator<remove_reference_t<Gen>>
Mark de Weverde6827b2023-02-24 20:35:41874 I shuffle(I first, S last, Gen&& g); // since C++20
Konstantin Varlamov14cf74d2022-07-22 16:58:56875
876 template<random_access_range R, class Gen>
877 requires permutable<iterator_t<R>> &&
878 uniform_random_bit_generator<remove_reference_t<Gen>>
Mark de Weverde6827b2023-02-24 20:35:41879 borrowed_iterator_t<R> shuffle(R&& r, Gen&& g); // since C++20
Konstantin Varlamov14cf74d2022-07-22 16:58:56880
Nikolas Klauser101d1e92022-07-13 16:07:26881 template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2,
Nikolas Klauser4038c852022-08-04 17:54:13882 sentinel_for<I2> S2, class Proj1 = identity, class Proj2 = identity,
883 indirect_equivalence_relation<projected<I1, Proj1>,
884 projected<I2, Proj2>> Pred = ranges::equal_to>
885 constexpr bool ranges::is_permutation(I1 first1, S1 last1, I2 first2, S2 last2,
886 Pred pred = {},
Mark de Weverde6827b2023-02-24 20:35:41887 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauser4038c852022-08-04 17:54:13888
889 template<forward_range R1, forward_range R2,
890 class Proj1 = identity, class Proj2 = identity,
891 indirect_equivalence_relation<projected<iterator_t<R1>, Proj1>,
892 projected<iterator_t<R2>, Proj2>> Pred = ranges::equal_to>
893 constexpr bool ranges::is_permutation(R1&& r1, R2&& r2, Pred pred = {},
Mark de Weverde6827b2023-02-24 20:35:41894 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauser4038c852022-08-04 17:54:13895
896 template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2,
Nikolas Klauser101d1e92022-07-13 16:07:26897 sentinel_for<I2> S2, class Pred = ranges::equal_to,
898 class Proj1 = identity, class Proj2 = identity>
899 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
900 constexpr subrange<I1>
901 ranges::search(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
902 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
903
904 template<forward_range R1, forward_range R2, class Pred = ranges::equal_to,
905 class Proj1 = identity, class Proj2 = identity>
906 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
907 constexpr borrowed_subrange_t<R1>
908 ranges::search(R1&& r1, R2&& r2, Pred pred = {},
909 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
910
911 template<forward_iterator I, sentinel_for<I> S, class T,
912 class Pred = ranges::equal_to, class Proj = identity>
913 requires indirectly_comparable<I, const T*, Pred, Proj>
914 constexpr subrange<I>
915 ranges::search_n(I first, S last, iter_difference_t<I> count,
916 const T& value, Pred pred = {}, Proj proj = {}); // since C++20
917
918 template<forward_range R, class T, class Pred = ranges::equal_to,
919 class Proj = identity>
920 requires indirectly_comparable<iterator_t<R>, const T*, Pred, Proj>
921 constexpr borrowed_subrange_t<R>
922 ranges::search_n(R&& r, range_difference_t<R> count,
923 const T& value, Pred pred = {}, Proj proj = {}); // since C++20
924
Christopher Di Bella39034382023-12-20 05:57:50925 template<input_iterator I, sentinel_for<I> S, class T,
926 indirectly-binary-left-foldable<T, I> F>
927 constexpr auto ranges::fold_left(I first, S last, T init, F f); // since C++23
928
929 template<input_range R, class T, indirectly-binary-left-foldable<T, iterator_t<R>> F>
930 constexpr auto fold_left(R&& r, T init, F f); // since C++23
931
932 template<class I, class T>
933 using fold_left_with_iter_result = in_value_result<I, T>; // since C++23
934
935 template<input_iterator I, sentinel_for<I> S, class T,
936 indirectly-binary-left-foldable<T, I> F>
937 constexpr see below fold_left_with_iter(I first, S last, T init, F f); // since C++23
938
939 template<input_range R, class T, indirectly-binary-left-foldable<T, iterator_t<R>> F>
940 constexpr see below fold_left_with_iter(R&& r, T init, F f); // since C++23
941
Nikolas Klauser101d1e92022-07-13 16:07:26942 template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2,
943 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
944 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
945 constexpr subrange<I1>
946 ranges::find_end(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
947 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
948
949 template<forward_range R1, forward_range R2,
950 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
951 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
952 constexpr borrowed_subrange_t<R1>
953 ranges::find_end(R1&& r1, R2&& r2, Pred pred = {},
954 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
955
Hui Xiea5c06382022-07-11 22:39:59956 template<class I1, class I2, class O>
957 using set_symmetric_difference_result = in_in_out_result<I1, I2, O>; // since C++20
958
959 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
960 weakly_incrementable O, class Comp = ranges::less,
961 class Proj1 = identity, class Proj2 = identity>
962 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
963 constexpr set_symmetric_difference_result<I1, I2, O>
964 set_symmetric_difference(I1 first1, S1 last1, I2 first2, S2 last2, O result,
965 Comp comp = {}, Proj1 proj1 = {},
966 Proj2 proj2 = {}); // since C++20
Hui Xie8a617492022-07-27 12:20:16967
Hui Xiea5c06382022-07-11 22:39:59968 template<input_range R1, input_range R2, weakly_incrementable O,
969 class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
970 requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
971 constexpr set_symmetric_difference_result<borrowed_iterator_t<R1>,
972 borrowed_iterator_t<R2>, O>
973 set_symmetric_difference(R1&& r1, R2&& r2, O result, Comp comp = {},
974 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Hui Xie0f6364b82022-07-14 19:35:15975
976 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
977 indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
978 constexpr subrange<I>
979 equal_range(I first, S last, const T& value, Comp comp = {}, Proj proj = {}); // since C++20
Hui Xie8a617492022-07-27 12:20:16980
Hui Xie0f6364b82022-07-14 19:35:15981 template<forward_range R, class T, class Proj = identity,
982 indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
983 ranges::less>
984 constexpr borrowed_subrange_t<R>
985 equal_range(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20
Hui Xie8a617492022-07-27 12:20:16986
Hui Xie3151b952022-07-13 16:20:22987 template<class I1, class I2, class O>
988 using set_union_result = in_in_out_result<I1, I2, O>; // since C++20
989
990 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
991 weakly_incrementable O, class Comp = ranges::less,
992 class Proj1 = identity, class Proj2 = identity>
993 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
994 constexpr set_union_result<I1, I2, O>
995 set_union(I1 first1, S1 last1, I2 first2, S2 last2, O result, Comp comp = {},
996 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
997
998 template<input_range R1, input_range R2, weakly_incrementable O,
999 class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
1000 requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
1001 constexpr set_union_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
1002 set_union(R1&& r1, R2&& r2, O result, Comp comp = {},
1003 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Hui Xiec5599642022-07-19 19:54:351004
1005 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
1006 class Proj1 = identity, class Proj2 = identity,
1007 indirect_strict_weak_order<projected<I1, Proj1>, projected<I2, Proj2>> Comp =
1008 ranges::less>
1009 constexpr bool includes(I1 first1, S1 last1, I2 first2, S2 last2, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:411010 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Hui Xie8a617492022-07-27 12:20:161011
Hui Xiec5599642022-07-19 19:54:351012 template<input_range R1, input_range R2, class Proj1 = identity,
1013 class Proj2 = identity,
1014 indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>,
1015 projected<iterator_t<R2>, Proj2>> Comp = ranges::less>
1016 constexpr bool includes(R1&& r1, R2&& r2, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:411017 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Hui Xie8a617492022-07-27 12:20:161018
1019 template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
1020 class Proj = identity>
1021 requires sortable<I, Comp, Proj>
Mark de Weverde6827b2023-02-24 20:35:411022 I inplace_merge(I first, I middle, S last, Comp comp = {}, Proj proj = {}); // since C++20
Hui Xie8a617492022-07-27 12:20:161023
1024 template<bidirectional_range R, class Comp = ranges::less, class Proj = identity>
1025 requires sortable<iterator_t<R>, Comp, Proj>
1026 borrowed_iterator_t<R>
1027 inplace_merge(R&& r, iterator_t<R> middle, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:411028 Proj proj = {}); // since C++20
Hui Xie72f57e32022-07-23 00:44:251029
1030 template<permutable I, sentinel_for<I> S, class Proj = identity,
1031 indirect_equivalence_relation<projected<I, Proj>> C = ranges::equal_to>
Mark de Weverde6827b2023-02-24 20:35:411032 constexpr subrange<I> unique(I first, S last, C comp = {}, Proj proj = {}); // since C++20
Hui Xie72f57e32022-07-23 00:44:251033
1034 template<forward_range R, class Proj = identity,
1035 indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to>
1036 requires permutable<iterator_t<R>>
1037 constexpr borrowed_subrange_t<R>
Mark de Weverde6827b2023-02-24 20:35:411038 unique(R&& r, C comp = {}, Proj proj = {}); // since C++20
Hui Xie72f57e32022-07-23 00:44:251039
1040 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Proj = identity,
1041 indirect_equivalence_relation<projected<I, Proj>> C = ranges::equal_to>
1042 requires indirectly_copyable<I, O> &&
1043 (forward_iterator<I> ||
1044 (input_iterator<O> && same_as<iter_value_t<I>, iter_value_t<O>>) ||
1045 indirectly_copyable_storable<I, O>)
1046 constexpr unique_copy_result<I, O>
Mark de Weverde6827b2023-02-24 20:35:411047 unique_copy(I first, S last, O result, C comp = {}, Proj proj = {}); // since C++20
Hui Xie72f57e32022-07-23 00:44:251048
1049 template<input_range R, weakly_incrementable O, class Proj = identity,
1050 indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to>
1051 requires indirectly_copyable<iterator_t<R>, O> &&
1052 (forward_iterator<iterator_t<R>> ||
1053 (input_iterator<O> && same_as<range_value_t<R>, iter_value_t<O>>) ||
1054 indirectly_copyable_storable<iterator_t<R>, O>)
1055 constexpr unique_copy_result<borrowed_iterator_t<R>, O>
Mark de Weverde6827b2023-02-24 20:35:411056 unique_copy(R&& r, O result, C comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591057
1058 template<class I, class O>
Mark de Weverde6827b2023-02-24 20:35:411059 using remove_copy_result = in_out_result<I, O>; // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591060
1061 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class T,
1062 class Proj = identity>
1063 indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
1064 constexpr remove_copy_result<I, O>
Mark de Weverde6827b2023-02-24 20:35:411065 remove_copy(I first, S last, O result, const T& value, Proj proj = {}); // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591066
1067 template<input_range R, weakly_incrementable O, class T, class Proj = identity>
1068 requires indirectly_copyable<iterator_t<R>, O> &&
1069 indirect_binary_predicate<ranges::equal_to,
1070 projected<iterator_t<R>, Proj>, const T*>
1071 constexpr remove_copy_result<borrowed_iterator_t<R>, O>
Mark de Weverde6827b2023-02-24 20:35:411072 remove_copy(R&& r, O result, const T& value, Proj proj = {}); // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591073
1074 template<class I, class O>
Mark de Weverde6827b2023-02-24 20:35:411075 using remove_copy_if_result = in_out_result<I, O>; // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591076
1077 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O,
1078 class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
1079 requires indirectly_copyable<I, O>
1080 constexpr remove_copy_if_result<I, O>
Mark de Weverde6827b2023-02-24 20:35:411081 remove_copy_if(I first, S last, O result, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591082
1083 template<input_range R, weakly_incrementable O, class Proj = identity,
1084 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
1085 requires indirectly_copyable<iterator_t<R>, O>
1086 constexpr remove_copy_if_result<borrowed_iterator_t<R>, O>
Mark de Weverde6827b2023-02-24 20:35:411087 remove_copy_if(R&& r, O result, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591088
Nikolas Klauser93172c12022-08-03 05:25:001089 template<class I, class O>
Mark de Weverde6827b2023-02-24 20:35:411090 using replace_copy_result = in_out_result<I, O>; // since C++20
Nikolas Klauser93172c12022-08-03 05:25:001091
1092 template<input_iterator I, sentinel_for<I> S, class T1, class T2,
1093 output_iterator<const T2&> O, class Proj = identity>
1094 requires indirectly_copyable<I, O> &&
1095 indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*>
1096 constexpr replace_copy_result<I, O>
1097 replace_copy(I first, S last, O result, const T1& old_value, const T2& new_value,
Mark de Weverde6827b2023-02-24 20:35:411098 Proj proj = {}); // since C++20
Nikolas Klauser93172c12022-08-03 05:25:001099
1100 template<input_range R, class T1, class T2, output_iterator<const T2&> O,
1101 class Proj = identity>
1102 requires indirectly_copyable<iterator_t<R>, O> &&
1103 indirect_binary_predicate<ranges::equal_to,
1104 projected<iterator_t<R>, Proj>, const T1*>
1105 constexpr replace_copy_result<borrowed_iterator_t<R>, O>
1106 replace_copy(R&& r, O result, const T1& old_value, const T2& new_value,
Mark de Weverde6827b2023-02-24 20:35:411107 Proj proj = {}); // since C++20
Nikolas Klauser93172c12022-08-03 05:25:001108
1109 template<class I, class O>
Mark de Weverde6827b2023-02-24 20:35:411110 using replace_copy_if_result = in_out_result<I, O>; // since C++20
Nikolas Klauser93172c12022-08-03 05:25:001111
1112 template<input_iterator I, sentinel_for<I> S, class T, output_iterator<const T&> O,
1113 class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
1114 requires indirectly_copyable<I, O>
1115 constexpr replace_copy_if_result<I, O>
1116 replace_copy_if(I first, S last, O result, Pred pred, const T& new_value,
Mark de Weverde6827b2023-02-24 20:35:411117 Proj proj = {}); // since C++20
Nikolas Klauser93172c12022-08-03 05:25:001118
1119 template<input_range R, class T, output_iterator<const T&> O, class Proj = identity,
1120 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
1121 requires indirectly_copyable<iterator_t<R>, O>
1122 constexpr replace_copy_if_result<borrowed_iterator_t<R>, O>
1123 replace_copy_if(R&& r, O result, Pred pred, const T& new_value,
Mark de Weverde6827b2023-02-24 20:35:411124 Proj proj = {}); // since C++20
Nikolas Klauser93172c12022-08-03 05:25:001125
Nikolas Klauser68264b62022-08-03 05:40:131126 template<class I>
Mark de Weverde6827b2023-02-24 20:35:411127 using prev_permutation_result = in_found_result<I>; // since C++20
Nikolas Klauser68264b62022-08-03 05:40:131128
1129 template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
1130 class Proj = identity>
1131 requires sortable<I, Comp, Proj>
1132 constexpr ranges::prev_permutation_result<I>
Mark de Weverde6827b2023-02-24 20:35:411133 ranges::prev_permutation(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser68264b62022-08-03 05:40:131134
1135 template<bidirectional_range R, class Comp = ranges::less,
1136 class Proj = identity>
1137 requires sortable<iterator_t<R>, Comp, Proj>
1138 constexpr ranges::prev_permutation_result<borrowed_iterator_t<R>>
Mark de Weverde6827b2023-02-24 20:35:411139 ranges::prev_permutation(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser68264b62022-08-03 05:40:131140
1141 template<class I>
Mark de Weverde6827b2023-02-24 20:35:411142 using next_permutation_result = in_found_result<I>; // since C++20
Nikolas Klauser68264b62022-08-03 05:40:131143
1144 template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
1145 class Proj = identity>
1146 requires sortable<I, Comp, Proj>
1147 constexpr ranges::next_permutation_result<I>
Mark de Weverde6827b2023-02-24 20:35:411148 ranges::next_permutation(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser68264b62022-08-03 05:40:131149
1150 template<bidirectional_range R, class Comp = ranges::less,
1151 class Proj = identity>
1152 requires sortable<iterator_t<R>, Comp, Proj>
1153 constexpr ranges::next_permutation_result<borrowed_iterator_t<R>>
Mark de Weverde6827b2023-02-24 20:35:411154 ranges::next_permutation(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser68264b62022-08-03 05:40:131155
Nikolas Klauserd3729bb2022-01-14 01:55:511156}
1157
Nikolas Klauser68264b62022-08-03 05:40:131158template <class InputIterator, class Predicate>
Marshall Clow706ffef2018-01-15 17:20:361159 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161160 all_of(InputIterator first, InputIterator last, Predicate pred);
1161
1162template <class InputIterator, class Predicate>
Marshall Clow706ffef2018-01-15 17:20:361163 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161164 any_of(InputIterator first, InputIterator last, Predicate pred);
1165
1166template <class InputIterator, class Predicate>
Marshall Clow706ffef2018-01-15 17:20:361167 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161168 none_of(InputIterator first, InputIterator last, Predicate pred);
1169
1170template <class InputIterator, class Function>
Marshall Clow1b9a4ff2018-01-22 20:44:331171 constexpr Function // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161172 for_each(InputIterator first, InputIterator last, Function f);
1173
Marshall Clowd5c65ff2017-05-25 02:29:541174template<class InputIterator, class Size, class Function>
Marshall Clow1b9a4ff2018-01-22 20:44:331175 constexpr InputIterator // constexpr in C++20
1176 for_each_n(InputIterator first, Size n, Function f); // C++17
Marshall Clowd5c65ff2017-05-25 02:29:541177
Howard Hinnant3e519522010-05-11 19:42:161178template <class InputIterator, class T>
Marshall Clow86944282018-01-15 19:26:051179 constexpr InputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161180 find(InputIterator first, InputIterator last, const T& value);
1181
1182template <class InputIterator, class Predicate>
Marshall Clow86944282018-01-15 19:26:051183 constexpr InputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161184 find_if(InputIterator first, InputIterator last, Predicate pred);
1185
1186template<class InputIterator, class Predicate>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181187 constexpr InputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161188 find_if_not(InputIterator first, InputIterator last, Predicate pred);
1189
1190template <class ForwardIterator1, class ForwardIterator2>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181191 constexpr ForwardIterator1 // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161192 find_end(ForwardIterator1 first1, ForwardIterator1 last1,
1193 ForwardIterator2 first2, ForwardIterator2 last2);
1194
1195template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181196 constexpr ForwardIterator1 // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161197 find_end(ForwardIterator1 first1, ForwardIterator1 last1,
1198 ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
1199
1200template <class ForwardIterator1, class ForwardIterator2>
Marshall Clow86944282018-01-15 19:26:051201 constexpr ForwardIterator1 // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161202 find_first_of(ForwardIterator1 first1, ForwardIterator1 last1,
1203 ForwardIterator2 first2, ForwardIterator2 last2);
1204
1205template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
Marshall Clow86944282018-01-15 19:26:051206 constexpr ForwardIterator1 // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161207 find_first_of(ForwardIterator1 first1, ForwardIterator1 last1,
1208 ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
1209
1210template <class ForwardIterator>
Marshall Clow86944282018-01-15 19:26:051211 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161212 adjacent_find(ForwardIterator first, ForwardIterator last);
1213
1214template <class ForwardIterator, class BinaryPredicate>
Marshall Clow86944282018-01-15 19:26:051215 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161216 adjacent_find(ForwardIterator first, ForwardIterator last, BinaryPredicate pred);
1217
1218template <class InputIterator, class T>
Marshall Clow056f15e2018-01-15 19:40:341219 constexpr typename iterator_traits<InputIterator>::difference_type // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161220 count(InputIterator first, InputIterator last, const T& value);
1221
1222template <class InputIterator, class Predicate>
Marshall Clow056f15e2018-01-15 19:40:341223 constexpr typename iterator_traits<InputIterator>::difference_type // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161224 count_if(InputIterator first, InputIterator last, Predicate pred);
1225
1226template <class InputIterator1, class InputIterator2>
Marshall Clow6538e28d2018-01-16 02:04:101227 constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161228 mismatch(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2);
1229
Marshall Clow0b0bbd22013-05-09 21:14:231230template <class InputIterator1, class InputIterator2>
Marshall Clow6538e28d2018-01-16 02:04:101231 constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20
Aditya Kumar331fb802016-08-25 11:52:381232 mismatch(InputIterator1 first1, InputIterator1 last1,
Marshall Clow0b0bbd22013-05-09 21:14:231233 InputIterator2 first2, InputIterator2 last2); // **C++14**
1234
Howard Hinnant3e519522010-05-11 19:42:161235template <class InputIterator1, class InputIterator2, class BinaryPredicate>
Marshall Clow6538e28d2018-01-16 02:04:101236 constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161237 mismatch(InputIterator1 first1, InputIterator1 last1,
1238 InputIterator2 first2, BinaryPredicate pred);
1239
Marshall Clow0b0bbd22013-05-09 21:14:231240template <class InputIterator1, class InputIterator2, class BinaryPredicate>
Marshall Clow6538e28d2018-01-16 02:04:101241 constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20
Marshall Clow0b0bbd22013-05-09 21:14:231242 mismatch(InputIterator1 first1, InputIterator1 last1,
1243 InputIterator2 first2, InputIterator2 last2,
1244 BinaryPredicate pred); // **C++14**
1245
Howard Hinnant3e519522010-05-11 19:42:161246template <class InputIterator1, class InputIterator2>
Marshall Clow6538e28d2018-01-16 02:04:101247 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161248 equal(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2);
1249
Marshall Clow0b0bbd22013-05-09 21:14:231250template <class InputIterator1, class InputIterator2>
Marshall Clow6538e28d2018-01-16 02:04:101251 constexpr bool // constexpr in C++20
Aditya Kumar331fb802016-08-25 11:52:381252 equal(InputIterator1 first1, InputIterator1 last1,
Marshall Clow0b0bbd22013-05-09 21:14:231253 InputIterator2 first2, InputIterator2 last2); // **C++14**
1254
Howard Hinnant3e519522010-05-11 19:42:161255template <class InputIterator1, class InputIterator2, class BinaryPredicate>
Marshall Clow6538e28d2018-01-16 02:04:101256 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161257 equal(InputIterator1 first1, InputIterator1 last1,
1258 InputIterator2 first2, BinaryPredicate pred);
1259
Marshall Clow0b0bbd22013-05-09 21:14:231260template <class InputIterator1, class InputIterator2, class BinaryPredicate>
Marshall Clow6538e28d2018-01-16 02:04:101261 constexpr bool // constexpr in C++20
Marshall Clow0b0bbd22013-05-09 21:14:231262 equal(InputIterator1 first1, InputIterator1 last1,
1263 InputIterator2 first2, InputIterator2 last2,
1264 BinaryPredicate pred); // **C++14**
1265
Howard Hinnant3e519522010-05-11 19:42:161266template<class ForwardIterator1, class ForwardIterator2>
Marshall Clow49c76432018-01-15 16:16:321267 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161268 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
1269 ForwardIterator2 first2);
1270
Marshall Clow0b0bbd22013-05-09 21:14:231271template<class ForwardIterator1, class ForwardIterator2>
Marshall Clow49c76432018-01-15 16:16:321272 constexpr bool // constexpr in C++20
Marshall Clow0b0bbd22013-05-09 21:14:231273 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
1274 ForwardIterator2 first2, ForwardIterator2 last2); // **C++14**
1275
Howard Hinnant3e519522010-05-11 19:42:161276template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
Marshall Clow49c76432018-01-15 16:16:321277 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161278 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
1279 ForwardIterator2 first2, BinaryPredicate pred);
1280
Marshall Clow0b0bbd22013-05-09 21:14:231281template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
Marshall Clow49c76432018-01-15 16:16:321282 constexpr bool // constexpr in C++20
Marshall Clow0b0bbd22013-05-09 21:14:231283 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
1284 ForwardIterator2 first2, ForwardIterator2 last2,
1285 BinaryPredicate pred); // **C++14**
1286
Howard Hinnant3e519522010-05-11 19:42:161287template <class ForwardIterator1, class ForwardIterator2>
Marshall Clow12f0a772018-01-16 15:48:271288 constexpr ForwardIterator1 // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161289 search(ForwardIterator1 first1, ForwardIterator1 last1,
1290 ForwardIterator2 first2, ForwardIterator2 last2);
1291
1292template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
Marshall Clow12f0a772018-01-16 15:48:271293 constexpr ForwardIterator1 // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161294 search(ForwardIterator1 first1, ForwardIterator1 last1,
1295 ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
1296
1297template <class ForwardIterator, class Size, class T>
Marshall Clow12f0a772018-01-16 15:48:271298 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161299 search_n(ForwardIterator first, ForwardIterator last, Size count, const T& value);
1300
1301template <class ForwardIterator, class Size, class T, class BinaryPredicate>
Marshall Clow12f0a772018-01-16 15:48:271302 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161303 search_n(ForwardIterator first, ForwardIterator last,
1304 Size count, const T& value, BinaryPredicate pred);
1305
1306template <class InputIterator, class OutputIterator>
Louis Dionne13c90a52019-11-06 12:02:411307 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161308 copy(InputIterator first, InputIterator last, OutputIterator result);
1309
1310template<class InputIterator, class OutputIterator, class Predicate>
Louis Dionne13c90a52019-11-06 12:02:411311 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161312 copy_if(InputIterator first, InputIterator last,
1313 OutputIterator result, Predicate pred);
1314
1315template<class InputIterator, class Size, class OutputIterator>
Louis Dionne13c90a52019-11-06 12:02:411316 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161317 copy_n(InputIterator first, Size n, OutputIterator result);
1318
1319template <class BidirectionalIterator1, class BidirectionalIterator2>
Louis Dionne13c90a52019-11-06 12:02:411320 constexpr BidirectionalIterator2 // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161321 copy_backward(BidirectionalIterator1 first, BidirectionalIterator1 last,
1322 BidirectionalIterator2 result);
1323
Konstantin Varlamov79a2b4b2022-06-28 18:59:591324// [alg.move], move
1325template<class InputIterator, class OutputIterator>
1326 constexpr OutputIterator move(InputIterator first, InputIterator last,
1327 OutputIterator result);
1328
1329template<class BidirectionalIterator1, class BidirectionalIterator2>
1330 constexpr BidirectionalIterator2
1331 move_backward(BidirectionalIterator1 first, BidirectionalIterator1 last,
1332 BidirectionalIterator2 result);
1333
Howard Hinnant3e519522010-05-11 19:42:161334template <class ForwardIterator1, class ForwardIterator2>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181335 constexpr ForwardIterator2 // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161336 swap_ranges(ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2);
1337
Konstantin Varlamov79a2b4b2022-06-28 18:59:591338namespace ranges {
1339 template<class I1, class I2>
1340 using swap_ranges_result = in_in_result<I1, I2>;
1341
Nikolas Klauser9d905312022-02-10 12:33:031342template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2>
1343 requires indirectly_swappable<I1, I2>
1344 constexpr ranges::swap_ranges_result<I1, I2>
Konstantin Varlamov79a2b4b2022-06-28 18:59:591345 swap_ranges(I1 first1, S1 last1, I2 first2, S2 last2);
Nikolas Klauser9d905312022-02-10 12:33:031346
1347template<input_range R1, input_range R2>
1348 requires indirectly_swappable<iterator_t<R1>, iterator_t<R2>>
1349 constexpr ranges::swap_ranges_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
Konstantin Varlamov79a2b4b2022-06-28 18:59:591350 swap_ranges(R1&& r1, R2&& r2);
1351}
Nikolas Klauser9d905312022-02-10 12:33:031352
Howard Hinnant3e519522010-05-11 19:42:161353template <class ForwardIterator1, class ForwardIterator2>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181354 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161355 iter_swap(ForwardIterator1 a, ForwardIterator2 b);
1356
1357template <class InputIterator, class OutputIterator, class UnaryOperation>
Marshall Clow99894b62018-01-19 17:45:391358 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161359 transform(InputIterator first, InputIterator last, OutputIterator result, UnaryOperation op);
1360
1361template <class InputIterator1, class InputIterator2, class OutputIterator, class BinaryOperation>
Marshall Clow99894b62018-01-19 17:45:391362 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161363 transform(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2,
1364 OutputIterator result, BinaryOperation binary_op);
1365
1366template <class ForwardIterator, class T>
Marshall Clow12c74232018-01-19 18:07:291367 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161368 replace(ForwardIterator first, ForwardIterator last, const T& old_value, const T& new_value);
1369
1370template <class ForwardIterator, class Predicate, class T>
Marshall Clow12c74232018-01-19 18:07:291371 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161372 replace_if(ForwardIterator first, ForwardIterator last, Predicate pred, const T& new_value);
1373
1374template <class InputIterator, class OutputIterator, class T>
Marshall Clow12c74232018-01-19 18:07:291375 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161376 replace_copy(InputIterator first, InputIterator last, OutputIterator result,
1377 const T& old_value, const T& new_value);
1378
1379template <class InputIterator, class OutputIterator, class Predicate, class T>
Marshall Clow12c74232018-01-19 18:07:291380 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161381 replace_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred, const T& new_value);
1382
1383template <class ForwardIterator, class T>
Marshall Clow4bfb9312018-01-20 20:14:321384 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161385 fill(ForwardIterator first, ForwardIterator last, const T& value);
1386
1387template <class OutputIterator, class Size, class T>
Marshall Clow4bfb9312018-01-20 20:14:321388 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161389 fill_n(OutputIterator first, Size n, const T& value);
1390
1391template <class ForwardIterator, class Generator>
Marshall Clow4bfb9312018-01-20 20:14:321392 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161393 generate(ForwardIterator first, ForwardIterator last, Generator gen);
1394
1395template <class OutputIterator, class Size, class Generator>
Marshall Clow4bfb9312018-01-20 20:14:321396 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161397 generate_n(OutputIterator first, Size n, Generator gen);
1398
1399template <class ForwardIterator, class T>
Marshall Clowe8ea8292018-01-22 21:43:041400 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161401 remove(ForwardIterator first, ForwardIterator last, const T& value);
1402
1403template <class ForwardIterator, class Predicate>
Marshall Clowe8ea8292018-01-22 21:43:041404 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161405 remove_if(ForwardIterator first, ForwardIterator last, Predicate pred);
1406
1407template <class InputIterator, class OutputIterator, class T>
Marshall Clowe8ea8292018-01-22 21:43:041408 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161409 remove_copy(InputIterator first, InputIterator last, OutputIterator result, const T& value);
1410
1411template <class InputIterator, class OutputIterator, class Predicate>
Marshall Clowe8ea8292018-01-22 21:43:041412 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161413 remove_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred);
1414
1415template <class ForwardIterator>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181416 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161417 unique(ForwardIterator first, ForwardIterator last);
1418
1419template <class ForwardIterator, class BinaryPredicate>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181420 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161421 unique(ForwardIterator first, ForwardIterator last, BinaryPredicate pred);
1422
1423template <class InputIterator, class OutputIterator>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181424 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161425 unique_copy(InputIterator first, InputIterator last, OutputIterator result);
1426
1427template <class InputIterator, class OutputIterator, class BinaryPredicate>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181428 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161429 unique_copy(InputIterator first, InputIterator last, OutputIterator result, BinaryPredicate pred);
1430
1431template <class BidirectionalIterator>
Arthur O'Dwyerf851db32020-12-17 05:01:081432 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161433 reverse(BidirectionalIterator first, BidirectionalIterator last);
1434
1435template <class BidirectionalIterator, class OutputIterator>
Marshall Clowe8ea8292018-01-22 21:43:041436 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161437 reverse_copy(BidirectionalIterator first, BidirectionalIterator last, OutputIterator result);
1438
1439template <class ForwardIterator>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181440 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161441 rotate(ForwardIterator first, ForwardIterator middle, ForwardIterator last);
1442
1443template <class ForwardIterator, class OutputIterator>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181444 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161445 rotate_copy(ForwardIterator first, ForwardIterator middle, ForwardIterator last, OutputIterator result);
1446
1447template <class RandomAccessIterator>
1448 void
Marshall Clow0f37a412017-03-23 13:43:371449 random_shuffle(RandomAccessIterator first, RandomAccessIterator last); // deprecated in C++14, removed in C++17
Howard Hinnant3e519522010-05-11 19:42:161450
1451template <class RandomAccessIterator, class RandomNumberGenerator>
1452 void
Marshall Clow06965c12014-03-03 06:14:191453 random_shuffle(RandomAccessIterator first, RandomAccessIterator last,
Marshall Clow0f37a412017-03-23 13:43:371454 RandomNumberGenerator& rand); // deprecated in C++14, removed in C++17
Howard Hinnant3e519522010-05-11 19:42:161455
Eric Fiseliere7154702016-08-28 22:14:371456template<class PopulationIterator, class SampleIterator,
1457 class Distance, class UniformRandomBitGenerator>
1458 SampleIterator sample(PopulationIterator first, PopulationIterator last,
1459 SampleIterator out, Distance n,
1460 UniformRandomBitGenerator&& g); // C++17
1461
Howard Hinnantf9d540b2010-05-26 17:49:341462template<class RandomAccessIterator, class UniformRandomNumberGenerator>
1463 void shuffle(RandomAccessIterator first, RandomAccessIterator last,
Howard Hinnantfb340102010-11-18 01:47:021464 UniformRandomNumberGenerator&& g);
Howard Hinnantf9d540b2010-05-26 17:49:341465
Arthur O'Dwyer3fbd3ea2020-12-26 06:39:031466template<class ForwardIterator>
1467 constexpr ForwardIterator
1468 shift_left(ForwardIterator first, ForwardIterator last,
1469 typename iterator_traits<ForwardIterator>::difference_type n); // C++20
1470
1471template<class ForwardIterator>
1472 constexpr ForwardIterator
1473 shift_right(ForwardIterator first, ForwardIterator last,
1474 typename iterator_traits<ForwardIterator>::difference_type n); // C++20
1475
Howard Hinnant3e519522010-05-11 19:42:161476template <class InputIterator, class Predicate>
Marshall Clow49c76432018-01-15 16:16:321477 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161478 is_partitioned(InputIterator first, InputIterator last, Predicate pred);
1479
1480template <class ForwardIterator, class Predicate>
Arthur O'Dwyerf851db32020-12-17 05:01:081481 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161482 partition(ForwardIterator first, ForwardIterator last, Predicate pred);
1483
1484template <class InputIterator, class OutputIterator1,
1485 class OutputIterator2, class Predicate>
Marshall Clow1b9a4ff2018-01-22 20:44:331486 constexpr pair<OutputIterator1, OutputIterator2> // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161487 partition_copy(InputIterator first, InputIterator last,
1488 OutputIterator1 out_true, OutputIterator2 out_false,
1489 Predicate pred);
1490
1491template <class ForwardIterator, class Predicate>
1492 ForwardIterator
1493 stable_partition(ForwardIterator first, ForwardIterator last, Predicate pred);
1494
1495template<class ForwardIterator, class Predicate>
Marshall Clowd57c03d2018-01-16 02:34:411496 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161497 partition_point(ForwardIterator first, ForwardIterator last, Predicate pred);
1498
1499template <class ForwardIterator>
Marshall Clow49c76432018-01-15 16:16:321500 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161501 is_sorted(ForwardIterator first, ForwardIterator last);
1502
1503template <class ForwardIterator, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181504 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161505 is_sorted(ForwardIterator first, ForwardIterator last, Compare comp);
1506
1507template<class ForwardIterator>
Marshall Clow056f15e2018-01-15 19:40:341508 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161509 is_sorted_until(ForwardIterator first, ForwardIterator last);
1510
1511template <class ForwardIterator, class Compare>
Marshall Clow056f15e2018-01-15 19:40:341512 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161513 is_sorted_until(ForwardIterator first, ForwardIterator last, Compare comp);
1514
1515template <class RandomAccessIterator>
Arthur O'Dwyer493f1402020-12-20 20:21:421516 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161517 sort(RandomAccessIterator first, RandomAccessIterator last);
1518
1519template <class RandomAccessIterator, class Compare>
Arthur O'Dwyer493f1402020-12-20 20:21:421520 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161521 sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1522
1523template <class RandomAccessIterator>
1524 void
1525 stable_sort(RandomAccessIterator first, RandomAccessIterator last);
1526
1527template <class RandomAccessIterator, class Compare>
1528 void
1529 stable_sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1530
1531template <class RandomAccessIterator>
Arthur O'Dwyer5386aa22020-12-17 05:26:181532 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161533 partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last);
1534
1535template <class RandomAccessIterator, class Compare>
Arthur O'Dwyer5386aa22020-12-17 05:26:181536 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161537 partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last, Compare comp);
1538
1539template <class InputIterator, class RandomAccessIterator>
Arthur O'Dwyer5386aa22020-12-17 05:26:181540 constexpr RandomAccessIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161541 partial_sort_copy(InputIterator first, InputIterator last,
1542 RandomAccessIterator result_first, RandomAccessIterator result_last);
1543
1544template <class InputIterator, class RandomAccessIterator, class Compare>
Arthur O'Dwyer5386aa22020-12-17 05:26:181545 constexpr RandomAccessIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161546 partial_sort_copy(InputIterator first, InputIterator last,
1547 RandomAccessIterator result_first, RandomAccessIterator result_last, Compare comp);
1548
1549template <class RandomAccessIterator>
Arthur O'Dwyer5d956562021-02-04 23:12:521550 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161551 nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last);
1552
1553template <class RandomAccessIterator, class Compare>
Arthur O'Dwyer5d956562021-02-04 23:12:521554 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161555 nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last, Compare comp);
1556
1557template <class ForwardIterator, class T>
Marshall Clowd57c03d2018-01-16 02:34:411558 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161559 lower_bound(ForwardIterator first, ForwardIterator last, const T& value);
1560
1561template <class ForwardIterator, class T, class Compare>
Marshall Clowd57c03d2018-01-16 02:34:411562 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161563 lower_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
1564
1565template <class ForwardIterator, class T>
Marshall Clowd57c03d2018-01-16 02:34:411566 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161567 upper_bound(ForwardIterator first, ForwardIterator last, const T& value);
1568
1569template <class ForwardIterator, class T, class Compare>
Marshall Clowd57c03d2018-01-16 02:34:411570 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161571 upper_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
1572
1573template <class ForwardIterator, class T>
Marshall Clowd57c03d2018-01-16 02:34:411574 constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161575 equal_range(ForwardIterator first, ForwardIterator last, const T& value);
1576
1577template <class ForwardIterator, class T, class Compare>
Marshall Clowd57c03d2018-01-16 02:34:411578 constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161579 equal_range(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
1580
1581template <class ForwardIterator, class T>
Marshall Clowd57c03d2018-01-16 02:34:411582 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161583 binary_search(ForwardIterator first, ForwardIterator last, const T& value);
1584
1585template <class ForwardIterator, class T, class Compare>
Marshall Clow8da1a482018-01-22 23:10:401586 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161587 binary_search(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
1588
1589template <class InputIterator1, class InputIterator2, class OutputIterator>
Arthur O'Dwyer14098cf2020-12-04 18:47:121590 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161591 merge(InputIterator1 first1, InputIterator1 last1,
1592 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1593
1594template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
Arthur O'Dwyer14098cf2020-12-04 18:47:121595 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161596 merge(InputIterator1 first1, InputIterator1 last1,
1597 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1598
1599template <class BidirectionalIterator>
1600 void
1601 inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last);
1602
1603template <class BidirectionalIterator, class Compare>
1604 void
1605 inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last, Compare comp);
1606
1607template <class InputIterator1, class InputIterator2>
Marshall Clow8da1a482018-01-22 23:10:401608 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161609 includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2);
1610
1611template <class InputIterator1, class InputIterator2, class Compare>
Marshall Clow8da1a482018-01-22 23:10:401612 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161613 includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, Compare comp);
1614
1615template <class InputIterator1, class InputIterator2, class OutputIterator>
Arthur O'Dwyer14098cf2020-12-04 18:47:121616 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161617 set_union(InputIterator1 first1, InputIterator1 last1,
1618 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1619
1620template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
Arthur O'Dwyer14098cf2020-12-04 18:47:121621 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161622 set_union(InputIterator1 first1, InputIterator1 last1,
1623 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1624
1625template <class InputIterator1, class InputIterator2, class OutputIterator>
Marshall Clow8da1a482018-01-22 23:10:401626 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161627 set_intersection(InputIterator1 first1, InputIterator1 last1,
1628 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1629
1630template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
Marshall Clow8da1a482018-01-22 23:10:401631 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161632 set_intersection(InputIterator1 first1, InputIterator1 last1,
1633 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1634
1635template <class InputIterator1, class InputIterator2, class OutputIterator>
Arthur O'Dwyer14098cf2020-12-04 18:47:121636 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161637 set_difference(InputIterator1 first1, InputIterator1 last1,
1638 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1639
1640template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
Arthur O'Dwyer14098cf2020-12-04 18:47:121641 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161642 set_difference(InputIterator1 first1, InputIterator1 last1,
1643 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1644
1645template <class InputIterator1, class InputIterator2, class OutputIterator>
Arthur O'Dwyer14098cf2020-12-04 18:47:121646 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161647 set_symmetric_difference(InputIterator1 first1, InputIterator1 last1,
1648 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1649
1650template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
Arthur O'Dwyer14098cf2020-12-04 18:47:121651 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161652 set_symmetric_difference(InputIterator1 first1, InputIterator1 last1,
1653 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1654
1655template <class RandomAccessIterator>
Arthur O'Dwyer5386aa22020-12-17 05:26:181656 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161657 push_heap(RandomAccessIterator first, RandomAccessIterator last);
1658
1659template <class RandomAccessIterator, class Compare>
Arthur O'Dwyer5386aa22020-12-17 05:26:181660 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161661 push_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1662
1663template <class RandomAccessIterator>
Arthur O'Dwyer5386aa22020-12-17 05:26:181664 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161665 pop_heap(RandomAccessIterator first, RandomAccessIterator last);
1666
1667template <class RandomAccessIterator, class Compare>
Arthur O'Dwyer5386aa22020-12-17 05:26:181668 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161669 pop_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1670
1671template <class RandomAccessIterator>
Arthur O'Dwyer5386aa22020-12-17 05:26:181672 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161673 make_heap(RandomAccessIterator first, RandomAccessIterator last);
1674
1675template <class RandomAccessIterator, class Compare>
Arthur O'Dwyer5386aa22020-12-17 05:26:181676 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161677 make_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1678
1679template <class RandomAccessIterator>
Arthur O'Dwyer5386aa22020-12-17 05:26:181680 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161681 sort_heap(RandomAccessIterator first, RandomAccessIterator last);
1682
1683template <class RandomAccessIterator, class Compare>
Arthur O'Dwyer5386aa22020-12-17 05:26:181684 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161685 sort_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1686
Howard Hinnantb3371f62010-08-22 00:02:431687template <class RandomAccessIterator>
Marshall Clow49c76432018-01-15 16:16:321688 constexpr bool // constexpr in C++20
Howard Hinnantb3371f62010-08-22 00:02:431689 is_heap(RandomAccessIterator first, RandomAccessiterator last);
Howard Hinnant3e519522010-05-11 19:42:161690
Howard Hinnantb3371f62010-08-22 00:02:431691template <class RandomAccessIterator, class Compare>
Marshall Clow49c76432018-01-15 16:16:321692 constexpr bool // constexpr in C++20
Howard Hinnantb3371f62010-08-22 00:02:431693 is_heap(RandomAccessIterator first, RandomAccessiterator last, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161694
Howard Hinnantb3371f62010-08-22 00:02:431695template <class RandomAccessIterator>
Marshall Clow49c76432018-01-15 16:16:321696 constexpr RandomAccessIterator // constexpr in C++20
Howard Hinnantb3371f62010-08-22 00:02:431697 is_heap_until(RandomAccessIterator first, RandomAccessiterator last);
Howard Hinnant3e519522010-05-11 19:42:161698
Howard Hinnantb3371f62010-08-22 00:02:431699template <class RandomAccessIterator, class Compare>
Marshall Clow49c76432018-01-15 16:16:321700 constexpr RandomAccessIterator // constexpr in C++20
Howard Hinnantb3371f62010-08-22 00:02:431701 is_heap_until(RandomAccessIterator first, RandomAccessiterator last, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161702
Howard Hinnant4eb27b72010-08-21 20:10:011703template <class ForwardIterator>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181704 constexpr ForwardIterator // constexpr in C++14
1705 min_element(ForwardIterator first, ForwardIterator last);
Howard Hinnant4eb27b72010-08-21 20:10:011706
1707template <class ForwardIterator, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181708 constexpr ForwardIterator // constexpr in C++14
1709 min_element(ForwardIterator first, ForwardIterator last, Compare comp);
Howard Hinnant4eb27b72010-08-21 20:10:011710
Howard Hinnant3e519522010-05-11 19:42:161711template <class T>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181712 constexpr const T& // constexpr in C++14
1713 min(const T& a, const T& b);
Howard Hinnant3e519522010-05-11 19:42:161714
1715template <class T, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181716 constexpr const T& // constexpr in C++14
1717 min(const T& a, const T& b, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161718
Howard Hinnant4eb27b72010-08-21 20:10:011719template<class T>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181720 constexpr T // constexpr in C++14
1721 min(initializer_list<T> t);
Howard Hinnant4eb27b72010-08-21 20:10:011722
1723template<class T, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181724 constexpr T // constexpr in C++14
1725 min(initializer_list<T> t, Compare comp);
Howard Hinnant4eb27b72010-08-21 20:10:011726
Marshall Clow146c14a2016-03-07 22:43:491727template<class T>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181728 constexpr const T& clamp(const T& v, const T& lo, const T& hi); // C++17
Marshall Clow146c14a2016-03-07 22:43:491729
1730template<class T, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181731 constexpr const T& clamp(const T& v, const T& lo, const T& hi, Compare comp); // C++17
Marshall Clow146c14a2016-03-07 22:43:491732
Howard Hinnant4eb27b72010-08-21 20:10:011733template <class ForwardIterator>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181734 constexpr ForwardIterator // constexpr in C++14
1735 max_element(ForwardIterator first, ForwardIterator last);
Howard Hinnant4eb27b72010-08-21 20:10:011736
1737template <class ForwardIterator, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181738 constexpr ForwardIterator // constexpr in C++14
1739 max_element(ForwardIterator first, ForwardIterator last, Compare comp);
Howard Hinnant4eb27b72010-08-21 20:10:011740
Howard Hinnant3e519522010-05-11 19:42:161741template <class T>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181742 constexpr const T& // constexpr in C++14
1743 max(const T& a, const T& b);
Howard Hinnant3e519522010-05-11 19:42:161744
1745template <class T, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181746 constexpr const T& // constexpr in C++14
1747 max(const T& a, const T& b, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161748
Howard Hinnant4eb27b72010-08-21 20:10:011749template<class T>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181750 constexpr T // constexpr in C++14
1751 max(initializer_list<T> t);
Howard Hinnant3e519522010-05-11 19:42:161752
Howard Hinnant4eb27b72010-08-21 20:10:011753template<class T, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181754 constexpr T // constexpr in C++14
1755 max(initializer_list<T> t, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161756
Howard Hinnant4eb27b72010-08-21 20:10:011757template<class ForwardIterator>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181758 constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++14
1759 minmax_element(ForwardIterator first, ForwardIterator last);
Howard Hinnant3e519522010-05-11 19:42:161760
Howard Hinnant4eb27b72010-08-21 20:10:011761template<class ForwardIterator, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181762 constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++14
1763 minmax_element(ForwardIterator first, ForwardIterator last, Compare comp);
Howard Hinnant4eb27b72010-08-21 20:10:011764
1765template<class T>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181766 constexpr pair<const T&, const T&> // constexpr in C++14
1767 minmax(const T& a, const T& b);
Howard Hinnant4eb27b72010-08-21 20:10:011768
1769template<class T, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181770 constexpr pair<const T&, const T&> // constexpr in C++14
1771 minmax(const T& a, const T& b, Compare comp);
Howard Hinnant4eb27b72010-08-21 20:10:011772
1773template<class T>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181774 constexpr pair<T, T> // constexpr in C++14
1775 minmax(initializer_list<T> t);
Howard Hinnant4eb27b72010-08-21 20:10:011776
1777template<class T, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181778 constexpr pair<T, T> // constexpr in C++14
1779 minmax(initializer_list<T> t, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161780
1781template <class InputIterator1, class InputIterator2>
Marshall Clow1b9a4ff2018-01-22 20:44:331782 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161783 lexicographical_compare(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2);
1784
1785template <class InputIterator1, class InputIterator2, class Compare>
Marshall Clow1b9a4ff2018-01-22 20:44:331786 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161787 lexicographical_compare(InputIterator1 first1, InputIterator1 last1,
1788 InputIterator2 first2, InputIterator2 last2, Compare comp);
1789
Adrian Vogelsgesang2a067572022-08-04 22:21:271790template<class InputIterator1, class InputIterator2, class Cmp>
1791 constexpr auto
1792 lexicographical_compare_three_way(InputIterator1 first1, InputIterator1 last1,
1793 InputIterator2 first2, InputIterator2 last2,
1794 Cmp comp)
1795 -> decltype(comp(*b1, *b2)); // since C++20
1796
1797template<class InputIterator1, class InputIterator2>
1798 constexpr auto
1799 lexicographical_compare_three_way(InputIterator1 first1, InputIterator1 last1,
1800 InputIterator2 first2, InputIterator2 last2); // since C++20
1801
Howard Hinnant3e519522010-05-11 19:42:161802template <class BidirectionalIterator>
Arthur O'Dwyerf851db32020-12-17 05:01:081803 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161804 next_permutation(BidirectionalIterator first, BidirectionalIterator last);
1805
1806template <class BidirectionalIterator, class Compare>
Arthur O'Dwyerf851db32020-12-17 05:01:081807 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161808 next_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp);
1809
1810template <class BidirectionalIterator>
Arthur O'Dwyerf851db32020-12-17 05:01:081811 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161812 prev_permutation(BidirectionalIterator first, BidirectionalIterator last);
1813
1814template <class BidirectionalIterator, class Compare>
Arthur O'Dwyerf851db32020-12-17 05:01:081815 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161816 prev_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161817} // std
1818
1819*/
1820
Howard Hinnant3e519522010-05-11 19:42:161821#include <__config>
Howard Hinnant5d1a7012013-08-14 18:00:201822
Louis Dionne134723e2021-06-17 15:30:111823#include <__algorithm/adjacent_find.h>
1824#include <__algorithm/all_of.h>
1825#include <__algorithm/any_of.h>
1826#include <__algorithm/binary_search.h>
Louis Dionne134723e2021-06-17 15:30:111827#include <__algorithm/copy.h>
1828#include <__algorithm/copy_backward.h>
1829#include <__algorithm/copy_if.h>
1830#include <__algorithm/copy_n.h>
1831#include <__algorithm/count.h>
1832#include <__algorithm/count_if.h>
1833#include <__algorithm/equal.h>
1834#include <__algorithm/equal_range.h>
Louis Dionne134723e2021-06-17 15:30:111835#include <__algorithm/fill.h>
Arthur O'Dwyer4d81a462022-01-07 14:45:051836#include <__algorithm/fill_n.h>
Louis Dionne134723e2021-06-17 15:30:111837#include <__algorithm/find.h>
1838#include <__algorithm/find_end.h>
1839#include <__algorithm/find_first_of.h>
1840#include <__algorithm/find_if.h>
1841#include <__algorithm/find_if_not.h>
Louis Dionne134723e2021-06-17 15:30:111842#include <__algorithm/for_each.h>
Louis Dionne134723e2021-06-17 15:30:111843#include <__algorithm/generate.h>
Arthur O'Dwyer4d81a462022-01-07 14:45:051844#include <__algorithm/generate_n.h>
Louis Dionne134723e2021-06-17 15:30:111845#include <__algorithm/includes.h>
1846#include <__algorithm/inplace_merge.h>
1847#include <__algorithm/is_heap.h>
1848#include <__algorithm/is_heap_until.h>
1849#include <__algorithm/is_partitioned.h>
1850#include <__algorithm/is_permutation.h>
1851#include <__algorithm/is_sorted.h>
1852#include <__algorithm/is_sorted_until.h>
Christopher Di Bella6adbc832021-06-05 02:47:471853#include <__algorithm/iter_swap.h>
Louis Dionne134723e2021-06-17 15:30:111854#include <__algorithm/lexicographical_compare.h>
Louis Dionne134723e2021-06-17 15:30:111855#include <__algorithm/lower_bound.h>
1856#include <__algorithm/make_heap.h>
1857#include <__algorithm/max.h>
1858#include <__algorithm/max_element.h>
1859#include <__algorithm/merge.h>
1860#include <__algorithm/min.h>
1861#include <__algorithm/min_element.h>
Louis Dionne134723e2021-06-17 15:30:111862#include <__algorithm/minmax.h>
1863#include <__algorithm/minmax_element.h>
1864#include <__algorithm/mismatch.h>
1865#include <__algorithm/move.h>
1866#include <__algorithm/move_backward.h>
1867#include <__algorithm/next_permutation.h>
1868#include <__algorithm/none_of.h>
1869#include <__algorithm/nth_element.h>
1870#include <__algorithm/partial_sort.h>
1871#include <__algorithm/partial_sort_copy.h>
1872#include <__algorithm/partition.h>
1873#include <__algorithm/partition_copy.h>
1874#include <__algorithm/partition_point.h>
1875#include <__algorithm/pop_heap.h>
1876#include <__algorithm/prev_permutation.h>
Louis Dionne134723e2021-06-17 15:30:111877#include <__algorithm/push_heap.h>
Louis Dionne134723e2021-06-17 15:30:111878#include <__algorithm/remove.h>
1879#include <__algorithm/remove_copy.h>
1880#include <__algorithm/remove_copy_if.h>
1881#include <__algorithm/remove_if.h>
1882#include <__algorithm/replace.h>
1883#include <__algorithm/replace_copy.h>
1884#include <__algorithm/replace_copy_if.h>
1885#include <__algorithm/replace_if.h>
1886#include <__algorithm/reverse.h>
1887#include <__algorithm/reverse_copy.h>
1888#include <__algorithm/rotate.h>
1889#include <__algorithm/rotate_copy.h>
Louis Dionne134723e2021-06-17 15:30:111890#include <__algorithm/search.h>
1891#include <__algorithm/search_n.h>
1892#include <__algorithm/set_difference.h>
1893#include <__algorithm/set_intersection.h>
1894#include <__algorithm/set_symmetric_difference.h>
1895#include <__algorithm/set_union.h>
Louis Dionne134723e2021-06-17 15:30:111896#include <__algorithm/shuffle.h>
Louis Dionne134723e2021-06-17 15:30:111897#include <__algorithm/sort.h>
1898#include <__algorithm/sort_heap.h>
1899#include <__algorithm/stable_partition.h>
1900#include <__algorithm/stable_sort.h>
Christopher Di Bella6adbc832021-06-05 02:47:471901#include <__algorithm/swap_ranges.h>
Louis Dionne134723e2021-06-17 15:30:111902#include <__algorithm/transform.h>
Louis Dionne134723e2021-06-17 15:30:111903#include <__algorithm/unique.h>
Arthur O'Dwyer4d81a462022-01-07 14:45:051904#include <__algorithm/unique_copy.h>
Louis Dionne134723e2021-06-17 15:30:111905#include <__algorithm/upper_bound.h>
Eric Fiselierc1bd9192014-08-10 23:53:081906
Nikolas Klauserd5c654b2024-04-14 13:52:561907#if _LIBCPP_STD_VER >= 17
1908# include <__algorithm/clamp.h>
1909# include <__algorithm/for_each_n.h>
Louis Dionnee406d5e2024-05-27 21:51:121910# include <__algorithm/pstl.h>
Nikolas Klauserd5c654b2024-04-14 13:52:561911# include <__algorithm/sample.h>
1912#endif // _LIBCPP_STD_VER >= 17
1913
1914#if _LIBCPP_STD_VER >= 20
1915# include <__algorithm/in_found_result.h>
1916# include <__algorithm/in_fun_result.h>
1917# include <__algorithm/in_in_out_result.h>
1918# include <__algorithm/in_in_result.h>
1919# include <__algorithm/in_out_out_result.h>
1920# include <__algorithm/in_out_result.h>
1921# include <__algorithm/lexicographical_compare_three_way.h>
1922# include <__algorithm/min_max_result.h>
1923# include <__algorithm/ranges_adjacent_find.h>
1924# include <__algorithm/ranges_all_of.h>
1925# include <__algorithm/ranges_any_of.h>
1926# include <__algorithm/ranges_binary_search.h>
1927# include <__algorithm/ranges_clamp.h>
1928# include <__algorithm/ranges_contains.h>
1929# include <__algorithm/ranges_copy.h>
1930# include <__algorithm/ranges_copy_backward.h>
1931# include <__algorithm/ranges_copy_if.h>
1932# include <__algorithm/ranges_copy_n.h>
1933# include <__algorithm/ranges_count.h>
1934# include <__algorithm/ranges_count_if.h>
1935# include <__algorithm/ranges_equal.h>
1936# include <__algorithm/ranges_equal_range.h>
1937# include <__algorithm/ranges_fill.h>
1938# include <__algorithm/ranges_fill_n.h>
1939# include <__algorithm/ranges_find.h>
1940# include <__algorithm/ranges_find_end.h>
1941# include <__algorithm/ranges_find_first_of.h>
1942# include <__algorithm/ranges_find_if.h>
1943# include <__algorithm/ranges_find_if_not.h>
1944# include <__algorithm/ranges_for_each.h>
1945# include <__algorithm/ranges_for_each_n.h>
1946# include <__algorithm/ranges_generate.h>
1947# include <__algorithm/ranges_generate_n.h>
1948# include <__algorithm/ranges_includes.h>
1949# include <__algorithm/ranges_inplace_merge.h>
1950# include <__algorithm/ranges_is_heap.h>
1951# include <__algorithm/ranges_is_heap_until.h>
1952# include <__algorithm/ranges_is_partitioned.h>
1953# include <__algorithm/ranges_is_permutation.h>
1954# include <__algorithm/ranges_is_sorted.h>
1955# include <__algorithm/ranges_is_sorted_until.h>
1956# include <__algorithm/ranges_lexicographical_compare.h>
1957# include <__algorithm/ranges_lower_bound.h>
1958# include <__algorithm/ranges_make_heap.h>
1959# include <__algorithm/ranges_max.h>
1960# include <__algorithm/ranges_max_element.h>
1961# include <__algorithm/ranges_merge.h>
1962# include <__algorithm/ranges_min.h>
1963# include <__algorithm/ranges_min_element.h>
1964# include <__algorithm/ranges_minmax.h>
1965# include <__algorithm/ranges_minmax_element.h>
1966# include <__algorithm/ranges_mismatch.h>
1967# include <__algorithm/ranges_move.h>
1968# include <__algorithm/ranges_move_backward.h>
1969# include <__algorithm/ranges_next_permutation.h>
1970# include <__algorithm/ranges_none_of.h>
1971# include <__algorithm/ranges_nth_element.h>
1972# include <__algorithm/ranges_partial_sort.h>
1973# include <__algorithm/ranges_partial_sort_copy.h>
1974# include <__algorithm/ranges_partition.h>
1975# include <__algorithm/ranges_partition_copy.h>
1976# include <__algorithm/ranges_partition_point.h>
1977# include <__algorithm/ranges_pop_heap.h>
1978# include <__algorithm/ranges_prev_permutation.h>
1979# include <__algorithm/ranges_push_heap.h>
1980# include <__algorithm/ranges_remove.h>
1981# include <__algorithm/ranges_remove_copy.h>
1982# include <__algorithm/ranges_remove_copy_if.h>
1983# include <__algorithm/ranges_remove_if.h>
1984# include <__algorithm/ranges_replace.h>
1985# include <__algorithm/ranges_replace_copy.h>
1986# include <__algorithm/ranges_replace_copy_if.h>
1987# include <__algorithm/ranges_replace_if.h>
1988# include <__algorithm/ranges_reverse.h>
1989# include <__algorithm/ranges_reverse_copy.h>
1990# include <__algorithm/ranges_rotate.h>
1991# include <__algorithm/ranges_rotate_copy.h>
1992# include <__algorithm/ranges_sample.h>
1993# include <__algorithm/ranges_search.h>
1994# include <__algorithm/ranges_search_n.h>
1995# include <__algorithm/ranges_set_difference.h>
1996# include <__algorithm/ranges_set_intersection.h>
1997# include <__algorithm/ranges_set_symmetric_difference.h>
1998# include <__algorithm/ranges_set_union.h>
1999# include <__algorithm/ranges_shuffle.h>
2000# include <__algorithm/ranges_sort.h>
2001# include <__algorithm/ranges_sort_heap.h>
2002# include <__algorithm/ranges_stable_partition.h>
2003# include <__algorithm/ranges_stable_sort.h>
2004# include <__algorithm/ranges_swap_ranges.h>
2005# include <__algorithm/ranges_transform.h>
2006# include <__algorithm/ranges_unique.h>
2007# include <__algorithm/ranges_unique_copy.h>
2008# include <__algorithm/ranges_upper_bound.h>
2009# include <__algorithm/shift_left.h>
2010# include <__algorithm/shift_right.h>
2011#endif
2012
2013#if _LIBCPP_STD_VER >= 23
2014# include <__algorithm/fold.h>
2015# include <__algorithm/ranges_contains_subrange.h>
2016# include <__algorithm/ranges_ends_with.h>
nicole mazzuca04760bf2024-07-19 16:42:162017# include <__algorithm/ranges_find_last.h>
Nikolas Klauserd5c654b2024-04-14 13:52:562018# include <__algorithm/ranges_starts_with.h>
2019#endif // _LIBCPP_STD_VER >= 23
2020
2021#include <version>
2022
Nikolas Klauserdb1978b2022-06-16 20:43:462023// standard-mandated includes
Nikolas Klauser473a1602022-09-22 16:05:082024
2025// [algorithm.syn]
Nikolas Klauserdb1978b2022-06-16 20:43:462026#include <initializer_list>
2027
Howard Hinnant073458b2011-10-17 20:05:102028#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
Arthur O'Dwyerfa6b9e42022-02-02 01:16:402029# pragma GCC system_header
Howard Hinnant073458b2011-10-17 20:05:102030#endif
Howard Hinnant3e519522010-05-11 19:42:162031
Nikolas Klauserd5c654b2024-04-14 13:52:562032#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER == 14
2033# include <execution>
2034#endif
2035
Mark de Wevere31c2a12022-09-02 15:53:282036#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
Nikolas Klauserd5e26772022-09-04 22:01:152037# include <atomic>
Nikolas Klauser40a20ae2023-01-08 14:26:322038# include <bit>
Nikolas Klauser89b356f2022-11-02 19:27:422039# include <concepts>
Nikolas Klauser75196f82023-01-08 15:47:532040# include <cstdlib>
varconst5629d492023-01-14 00:56:582041# include <cstring>
Mark de Wevere31c2a12022-09-02 15:53:282042# include <iterator>
Nikolas Klauserd5e26772022-09-04 22:01:152043# include <memory>
2044# include <stdexcept>
Nikolas Klausere698c592022-12-26 15:24:012045# include <type_traits>
Mark de Wevere31c2a12022-09-02 15:53:282046# include <utility>
2047#endif
2048
Louis Dionne4cd6ca12021-04-20 16:03:322049#endif // _LIBCPP_ALGORITHM