blob: 8758aed2a04f9e17aeebb5a8c5237e7a8bfd36a1 [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
Louis Dionne09e3a362024-09-16 19:06:20316 template<class I, class F>
317 using for_each_n_result = in_fun_result<I, F>; // since C++20
318
Nikolas Klauser80045e92022-05-04 18:27:07319 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
320 indirectly_unary_invocable<projected<I, Proj>> Fun>
321 constexpr ranges::for_each_result<I, Fun>
322 ranges::for_each(I first, S last, Fun f, Proj proj = {}); // since C++20
323
324 template<input_range R, class Proj = identity,
325 indirectly_unary_invocable<projected<iterator_t<R>, Proj>> Fun>
326 constexpr ranges::for_each_result<borrowed_iterator_t<R>, Fun>
327 ranges::for_each(R&& r, Fun f, Proj proj = {}); // since C++20
328
329 template<input_iterator I, class Proj = identity,
330 indirectly_unary_invocable<projected<I, Proj>> Fun>
331 constexpr ranges::for_each_n_result<I, Fun>
332 ranges::for_each_n(I first, iter_difference_t<I> n, Fun f, Proj proj = {}); // since C++20
Nikolas Klauser37ba1b92022-05-04 12:19:09333
334 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
335 indirect_unary_predicate<projected<I, Proj>> Pred>
336 constexpr bool ranges::is_partitioned(I first, S last, Pred pred, Proj proj = {}); // since C++20
337
338 template<input_range R, class Proj = identity,
339 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
340 constexpr bool ranges::is_partitioned(R&& r, Pred pred, Proj proj = {}); // since C++20
341
Konstantin Varlamovc945bd02022-07-08 20:46:27342 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
343 class Proj = identity>
344 requires sortable<I, Comp, Proj>
345 constexpr I
346 ranges::push_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
347
348 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
349 requires sortable<iterator_t<R>, Comp, Proj>
350 constexpr borrowed_iterator_t<R>
351 ranges::push_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
352
353 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
354 class Proj = identity>
355 requires sortable<I, Comp, Proj>
356 constexpr I
357 ranges::pop_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
358
359 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
360 requires sortable<iterator_t<R>, Comp, Proj>
361 constexpr borrowed_iterator_t<R>
362 ranges::pop_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
363
364 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
365 class Proj = identity>
366 requires sortable<I, Comp, Proj>
367 constexpr I
368 ranges::make_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
369
370 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
371 requires sortable<iterator_t<R>, Comp, Proj>
372 constexpr borrowed_iterator_t<R>
373 ranges::make_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
374
375 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
376 class Proj = identity>
377 requires sortable<I, Comp, Proj>
378 constexpr I
379 ranges::sort_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
380
381 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
382 requires sortable<iterator_t<R>, Comp, Proj>
383 constexpr borrowed_iterator_t<R>
384 ranges::sort_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
385
Konstantin Varlamovd406c642022-07-26 23:11:09386 template<random_access_iterator I, sentinel_for<I> S, class Proj = identity,
387 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
Mark de Weverde6827b2023-02-24 20:35:41388 constexpr bool is_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
Konstantin Varlamovd406c642022-07-26 23:11:09389
390 template<random_access_range R, class Proj = identity,
391 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
Mark de Weverde6827b2023-02-24 20:35:41392 constexpr bool is_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Konstantin Varlamovd406c642022-07-26 23:11:09393
394 template<random_access_iterator I, sentinel_for<I> S, class Proj = identity,
395 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
Mark de Weverde6827b2023-02-24 20:35:41396 constexpr I is_heap_until(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
Konstantin Varlamovd406c642022-07-26 23:11:09397
398 template<random_access_range R, class Proj = identity,
399 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
400 constexpr borrowed_iterator_t<R>
Mark de Weverde6827b2023-02-24 20:35:41401 is_heap_until(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Konstantin Varlamovd406c642022-07-26 23:11:09402
Nikolas Klauser1d1a1912022-05-24 08:32:50403 template<bidirectional_iterator I, sentinel_for<I> S>
404 requires permutable<I>
405 constexpr I ranges::reverse(I first, S last); // since C++20
406
407 template<bidirectional_range R>
408 requires permutable<iterator_t<R>>
409 constexpr borrowed_iterator_t<R> ranges::reverse(R&& r); // since C++20
410
Konstantin Varlamovff3989e2022-06-16 22:20:53411 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
412 class Proj = identity>
413 requires sortable<I, Comp, Proj>
414 constexpr I
Konstantin Varlamov94c7b892022-07-01 23:34:08415 ranges::sort(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
Konstantin Varlamovff3989e2022-06-16 22:20:53416
417 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
418 requires sortable<iterator_t<R>, Comp, Proj>
419 constexpr borrowed_iterator_t<R>
Konstantin Varlamov94c7b892022-07-01 23:34:08420 ranges::sort(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
421
422 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
423 class Proj = identity>
424 requires sortable<I, Comp, Proj>
425 I ranges::stable_sort(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
426
427 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
428 requires sortable<iterator_t<R>, Comp, Proj>
429 borrowed_iterator_t<R>
430 ranges::stable_sort(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Konstantin Varlamovff3989e2022-06-16 22:20:53431
varconst5dd19ad2022-07-20 03:10:02432 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
433 class Proj = identity>
434 requires sortable<I, Comp, Proj>
435 constexpr I
436 ranges::partial_sort(I first, I middle, S last, Comp comp = {}, Proj proj = {}); // since C++20
437
438 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
439 requires sortable<iterator_t<R>, Comp, Proj>
440 constexpr borrowed_iterator_t<R>
441 ranges::partial_sort(R&& r, iterator_t<R> middle, Comp comp = {}, Proj proj = {}); // since C++20
442
Nikolas Klauser7af89a32022-05-21 16:26:29443 template<class T, output_iterator<const T&> O, sentinel_for<O> S>
444 constexpr O ranges::fill(O first, S last, const T& value); // since C++20
445
446 template<class T, output_range<const T&> R>
447 constexpr borrowed_iterator_t<R> ranges::fill(R&& r, const T& value); // since C++20
448
449 template<class T, output_iterator<const T&> O>
450 constexpr O ranges::fill_n(O first, iter_difference_t<O> n, const T& value); // since C++20
Nikolas Klauser569d6632022-05-25 09:09:43451
Konstantin Varlamovead73022022-07-26 22:50:14452 template<input_or_output_iterator O, sentinel_for<O> S, copy_constructible F>
453 requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>>
Mark de Weverde6827b2023-02-24 20:35:41454 constexpr O generate(O first, S last, F gen); // since C++20
Konstantin Varlamovead73022022-07-26 22:50:14455
Nikolas Klausercd916102023-06-09 20:45:34456 template<class ExecutionPolicy, class ForwardIterator, class Generator>
457 void generate(ExecutionPolicy&& exec,
458 ForwardIterator first, ForwardIterator last,
459 Generator gen); // since C++17
460
Konstantin Varlamovead73022022-07-26 22:50:14461 template<class R, copy_constructible F>
462 requires invocable<F&> && output_range<R, invoke_result_t<F&>>
Mark de Weverde6827b2023-02-24 20:35:41463 constexpr borrowed_iterator_t<R> generate(R&& r, F gen); // since C++20
Konstantin Varlamovead73022022-07-26 22:50:14464
465 template<input_or_output_iterator O, copy_constructible F>
466 requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>>
Mark de Weverde6827b2023-02-24 20:35:41467 constexpr O generate_n(O first, iter_difference_t<O> n, F gen); // since C++20
Konstantin Varlamovead73022022-07-26 22:50:14468
Nikolas Klausercd916102023-06-09 20:45:34469 template<class ExecutionPolicy, class ForwardIterator, class Size, class Generator>
470 ForwardIterator generate_n(ExecutionPolicy&& exec,
471 ForwardIterator first, Size n, Generator gen); // since C++17
472
Nikolas Klauser569d6632022-05-25 09:09:43473 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
474 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
475 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
476 constexpr bool ranges::equal(I1 first1, S1 last1, I2 first2, S2 last2,
477 Pred pred = {},
478 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
479
480 template<input_range R1, input_range R2, class Pred = ranges::equal_to,
481 class Proj1 = identity, class Proj2 = identity>
482 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
483 constexpr bool ranges::equal(R1&& r1, R2&& r2, Pred pred = {},
484 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
485
Nikolas Klauser0e3dc1a2022-05-26 14:42:46486 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
487 indirect_unary_predicate<projected<I, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:41488 constexpr bool ranges::all_of(I first, S last, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser0e3dc1a2022-05-26 14:42:46489
490 template<input_range R, class Proj = identity,
491 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:41492 constexpr bool ranges::all_of(R&& r, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser0e3dc1a2022-05-26 14:42:46493
494 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
495 indirect_unary_predicate<projected<I, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:41496 constexpr bool ranges::any_of(I first, S last, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser0e3dc1a2022-05-26 14:42:46497
498 template<input_range R, class Proj = identity,
499 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:41500 constexpr bool ranges::any_of(R&& r, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser0e3dc1a2022-05-26 14:42:46501
Zijun Zhao0218ea42023-09-18 18:28:11502 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
503 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
504 requires (forward_iterator<I1> || sized_sentinel_for<S1, I1>) &&
505 (forward_iterator<I2> || sized_sentinel_for<S2, I2>) &&
506 indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
507 constexpr bool ranges::ends_with(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
508 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23
509
510 template<input_range R1, input_range R2, class Pred = ranges::equal_to, class Proj1 = identity,
511 class Proj2 = identity>
512 requires (forward_range<R1> || sized_range<R1>) &&
513 (forward_range<R2> || sized_range<R2>) &&
514 indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
515 constexpr bool ranges::ends_with(R1&& r1, R2&& r2, Pred pred = {},
516 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23
517
Nikolas Klauser0e3dc1a2022-05-26 14:42:46518 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
519 indirect_unary_predicate<projected<I, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:41520 constexpr bool ranges::none_of(I first, S last, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser0e3dc1a2022-05-26 14:42:46521
522 template<input_range R, class Proj = identity,
523 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:41524 constexpr bool ranges::none_of(R&& r, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser0e3dc1a2022-05-26 14:42:46525
zijunzhao20517552023-05-08 22:04:00526 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
527 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
528 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
529 constexpr bool ranges::starts_with(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
530 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23
531
532 template<input_range R1, input_range R2, class Pred = ranges::equal_to, class Proj1 = identity,
533 class Proj2 = identity>
534 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
535 constexpr bool ranges::starts_with(R1&& r1, R2&& r2, Pred pred = {},
536 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23
537
Konstantin Varlamovdb7d7952022-07-30 09:42:05538 template<input_iterator I1, sentinel_for<I1> S1,
539 random_access_iterator I2, sentinel_for<I2> S2,
540 class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
541 requires indirectly_copyable<I1, I2> && sortable<I2, Comp, Proj2> &&
542 indirect_strict_weak_order<Comp, projected<I1, Proj1>, projected<I2, Proj2>>
543 constexpr partial_sort_copy_result<I1, I2>
544 partial_sort_copy(I1 first, S1 last, I2 result_first, S2 result_last,
Mark de Weverde6827b2023-02-24 20:35:41545 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Konstantin Varlamovdb7d7952022-07-30 09:42:05546
547 template<input_range R1, random_access_range R2, class Comp = ranges::less,
548 class Proj1 = identity, class Proj2 = identity>
549 requires indirectly_copyable<iterator_t<R1>, iterator_t<R2>> &&
550 sortable<iterator_t<R2>, Comp, Proj2> &&
551 indirect_strict_weak_order<Comp, projected<iterator_t<R1>, Proj1>,
552 projected<iterator_t<R2>, Proj2>>
553 constexpr partial_sort_copy_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
554 partial_sort_copy(R1&& r, R2&& result_r, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:41555 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Konstantin Varlamovdb7d7952022-07-30 09:42:05556
Nikolas Klauser11e3ad22022-05-26 14:08:55557 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
558 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
559 constexpr bool ranges::is_sorted(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
560
561 template<forward_range R, class Proj = identity,
562 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
563 constexpr bool ranges::is_sorted(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
564
565 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
566 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
567 constexpr I ranges::is_sorted_until(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
568
569 template<forward_range R, class Proj = identity,
570 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
571 constexpr borrowed_iterator_t<R>
572 ranges::is_sorted_until(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser81715862022-06-05 19:15:16573
Konstantin Varlamov23c73282022-07-08 03:35:51574 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
575 class Proj = identity>
576 requires sortable<I, Comp, Proj>
577 constexpr I
Mark de Weverde6827b2023-02-24 20:35:41578 ranges::nth_element(I first, I nth, S last, Comp comp = {}, Proj proj = {}); // since C++20
Konstantin Varlamov23c73282022-07-08 03:35:51579
580 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
581 requires sortable<iterator_t<R>, Comp, Proj>
582 constexpr borrowed_iterator_t<R>
Mark de Weverde6827b2023-02-24 20:35:41583 ranges::nth_element(R&& r, iterator_t<R> nth, Comp comp = {}, Proj proj = {}); // since C++20
Konstantin Varlamov23c73282022-07-08 03:35:51584
Nikolas Klauser81715862022-06-05 19:15:16585 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
Mark de Weverde6827b2023-02-24 20:35:41586 indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less> // since C++20
587 constexpr I upper_bound(I first, S last, const T& value, Comp comp = {}, Proj proj = {});
Nikolas Klauser81715862022-06-05 19:15:16588
589 template<forward_range R, class T, class Proj = identity,
590 indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
591 ranges::less>
592 constexpr borrowed_iterator_t<R>
Mark de Weverde6827b2023-02-24 20:35:41593 upper_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser81715862022-06-05 19:15:16594
595 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
596 indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
597 constexpr I lower_bound(I first, S last, const T& value, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:41598 Proj proj = {}); // since C++20
Nikolas Klauser81715862022-06-05 19:15:16599 template<forward_range R, class T, class Proj = identity,
600 indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
601 ranges::less>
602 constexpr borrowed_iterator_t<R>
Mark de Weverde6827b2023-02-24 20:35:41603 lower_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser81715862022-06-05 19:15:16604
605 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
606 indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
607 constexpr bool binary_search(I first, S last, const T& value, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:41608 Proj proj = {}); // since C++20
Nikolas Klauserb79b2b62022-06-06 11:57:34609
Nikolas Klauser81715862022-06-05 19:15:16610 template<forward_range R, class T, class Proj = identity,
611 indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
612 ranges::less>
613 constexpr bool binary_search(R&& r, const T& value, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:41614 Proj proj = {}); // since C++20
Konstantin Varlamov8ed702b2022-07-19 04:05:51615
616 template<permutable I, sentinel_for<I> S, class Proj = identity,
617 indirect_unary_predicate<projected<I, Proj>> Pred>
618 constexpr subrange<I>
Mark de Weverde6827b2023-02-24 20:35:41619 partition(I first, S last, Pred pred, Proj proj = {}); // since C++20
Konstantin Varlamov8ed702b2022-07-19 04:05:51620
621 template<forward_range R, class Proj = identity,
622 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
623 requires permutable<iterator_t<R>>
624 constexpr borrowed_subrange_t<R>
Mark de Weverde6827b2023-02-24 20:35:41625 partition(R&& r, Pred pred, Proj proj = {}); // since C++20
Konstantin Varlamov8ed702b2022-07-19 04:05:51626
627 template<bidirectional_iterator I, sentinel_for<I> S, class Proj = identity,
628 indirect_unary_predicate<projected<I, Proj>> Pred>
629 requires permutable<I>
A. Jiangc28c5082025-03-06 01:23:55630 constexpr subrange<I> // constexpr since C++26
631 stable_partition(I first, S last, Pred pred, Proj proj = {}); // since C++20
Konstantin Varlamov8ed702b2022-07-19 04:05:51632
633 template<bidirectional_range R, class Proj = identity,
634 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
635 requires permutable<iterator_t<R>>
A. Jiangc28c5082025-03-06 01:23:55636 constexpr borrowed_subrange_t<R> // constexpr since C++26
637 stable_partition(R&& r, Pred pred, Proj proj = {}); // since C++20
Konstantin Varlamov8ed702b2022-07-19 04:05:51638
Nikolas Klauserb79b2b62022-06-06 11:57:34639 template<input_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2,
640 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
641 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
642 constexpr I1 ranges::find_first_of(I1 first1, S1 last1, I2 first2, S2 last2,
643 Pred pred = {},
644 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
645
646 template<input_range R1, forward_range R2,
647 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
648 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
649 constexpr borrowed_iterator_t<R1>
650 ranges::find_first_of(R1&& r1, R2&& r2,
651 Pred pred = {},
652 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauser81715862022-06-05 19:15:16653
Nikolas Klauser916e9052022-06-08 10:14:12654 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
655 indirect_binary_predicate<projected<I, Proj>,
656 projected<I, Proj>> Pred = ranges::equal_to>
Mark de Weverde6827b2023-02-24 20:35:41657 constexpr I ranges::adjacent_find(I first, S last, Pred pred = {}, Proj proj = {}); // since C++20
Nikolas Klauser916e9052022-06-08 10:14:12658
659 template<forward_range R, class Proj = identity,
660 indirect_binary_predicate<projected<iterator_t<R>, Proj>,
661 projected<iterator_t<R>, Proj>> Pred = ranges::equal_to>
662 constexpr borrowed_iterator_t<R> ranges::adjacent_find(R&& r, Pred pred = {}, Proj proj = {}); // since C++20
663
Nikolas Klauserff6d5de2022-06-07 07:42:10664 template<input_iterator I, sentinel_for<I> S, class T1, class T2, class Proj = identity>
665 requires indirectly_writable<I, const T2&> &&
666 indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*>
667 constexpr I
668 ranges::replace(I first, S last, const T1& old_value, const T2& new_value, Proj proj = {}); // since C++20
669
670 template<input_range R, class T1, class T2, class Proj = identity>
671 requires indirectly_writable<iterator_t<R>, const T2&> &&
672 indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T1*>
673 constexpr borrowed_iterator_t<R>
674 ranges::replace(R&& r, const T1& old_value, const T2& new_value, Proj proj = {}); // since C++20
675
676 template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity,
677 indirect_unary_predicate<projected<I, Proj>> Pred>
678 requires indirectly_writable<I, const T&>
679 constexpr I ranges::replace_if(I first, S last, Pred pred, const T& new_value, Proj proj = {}); // since C++20
680
681 template<input_range R, class T, class Proj = identity,
682 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
683 requires indirectly_writable<iterator_t<R>, const T&>
684 constexpr borrowed_iterator_t<R>
685 ranges::replace_if(R&& r, Pred pred, const T& new_value, Proj proj = {}); // since C++20
686
Nikolas Klausera203acb2022-08-03 23:30:50687 template<class T, class Proj = identity,
688 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
689 constexpr const T&
690 ranges::clamp(const T& v, const T& lo, const T& hi, Comp comp = {}, Proj proj = {}); // since C++20
691
Nikolas Klauserafd5a4f2022-06-15 14:24:43692 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
693 class Proj1 = identity, class Proj2 = identity,
694 indirect_strict_weak_order<projected<I1, Proj1>,
695 projected<I2, Proj2>> Comp = ranges::less>
696 constexpr bool
697 ranges::lexicographical_compare(I1 first1, S1 last1, I2 first2, S2 last2,
Mark de Weverde6827b2023-02-24 20:35:41698 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauserafd5a4f2022-06-15 14:24:43699
700 template<input_range R1, input_range R2, class Proj1 = identity,
701 class Proj2 = identity,
702 indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>,
703 projected<iterator_t<R2>, Proj2>> Comp = ranges::less>
704 constexpr bool
705 ranges::lexicographical_compare(R1&& r1, R2&& r2, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:41706 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauserafd5a4f2022-06-15 14:24:43707
Louis Dionne09e3a362024-09-16 19:06:20708 template<class I, class O>
709 using move_result = in_out_result<I, O>; // since C++20
710
711 template<class I, class O>
712 using move_backward_result = in_out_result<I, O>; // since C++20
713
Nikolas Klauser2c3bbac2022-06-23 10:23:41714 template<bidirectional_iterator I1, sentinel_for<I1> S1, bidirectional_iterator I2>
715 requires indirectly_movable<I1, I2>
716 constexpr ranges::move_backward_result<I1, I2>
717 ranges::move_backward(I1 first, S1 last, I2 result); // since C++20
718
719 template<bidirectional_range R, bidirectional_iterator I>
720 requires indirectly_movable<iterator_t<R>, I>
721 constexpr ranges::move_backward_result<borrowed_iterator_t<R>, I>
722 ranges::move_backward(R&& r, I result); // since C++20
723
724 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O>
725 requires indirectly_movable<I, O>
726 constexpr ranges::move_result<I, O>
727 ranges::move(I first, S last, O result); // since C++20
728
729 template<input_range R, weakly_incrementable O>
730 requires indirectly_movable<iterator_t<R>, O>
731 constexpr ranges::move_result<borrowed_iterator_t<R>, O>
732 ranges::move(R&& r, O result); // since C++20
733
Konstantin Varlamov065202f2022-07-20 08:57:13734 template<class I, class O1, class O2>
735 using partition_copy_result = in_out_out_result<I, O1, O2>; // since C++20
736
737 template<input_iterator I, sentinel_for<I> S,
738 weakly_incrementable O1, weakly_incrementable O2,
739 class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
740 requires indirectly_copyable<I, O1> && indirectly_copyable<I, O2>
741 constexpr partition_copy_result<I, O1, O2>
742 partition_copy(I first, S last, O1 out_true, O2 out_false, Pred pred,
Mark de Weverde6827b2023-02-24 20:35:41743 Proj proj = {}); // since C++20
Konstantin Varlamov065202f2022-07-20 08:57:13744
745 template<input_range R, weakly_incrementable O1, weakly_incrementable O2,
746 class Proj = identity,
747 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
748 requires indirectly_copyable<iterator_t<R>, O1> &&
749 indirectly_copyable<iterator_t<R>, O2>
750 constexpr partition_copy_result<borrowed_iterator_t<R>, O1, O2>
Mark de Weverde6827b2023-02-24 20:35:41751 partition_copy(R&& r, O1 out_true, O2 out_false, Pred pred, Proj proj = {}); // since C++20
Konstantin Varlamov065202f2022-07-20 08:57:13752
753 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
754 indirect_unary_predicate<projected<I, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:41755 constexpr I partition_point(I first, S last, Pred pred, Proj proj = {}); // since C++20
Konstantin Varlamov065202f2022-07-20 08:57:13756
757 template<forward_range R, class Proj = identity,
758 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
759 constexpr borrowed_iterator_t<R>
Mark de Weverde6827b2023-02-24 20:35:41760 partition_point(R&& r, Pred pred, Proj proj = {}); // since C++20
Konstantin Varlamov065202f2022-07-20 08:57:13761
Hui Xie25607d12022-06-26 15:13:43762 template<class I1, class I2, class O>
763 using merge_result = in_in_out_result<I1, I2, O>; // since C++20
764
765 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
766 weakly_incrementable O, class Comp = ranges::less, class Proj1 = identity,
767 class Proj2 = identity>
768 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
769 constexpr merge_result<I1, I2, O>
770 merge(I1 first1, S1 last1, I2 first2, S2 last2, O result,
771 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
772
773 template<input_range R1, input_range R2, weakly_incrementable O, class Comp = ranges::less,
774 class Proj1 = identity, class Proj2 = identity>
775 requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
776 constexpr merge_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
777 merge(R1&& r1, R2&& r2, O result,
778 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauser2c3bbac2022-06-23 10:23:41779
Nikolas Klauserf8cbe3cdf2022-07-06 12:03:00780 template<permutable I, sentinel_for<I> S, class T, class Proj = identity>
781 requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
782 constexpr subrange<I> ranges::remove(I first, S last, const T& value, Proj proj = {}); // since C++20
783
784 template<forward_range R, class T, class Proj = identity>
785 requires permutable<iterator_t<R>> &&
786 indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
787 constexpr borrowed_subrange_t<R>
788 ranges::remove(R&& r, const T& value, Proj proj = {}); // since C++20
789
790 template<permutable I, sentinel_for<I> S, class Proj = identity,
791 indirect_unary_predicate<projected<I, Proj>> Pred>
792 constexpr subrange<I> ranges::remove_if(I first, S last, Pred pred, Proj proj = {}); // since C++20
793
794 template<forward_range R, class Proj = identity,
795 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
796 requires permutable<iterator_t<R>>
797 constexpr borrowed_subrange_t<R>
798 ranges::remove_if(R&& r, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser7d426a32022-07-11 15:07:35799
Hui Xie1cdec6c2022-06-26 15:13:43800 template<class I, class O>
Nikolas Klauser7d426a32022-07-11 15:07:35801 using set_difference_result = in_out_result<I, O>; // since C++20
Hui Xie1cdec6c2022-06-26 15:13:43802
803 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
804 weakly_incrementable O, class Comp = ranges::less,
805 class Proj1 = identity, class Proj2 = identity>
806 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
807 constexpr set_difference_result<I1, O>
808 set_difference(I1 first1, S1 last1, I2 first2, S2 last2, O result,
809 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
810
811 template<input_range R1, input_range R2, weakly_incrementable O,
812 class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
813 requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
814 constexpr set_difference_result<borrowed_iterator_t<R1>, O>
815 set_difference(R1&& r1, R2&& r2, O result,
816 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauserf8cbe3cdf2022-07-06 12:03:00817
Hui Xie96b674f2022-07-08 14:21:40818 template<class I1, class I2, class O>
819 using set_intersection_result = in_in_out_result<I1, I2, O>; // since C++20
820
821 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
822 weakly_incrementable O, class Comp = ranges::less,
823 class Proj1 = identity, class Proj2 = identity>
824 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
825 constexpr set_intersection_result<I1, I2, O>
826 set_intersection(I1 first1, S1 last1, I2 first2, S2 last2, O result,
827 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
828
829 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
830 weakly_incrementable O, class Comp = ranges::less,
831 class Proj1 = identity, class Proj2 = identity>
832 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
833 constexpr set_intersection_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
834 set_intersection(R1&& r1, R2&& r2, O result,
835 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
836
Nikolas Klauser7d426a32022-07-11 15:07:35837 template <class _InIter, class _OutIter>
838 using reverse_copy_result = in_out_result<_InIter, _OutIter>; // since C++20
839
840 template<bidirectional_iterator I, sentinel_for<I> S, weakly_incrementable O>
841 requires indirectly_copyable<I, O>
842 constexpr ranges::reverse_copy_result<I, O>
843 ranges::reverse_copy(I first, S last, O result); // since C++20
844
845 template<bidirectional_range R, weakly_incrementable O>
846 requires indirectly_copyable<iterator_t<R>, O>
847 constexpr ranges::reverse_copy_result<borrowed_iterator_t<R>, O>
848 ranges::reverse_copy(R&& r, O result); // since C++20
849
Konstantin Varlamov36c746c2022-08-03 23:04:14850 template<permutable I, sentinel_for<I> S>
851 constexpr subrange<I> rotate(I first, I middle, S last); // since C++20
852
853 template<forward_range R>
854 requires permutable<iterator_t<R>>
Mark de Weverde6827b2023-02-24 20:35:41855 constexpr borrowed_subrange_t<R> rotate(R&& r, iterator_t<R> middle); // since C++20
Konstantin Varlamov36c746c2022-08-03 23:04:14856
Nikolas Klauser7d426a32022-07-11 15:07:35857 template <class _InIter, class _OutIter>
858 using rotate_copy_result = in_out_result<_InIter, _OutIter>; // since C++20
859
860 template<forward_iterator I, sentinel_for<I> S, weakly_incrementable O>
861 requires indirectly_copyable<I, O>
862 constexpr ranges::rotate_copy_result<I, O>
863 ranges::rotate_copy(I first, I middle, S last, O result); // since C++20
864
865 template<forward_range R, weakly_incrementable O>
866 requires indirectly_copyable<iterator_t<R>, O>
867 constexpr ranges::rotate_copy_result<borrowed_iterator_t<R>, O>
868 ranges::rotate_copy(R&& r, iterator_t<R> middle, O result); // since C++20
869
Konstantin Varlamov6bdb6422022-08-03 05:33:12870 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Gen>
871 requires (forward_iterator<I> || random_access_iterator<O>) &&
872 indirectly_copyable<I, O> &&
873 uniform_random_bit_generator<remove_reference_t<Gen>>
Mark de Weverde6827b2023-02-24 20:35:41874 O sample(I first, S last, O out, iter_difference_t<I> n, Gen&& g); // since C++20
Konstantin Varlamov6bdb6422022-08-03 05:33:12875
876 template<input_range R, weakly_incrementable O, class Gen>
877 requires (forward_range<R> || random_access_iterator<O>) &&
878 indirectly_copyable<iterator_t<R>, O> &&
879 uniform_random_bit_generator<remove_reference_t<Gen>>
Mark de Weverde6827b2023-02-24 20:35:41880 O sample(R&& r, O out, range_difference_t<R> n, Gen&& g); // since C++20
Konstantin Varlamov6bdb6422022-08-03 05:33:12881
Konstantin Varlamov14cf74d2022-07-22 16:58:56882 template<random_access_iterator I, sentinel_for<I> S, class Gen>
883 requires permutable<I> &&
884 uniform_random_bit_generator<remove_reference_t<Gen>>
Mark de Weverde6827b2023-02-24 20:35:41885 I shuffle(I first, S last, Gen&& g); // since C++20
Konstantin Varlamov14cf74d2022-07-22 16:58:56886
887 template<random_access_range R, class Gen>
888 requires permutable<iterator_t<R>> &&
889 uniform_random_bit_generator<remove_reference_t<Gen>>
Mark de Weverde6827b2023-02-24 20:35:41890 borrowed_iterator_t<R> shuffle(R&& r, Gen&& g); // since C++20
Konstantin Varlamov14cf74d2022-07-22 16:58:56891
Nikolas Klauser101d1e92022-07-13 16:07:26892 template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2,
Nikolas Klauser4038c852022-08-04 17:54:13893 sentinel_for<I2> S2, class Proj1 = identity, class Proj2 = identity,
894 indirect_equivalence_relation<projected<I1, Proj1>,
895 projected<I2, Proj2>> Pred = ranges::equal_to>
896 constexpr bool ranges::is_permutation(I1 first1, S1 last1, I2 first2, S2 last2,
897 Pred pred = {},
Mark de Weverde6827b2023-02-24 20:35:41898 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauser4038c852022-08-04 17:54:13899
900 template<forward_range R1, forward_range R2,
901 class Proj1 = identity, class Proj2 = identity,
902 indirect_equivalence_relation<projected<iterator_t<R1>, Proj1>,
903 projected<iterator_t<R2>, Proj2>> Pred = ranges::equal_to>
904 constexpr bool ranges::is_permutation(R1&& r1, R2&& r2, Pred pred = {},
Mark de Weverde6827b2023-02-24 20:35:41905 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauser4038c852022-08-04 17:54:13906
907 template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2,
Nikolas Klauser101d1e92022-07-13 16:07:26908 sentinel_for<I2> S2, class Pred = ranges::equal_to,
909 class Proj1 = identity, class Proj2 = identity>
910 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
911 constexpr subrange<I1>
912 ranges::search(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
913 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
914
915 template<forward_range R1, forward_range R2, class Pred = ranges::equal_to,
916 class Proj1 = identity, class Proj2 = identity>
917 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
918 constexpr borrowed_subrange_t<R1>
919 ranges::search(R1&& r1, R2&& r2, Pred pred = {},
920 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
921
922 template<forward_iterator I, sentinel_for<I> S, class T,
923 class Pred = ranges::equal_to, class Proj = identity>
924 requires indirectly_comparable<I, const T*, Pred, Proj>
925 constexpr subrange<I>
926 ranges::search_n(I first, S last, iter_difference_t<I> count,
927 const T& value, Pred pred = {}, Proj proj = {}); // since C++20
928
929 template<forward_range R, class T, class Pred = ranges::equal_to,
930 class Proj = identity>
931 requires indirectly_comparable<iterator_t<R>, const T*, Pred, Proj>
932 constexpr borrowed_subrange_t<R>
933 ranges::search_n(R&& r, range_difference_t<R> count,
934 const T& value, Pred pred = {}, Proj proj = {}); // since C++20
935
Christopher Di Bella39034382023-12-20 05:57:50936 template<input_iterator I, sentinel_for<I> S, class T,
937 indirectly-binary-left-foldable<T, I> F>
938 constexpr auto ranges::fold_left(I first, S last, T init, F f); // since C++23
939
940 template<input_range R, class T, indirectly-binary-left-foldable<T, iterator_t<R>> F>
941 constexpr auto fold_left(R&& r, T init, F f); // since C++23
942
943 template<class I, class T>
944 using fold_left_with_iter_result = in_value_result<I, T>; // since C++23
945
946 template<input_iterator I, sentinel_for<I> S, class T,
947 indirectly-binary-left-foldable<T, I> F>
948 constexpr see below fold_left_with_iter(I first, S last, T init, F f); // since C++23
949
950 template<input_range R, class T, indirectly-binary-left-foldable<T, iterator_t<R>> F>
951 constexpr see below fold_left_with_iter(R&& r, T init, F f); // since C++23
952
Nikolas Klauser101d1e92022-07-13 16:07:26953 template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2,
954 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
955 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
956 constexpr subrange<I1>
957 ranges::find_end(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
958 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
959
960 template<forward_range R1, forward_range R2,
961 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
962 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
963 constexpr borrowed_subrange_t<R1>
964 ranges::find_end(R1&& r1, R2&& r2, Pred pred = {},
965 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
966
Hui Xiea5c06382022-07-11 22:39:59967 template<class I1, class I2, class O>
968 using set_symmetric_difference_result = in_in_out_result<I1, I2, O>; // since C++20
969
970 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
971 weakly_incrementable O, class Comp = ranges::less,
972 class Proj1 = identity, class Proj2 = identity>
973 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
974 constexpr set_symmetric_difference_result<I1, I2, O>
975 set_symmetric_difference(I1 first1, S1 last1, I2 first2, S2 last2, O result,
976 Comp comp = {}, Proj1 proj1 = {},
977 Proj2 proj2 = {}); // since C++20
Hui Xie8a617492022-07-27 12:20:16978
Hui Xiea5c06382022-07-11 22:39:59979 template<input_range R1, input_range R2, weakly_incrementable O,
980 class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
981 requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
982 constexpr set_symmetric_difference_result<borrowed_iterator_t<R1>,
983 borrowed_iterator_t<R2>, O>
984 set_symmetric_difference(R1&& r1, R2&& r2, O result, Comp comp = {},
985 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Hui Xie0f6364b82022-07-14 19:35:15986
987 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
988 indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
989 constexpr subrange<I>
990 equal_range(I first, S last, const T& value, Comp comp = {}, Proj proj = {}); // since C++20
Hui Xie8a617492022-07-27 12:20:16991
Hui Xie0f6364b82022-07-14 19:35:15992 template<forward_range R, class T, class Proj = identity,
993 indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
994 ranges::less>
995 constexpr borrowed_subrange_t<R>
996 equal_range(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20
Hui Xie8a617492022-07-27 12:20:16997
Hui Xie3151b952022-07-13 16:20:22998 template<class I1, class I2, class O>
999 using set_union_result = in_in_out_result<I1, I2, O>; // since C++20
1000
1001 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
1002 weakly_incrementable O, class Comp = ranges::less,
1003 class Proj1 = identity, class Proj2 = identity>
1004 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
1005 constexpr set_union_result<I1, I2, O>
1006 set_union(I1 first1, S1 last1, I2 first2, S2 last2, O result, Comp comp = {},
1007 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
1008
1009 template<input_range R1, input_range R2, weakly_incrementable O,
1010 class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
1011 requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
1012 constexpr set_union_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
1013 set_union(R1&& r1, R2&& r2, O result, Comp comp = {},
1014 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Hui Xiec5599642022-07-19 19:54:351015
1016 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
1017 class Proj1 = identity, class Proj2 = identity,
1018 indirect_strict_weak_order<projected<I1, Proj1>, projected<I2, Proj2>> Comp =
1019 ranges::less>
1020 constexpr bool includes(I1 first1, S1 last1, I2 first2, S2 last2, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:411021 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Hui Xie8a617492022-07-27 12:20:161022
Hui Xiec5599642022-07-19 19:54:351023 template<input_range R1, input_range R2, class Proj1 = identity,
1024 class Proj2 = identity,
1025 indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>,
1026 projected<iterator_t<R2>, Proj2>> Comp = ranges::less>
1027 constexpr bool includes(R1&& r1, R2&& r2, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:411028 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Hui Xie8a617492022-07-27 12:20:161029
1030 template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
1031 class Proj = identity>
1032 requires sortable<I, Comp, Proj>
Mark de Weverde6827b2023-02-24 20:35:411033 I inplace_merge(I first, I middle, S last, Comp comp = {}, Proj proj = {}); // since C++20
Hui Xie8a617492022-07-27 12:20:161034
1035 template<bidirectional_range R, class Comp = ranges::less, class Proj = identity>
1036 requires sortable<iterator_t<R>, Comp, Proj>
1037 borrowed_iterator_t<R>
1038 inplace_merge(R&& r, iterator_t<R> middle, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:411039 Proj proj = {}); // since C++20
Hui Xie72f57e32022-07-23 00:44:251040
1041 template<permutable I, sentinel_for<I> S, class Proj = identity,
1042 indirect_equivalence_relation<projected<I, Proj>> C = ranges::equal_to>
Mark de Weverde6827b2023-02-24 20:35:411043 constexpr subrange<I> unique(I first, S last, C comp = {}, Proj proj = {}); // since C++20
Hui Xie72f57e32022-07-23 00:44:251044
1045 template<forward_range R, class Proj = identity,
1046 indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to>
1047 requires permutable<iterator_t<R>>
1048 constexpr borrowed_subrange_t<R>
Mark de Weverde6827b2023-02-24 20:35:411049 unique(R&& r, C comp = {}, Proj proj = {}); // since C++20
Hui Xie72f57e32022-07-23 00:44:251050
1051 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Proj = identity,
1052 indirect_equivalence_relation<projected<I, Proj>> C = ranges::equal_to>
1053 requires indirectly_copyable<I, O> &&
1054 (forward_iterator<I> ||
1055 (input_iterator<O> && same_as<iter_value_t<I>, iter_value_t<O>>) ||
1056 indirectly_copyable_storable<I, O>)
1057 constexpr unique_copy_result<I, O>
Mark de Weverde6827b2023-02-24 20:35:411058 unique_copy(I first, S last, O result, C comp = {}, Proj proj = {}); // since C++20
Hui Xie72f57e32022-07-23 00:44:251059
1060 template<input_range R, weakly_incrementable O, class Proj = identity,
1061 indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to>
1062 requires indirectly_copyable<iterator_t<R>, O> &&
1063 (forward_iterator<iterator_t<R>> ||
1064 (input_iterator<O> && same_as<range_value_t<R>, iter_value_t<O>>) ||
1065 indirectly_copyable_storable<iterator_t<R>, O>)
1066 constexpr unique_copy_result<borrowed_iterator_t<R>, O>
Mark de Weverde6827b2023-02-24 20:35:411067 unique_copy(R&& r, O result, C comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591068
1069 template<class I, class O>
Mark de Weverde6827b2023-02-24 20:35:411070 using remove_copy_result = in_out_result<I, O>; // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591071
1072 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class T,
1073 class Proj = identity>
1074 indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
1075 constexpr remove_copy_result<I, O>
Mark de Weverde6827b2023-02-24 20:35:411076 remove_copy(I first, S last, O result, const T& value, Proj proj = {}); // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591077
1078 template<input_range R, weakly_incrementable O, class T, class Proj = identity>
1079 requires indirectly_copyable<iterator_t<R>, O> &&
1080 indirect_binary_predicate<ranges::equal_to,
1081 projected<iterator_t<R>, Proj>, const T*>
1082 constexpr remove_copy_result<borrowed_iterator_t<R>, O>
Mark de Weverde6827b2023-02-24 20:35:411083 remove_copy(R&& r, O result, const T& value, Proj proj = {}); // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591084
1085 template<class I, class O>
Mark de Weverde6827b2023-02-24 20:35:411086 using remove_copy_if_result = in_out_result<I, O>; // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591087
1088 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O,
1089 class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
1090 requires indirectly_copyable<I, O>
1091 constexpr remove_copy_if_result<I, O>
Mark de Weverde6827b2023-02-24 20:35:411092 remove_copy_if(I first, S last, O result, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591093
1094 template<input_range R, weakly_incrementable O, class Proj = identity,
1095 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
1096 requires indirectly_copyable<iterator_t<R>, O>
1097 constexpr remove_copy_if_result<borrowed_iterator_t<R>, O>
Mark de Weverde6827b2023-02-24 20:35:411098 remove_copy_if(R&& r, O result, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591099
Nikolas Klauser93172c12022-08-03 05:25:001100 template<class I, class O>
Mark de Weverde6827b2023-02-24 20:35:411101 using replace_copy_result = in_out_result<I, O>; // since C++20
Nikolas Klauser93172c12022-08-03 05:25:001102
1103 template<input_iterator I, sentinel_for<I> S, class T1, class T2,
1104 output_iterator<const T2&> O, class Proj = identity>
1105 requires indirectly_copyable<I, O> &&
1106 indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*>
1107 constexpr replace_copy_result<I, O>
1108 replace_copy(I first, S last, O result, const T1& old_value, const T2& new_value,
Mark de Weverde6827b2023-02-24 20:35:411109 Proj proj = {}); // since C++20
Nikolas Klauser93172c12022-08-03 05:25:001110
1111 template<input_range R, class T1, class T2, output_iterator<const T2&> O,
1112 class Proj = identity>
1113 requires indirectly_copyable<iterator_t<R>, O> &&
1114 indirect_binary_predicate<ranges::equal_to,
1115 projected<iterator_t<R>, Proj>, const T1*>
1116 constexpr replace_copy_result<borrowed_iterator_t<R>, O>
1117 replace_copy(R&& r, O result, const T1& old_value, const T2& new_value,
Mark de Weverde6827b2023-02-24 20:35:411118 Proj proj = {}); // since C++20
Nikolas Klauser93172c12022-08-03 05:25:001119
1120 template<class I, class O>
Mark de Weverde6827b2023-02-24 20:35:411121 using replace_copy_if_result = in_out_result<I, O>; // since C++20
Nikolas Klauser93172c12022-08-03 05:25:001122
1123 template<input_iterator I, sentinel_for<I> S, class T, output_iterator<const T&> O,
1124 class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
1125 requires indirectly_copyable<I, O>
1126 constexpr replace_copy_if_result<I, O>
1127 replace_copy_if(I first, S last, O result, Pred pred, const T& new_value,
Mark de Weverde6827b2023-02-24 20:35:411128 Proj proj = {}); // since C++20
Nikolas Klauser93172c12022-08-03 05:25:001129
1130 template<input_range R, class T, output_iterator<const T&> O, class Proj = identity,
1131 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
1132 requires indirectly_copyable<iterator_t<R>, O>
1133 constexpr replace_copy_if_result<borrowed_iterator_t<R>, O>
1134 replace_copy_if(R&& r, O result, Pred pred, const T& new_value,
Mark de Weverde6827b2023-02-24 20:35:411135 Proj proj = {}); // since C++20
Nikolas Klauser93172c12022-08-03 05:25:001136
Nikolas Klauser68264b62022-08-03 05:40:131137 template<class I>
Mark de Weverde6827b2023-02-24 20:35:411138 using prev_permutation_result = in_found_result<I>; // since C++20
Nikolas Klauser68264b62022-08-03 05:40:131139
1140 template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
1141 class Proj = identity>
1142 requires sortable<I, Comp, Proj>
1143 constexpr ranges::prev_permutation_result<I>
Mark de Weverde6827b2023-02-24 20:35:411144 ranges::prev_permutation(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser68264b62022-08-03 05:40:131145
1146 template<bidirectional_range R, class Comp = ranges::less,
1147 class Proj = identity>
1148 requires sortable<iterator_t<R>, Comp, Proj>
1149 constexpr ranges::prev_permutation_result<borrowed_iterator_t<R>>
Mark de Weverde6827b2023-02-24 20:35:411150 ranges::prev_permutation(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser68264b62022-08-03 05:40:131151
1152 template<class I>
Mark de Weverde6827b2023-02-24 20:35:411153 using next_permutation_result = in_found_result<I>; // since C++20
Nikolas Klauser68264b62022-08-03 05:40:131154
1155 template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
1156 class Proj = identity>
1157 requires sortable<I, Comp, Proj>
1158 constexpr ranges::next_permutation_result<I>
Mark de Weverde6827b2023-02-24 20:35:411159 ranges::next_permutation(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser68264b62022-08-03 05:40:131160
1161 template<bidirectional_range R, class Comp = ranges::less,
1162 class Proj = identity>
1163 requires sortable<iterator_t<R>, Comp, Proj>
1164 constexpr ranges::next_permutation_result<borrowed_iterator_t<R>>
Mark de Weverde6827b2023-02-24 20:35:411165 ranges::next_permutation(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser68264b62022-08-03 05:40:131166
Nikolas Klauserd3729bb2022-01-14 01:55:511167}
1168
Nikolas Klauser68264b62022-08-03 05:40:131169template <class InputIterator, class Predicate>
Marshall Clow706ffef2018-01-15 17:20:361170 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161171 all_of(InputIterator first, InputIterator last, Predicate pred);
1172
1173template <class InputIterator, class Predicate>
Marshall Clow706ffef2018-01-15 17:20:361174 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161175 any_of(InputIterator first, InputIterator last, Predicate pred);
1176
1177template <class InputIterator, class Predicate>
Marshall Clow706ffef2018-01-15 17:20:361178 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161179 none_of(InputIterator first, InputIterator last, Predicate pred);
1180
1181template <class InputIterator, class Function>
Marshall Clow1b9a4ff2018-01-22 20:44:331182 constexpr Function // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161183 for_each(InputIterator first, InputIterator last, Function f);
1184
Marshall Clowd5c65ff2017-05-25 02:29:541185template<class InputIterator, class Size, class Function>
Marshall Clow1b9a4ff2018-01-22 20:44:331186 constexpr InputIterator // constexpr in C++20
1187 for_each_n(InputIterator first, Size n, Function f); // C++17
Marshall Clowd5c65ff2017-05-25 02:29:541188
Howard Hinnant3e519522010-05-11 19:42:161189template <class InputIterator, class T>
Marshall Clow86944282018-01-15 19:26:051190 constexpr InputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161191 find(InputIterator first, InputIterator last, const T& value);
1192
1193template <class InputIterator, class Predicate>
Marshall Clow86944282018-01-15 19:26:051194 constexpr InputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161195 find_if(InputIterator first, InputIterator last, Predicate pred);
1196
1197template<class InputIterator, class Predicate>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181198 constexpr InputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161199 find_if_not(InputIterator first, InputIterator last, Predicate pred);
1200
1201template <class ForwardIterator1, class ForwardIterator2>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181202 constexpr ForwardIterator1 // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161203 find_end(ForwardIterator1 first1, ForwardIterator1 last1,
1204 ForwardIterator2 first2, ForwardIterator2 last2);
1205
1206template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181207 constexpr ForwardIterator1 // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161208 find_end(ForwardIterator1 first1, ForwardIterator1 last1,
1209 ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
1210
1211template <class ForwardIterator1, class ForwardIterator2>
Marshall Clow86944282018-01-15 19:26:051212 constexpr ForwardIterator1 // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161213 find_first_of(ForwardIterator1 first1, ForwardIterator1 last1,
1214 ForwardIterator2 first2, ForwardIterator2 last2);
1215
1216template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
Marshall Clow86944282018-01-15 19:26:051217 constexpr ForwardIterator1 // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161218 find_first_of(ForwardIterator1 first1, ForwardIterator1 last1,
1219 ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
1220
1221template <class ForwardIterator>
Marshall Clow86944282018-01-15 19:26:051222 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161223 adjacent_find(ForwardIterator first, ForwardIterator last);
1224
1225template <class ForwardIterator, class BinaryPredicate>
Marshall Clow86944282018-01-15 19:26:051226 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161227 adjacent_find(ForwardIterator first, ForwardIterator last, BinaryPredicate pred);
1228
1229template <class InputIterator, class T>
Marshall Clow056f15e2018-01-15 19:40:341230 constexpr typename iterator_traits<InputIterator>::difference_type // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161231 count(InputIterator first, InputIterator last, const T& value);
1232
1233template <class InputIterator, class Predicate>
Marshall Clow056f15e2018-01-15 19:40:341234 constexpr typename iterator_traits<InputIterator>::difference_type // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161235 count_if(InputIterator first, InputIterator last, Predicate pred);
1236
1237template <class InputIterator1, class InputIterator2>
Marshall Clow6538e28d2018-01-16 02:04:101238 constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161239 mismatch(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2);
1240
Marshall Clow0b0bbd22013-05-09 21:14:231241template <class InputIterator1, class InputIterator2>
Louis Dionne5366bf52024-10-01 16:59:361242 constexpr pair<InputIterator1, InputIterator2>
Aditya Kumar331fb802016-08-25 11:52:381243 mismatch(InputIterator1 first1, InputIterator1 last1,
Louis Dionne5366bf52024-10-01 16:59:361244 InputIterator2 first2, InputIterator2 last2); // since C++14, constexpr in C++20
Marshall Clow0b0bbd22013-05-09 21:14:231245
Howard Hinnant3e519522010-05-11 19:42:161246template <class InputIterator1, class InputIterator2, class BinaryPredicate>
Marshall Clow6538e28d2018-01-16 02:04:101247 constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161248 mismatch(InputIterator1 first1, InputIterator1 last1,
1249 InputIterator2 first2, BinaryPredicate pred);
1250
Marshall Clow0b0bbd22013-05-09 21:14:231251template <class InputIterator1, class InputIterator2, class BinaryPredicate>
Louis Dionne5366bf52024-10-01 16:59:361252 constexpr pair<InputIterator1, InputIterator2>
Marshall Clow0b0bbd22013-05-09 21:14:231253 mismatch(InputIterator1 first1, InputIterator1 last1,
1254 InputIterator2 first2, InputIterator2 last2,
Louis Dionne5366bf52024-10-01 16:59:361255 BinaryPredicate pred); // since C++14, constexpr in C++20
Marshall Clow0b0bbd22013-05-09 21:14:231256
Howard Hinnant3e519522010-05-11 19:42:161257template <class InputIterator1, class InputIterator2>
Marshall Clow6538e28d2018-01-16 02:04:101258 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161259 equal(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2);
1260
Marshall Clow0b0bbd22013-05-09 21:14:231261template <class InputIterator1, class InputIterator2>
Louis Dionne5366bf52024-10-01 16:59:361262 constexpr bool
Aditya Kumar331fb802016-08-25 11:52:381263 equal(InputIterator1 first1, InputIterator1 last1,
Louis Dionne5366bf52024-10-01 16:59:361264 InputIterator2 first2, InputIterator2 last2); // since C++14, constexpr in C++20
Marshall Clow0b0bbd22013-05-09 21:14:231265
Howard Hinnant3e519522010-05-11 19:42:161266template <class InputIterator1, class InputIterator2, class BinaryPredicate>
Marshall Clow6538e28d2018-01-16 02:04:101267 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161268 equal(InputIterator1 first1, InputIterator1 last1,
1269 InputIterator2 first2, BinaryPredicate pred);
1270
Marshall Clow0b0bbd22013-05-09 21:14:231271template <class InputIterator1, class InputIterator2, class BinaryPredicate>
Louis Dionne5366bf52024-10-01 16:59:361272 constexpr bool
Marshall Clow0b0bbd22013-05-09 21:14:231273 equal(InputIterator1 first1, InputIterator1 last1,
1274 InputIterator2 first2, InputIterator2 last2,
Louis Dionne5366bf52024-10-01 16:59:361275 BinaryPredicate pred); // since C++14, constexpr in C++20
Marshall Clow0b0bbd22013-05-09 21:14:231276
Howard Hinnant3e519522010-05-11 19:42:161277template<class ForwardIterator1, class ForwardIterator2>
Marshall Clow49c76432018-01-15 16:16:321278 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161279 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
1280 ForwardIterator2 first2);
1281
Marshall Clow0b0bbd22013-05-09 21:14:231282template<class ForwardIterator1, class ForwardIterator2>
Louis Dionne5366bf52024-10-01 16:59:361283 constexpr bool
Marshall Clow0b0bbd22013-05-09 21:14:231284 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
Louis Dionne5366bf52024-10-01 16:59:361285 ForwardIterator2 first2, ForwardIterator2 last2); // since C++14, constexpr in C++20
Marshall Clow0b0bbd22013-05-09 21:14:231286
Howard Hinnant3e519522010-05-11 19:42:161287template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
Marshall Clow49c76432018-01-15 16:16:321288 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161289 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
1290 ForwardIterator2 first2, BinaryPredicate pred);
1291
Marshall Clow0b0bbd22013-05-09 21:14:231292template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
Louis Dionne5366bf52024-10-01 16:59:361293 constexpr bool
Marshall Clow0b0bbd22013-05-09 21:14:231294 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
1295 ForwardIterator2 first2, ForwardIterator2 last2,
Louis Dionne5366bf52024-10-01 16:59:361296 BinaryPredicate pred); // since C++14, constexpr in C++20
Marshall Clow0b0bbd22013-05-09 21:14:231297
Howard Hinnant3e519522010-05-11 19:42:161298template <class ForwardIterator1, class ForwardIterator2>
Marshall Clow12f0a772018-01-16 15:48:271299 constexpr ForwardIterator1 // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161300 search(ForwardIterator1 first1, ForwardIterator1 last1,
1301 ForwardIterator2 first2, ForwardIterator2 last2);
1302
1303template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
Marshall Clow12f0a772018-01-16 15:48:271304 constexpr ForwardIterator1 // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161305 search(ForwardIterator1 first1, ForwardIterator1 last1,
1306 ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
1307
1308template <class ForwardIterator, class Size, class T>
Marshall Clow12f0a772018-01-16 15:48:271309 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161310 search_n(ForwardIterator first, ForwardIterator last, Size count, const T& value);
1311
1312template <class ForwardIterator, class Size, class T, class BinaryPredicate>
Marshall Clow12f0a772018-01-16 15:48:271313 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161314 search_n(ForwardIterator first, ForwardIterator last,
1315 Size count, const T& value, BinaryPredicate pred);
1316
1317template <class InputIterator, class OutputIterator>
Louis Dionne13c90a52019-11-06 12:02:411318 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161319 copy(InputIterator first, InputIterator last, OutputIterator result);
1320
1321template<class InputIterator, class OutputIterator, class Predicate>
Louis Dionne13c90a52019-11-06 12:02:411322 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161323 copy_if(InputIterator first, InputIterator last,
1324 OutputIterator result, Predicate pred);
1325
1326template<class InputIterator, class Size, class OutputIterator>
Louis Dionne13c90a52019-11-06 12:02:411327 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161328 copy_n(InputIterator first, Size n, OutputIterator result);
1329
1330template <class BidirectionalIterator1, class BidirectionalIterator2>
Louis Dionne13c90a52019-11-06 12:02:411331 constexpr BidirectionalIterator2 // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161332 copy_backward(BidirectionalIterator1 first, BidirectionalIterator1 last,
1333 BidirectionalIterator2 result);
1334
Konstantin Varlamov79a2b4b2022-06-28 18:59:591335// [alg.move], move
1336template<class InputIterator, class OutputIterator>
1337 constexpr OutputIterator move(InputIterator first, InputIterator last,
1338 OutputIterator result);
1339
1340template<class BidirectionalIterator1, class BidirectionalIterator2>
1341 constexpr BidirectionalIterator2
1342 move_backward(BidirectionalIterator1 first, BidirectionalIterator1 last,
1343 BidirectionalIterator2 result);
1344
Howard Hinnant3e519522010-05-11 19:42:161345template <class ForwardIterator1, class ForwardIterator2>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181346 constexpr ForwardIterator2 // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161347 swap_ranges(ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2);
1348
Konstantin Varlamov79a2b4b2022-06-28 18:59:591349namespace ranges {
1350 template<class I1, class I2>
1351 using swap_ranges_result = in_in_result<I1, I2>;
1352
Nikolas Klauser9d905312022-02-10 12:33:031353template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2>
1354 requires indirectly_swappable<I1, I2>
1355 constexpr ranges::swap_ranges_result<I1, I2>
Konstantin Varlamov79a2b4b2022-06-28 18:59:591356 swap_ranges(I1 first1, S1 last1, I2 first2, S2 last2);
Nikolas Klauser9d905312022-02-10 12:33:031357
1358template<input_range R1, input_range R2>
1359 requires indirectly_swappable<iterator_t<R1>, iterator_t<R2>>
1360 constexpr ranges::swap_ranges_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
Konstantin Varlamov79a2b4b2022-06-28 18:59:591361 swap_ranges(R1&& r1, R2&& r2);
1362}
Nikolas Klauser9d905312022-02-10 12:33:031363
Howard Hinnant3e519522010-05-11 19:42:161364template <class ForwardIterator1, class ForwardIterator2>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181365 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161366 iter_swap(ForwardIterator1 a, ForwardIterator2 b);
1367
1368template <class InputIterator, class OutputIterator, class UnaryOperation>
Marshall Clow99894b62018-01-19 17:45:391369 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161370 transform(InputIterator first, InputIterator last, OutputIterator result, UnaryOperation op);
1371
1372template <class InputIterator1, class InputIterator2, class OutputIterator, class BinaryOperation>
Marshall Clow99894b62018-01-19 17:45:391373 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161374 transform(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2,
1375 OutputIterator result, BinaryOperation binary_op);
1376
1377template <class ForwardIterator, class T>
Marshall Clow12c74232018-01-19 18:07:291378 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161379 replace(ForwardIterator first, ForwardIterator last, const T& old_value, const T& new_value);
1380
1381template <class ForwardIterator, class Predicate, class T>
Marshall Clow12c74232018-01-19 18:07:291382 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161383 replace_if(ForwardIterator first, ForwardIterator last, Predicate pred, const T& new_value);
1384
1385template <class InputIterator, class OutputIterator, class T>
Marshall Clow12c74232018-01-19 18:07:291386 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161387 replace_copy(InputIterator first, InputIterator last, OutputIterator result,
1388 const T& old_value, const T& new_value);
1389
1390template <class InputIterator, class OutputIterator, class Predicate, class T>
Marshall Clow12c74232018-01-19 18:07:291391 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161392 replace_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred, const T& new_value);
1393
1394template <class ForwardIterator, class T>
Marshall Clow4bfb9312018-01-20 20:14:321395 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161396 fill(ForwardIterator first, ForwardIterator last, const T& value);
1397
1398template <class OutputIterator, class Size, class T>
Marshall Clow4bfb9312018-01-20 20:14:321399 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161400 fill_n(OutputIterator first, Size n, const T& value);
1401
1402template <class ForwardIterator, class Generator>
Marshall Clow4bfb9312018-01-20 20:14:321403 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161404 generate(ForwardIterator first, ForwardIterator last, Generator gen);
1405
1406template <class OutputIterator, class Size, class Generator>
Marshall Clow4bfb9312018-01-20 20:14:321407 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161408 generate_n(OutputIterator first, Size n, Generator gen);
1409
1410template <class ForwardIterator, class T>
Marshall Clowe8ea8292018-01-22 21:43:041411 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161412 remove(ForwardIterator first, ForwardIterator last, const T& value);
1413
1414template <class ForwardIterator, class Predicate>
Marshall Clowe8ea8292018-01-22 21:43:041415 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161416 remove_if(ForwardIterator first, ForwardIterator last, Predicate pred);
1417
1418template <class InputIterator, class OutputIterator, class T>
Marshall Clowe8ea8292018-01-22 21:43:041419 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161420 remove_copy(InputIterator first, InputIterator last, OutputIterator result, const T& value);
1421
1422template <class InputIterator, class OutputIterator, class Predicate>
Marshall Clowe8ea8292018-01-22 21:43:041423 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161424 remove_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred);
1425
1426template <class ForwardIterator>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181427 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161428 unique(ForwardIterator first, ForwardIterator last);
1429
1430template <class ForwardIterator, class BinaryPredicate>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181431 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161432 unique(ForwardIterator first, ForwardIterator last, BinaryPredicate pred);
1433
1434template <class InputIterator, class OutputIterator>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181435 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161436 unique_copy(InputIterator first, InputIterator last, OutputIterator result);
1437
1438template <class InputIterator, class OutputIterator, class BinaryPredicate>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181439 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161440 unique_copy(InputIterator first, InputIterator last, OutputIterator result, BinaryPredicate pred);
1441
1442template <class BidirectionalIterator>
Arthur O'Dwyerf851db32020-12-17 05:01:081443 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161444 reverse(BidirectionalIterator first, BidirectionalIterator last);
1445
1446template <class BidirectionalIterator, class OutputIterator>
Marshall Clowe8ea8292018-01-22 21:43:041447 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161448 reverse_copy(BidirectionalIterator first, BidirectionalIterator last, OutputIterator result);
1449
1450template <class ForwardIterator>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181451 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161452 rotate(ForwardIterator first, ForwardIterator middle, ForwardIterator last);
1453
1454template <class ForwardIterator, class OutputIterator>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181455 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161456 rotate_copy(ForwardIterator first, ForwardIterator middle, ForwardIterator last, OutputIterator result);
1457
1458template <class RandomAccessIterator>
1459 void
Marshall Clow0f37a412017-03-23 13:43:371460 random_shuffle(RandomAccessIterator first, RandomAccessIterator last); // deprecated in C++14, removed in C++17
Howard Hinnant3e519522010-05-11 19:42:161461
1462template <class RandomAccessIterator, class RandomNumberGenerator>
1463 void
Marshall Clow06965c12014-03-03 06:14:191464 random_shuffle(RandomAccessIterator first, RandomAccessIterator last,
Marshall Clow0f37a412017-03-23 13:43:371465 RandomNumberGenerator& rand); // deprecated in C++14, removed in C++17
Howard Hinnant3e519522010-05-11 19:42:161466
Eric Fiseliere7154702016-08-28 22:14:371467template<class PopulationIterator, class SampleIterator,
1468 class Distance, class UniformRandomBitGenerator>
1469 SampleIterator sample(PopulationIterator first, PopulationIterator last,
1470 SampleIterator out, Distance n,
1471 UniformRandomBitGenerator&& g); // C++17
1472
Howard Hinnantf9d540b2010-05-26 17:49:341473template<class RandomAccessIterator, class UniformRandomNumberGenerator>
1474 void shuffle(RandomAccessIterator first, RandomAccessIterator last,
Howard Hinnantfb340102010-11-18 01:47:021475 UniformRandomNumberGenerator&& g);
Howard Hinnantf9d540b2010-05-26 17:49:341476
Arthur O'Dwyer3fbd3ea2020-12-26 06:39:031477template<class ForwardIterator>
1478 constexpr ForwardIterator
1479 shift_left(ForwardIterator first, ForwardIterator last,
1480 typename iterator_traits<ForwardIterator>::difference_type n); // C++20
1481
1482template<class ForwardIterator>
1483 constexpr ForwardIterator
1484 shift_right(ForwardIterator first, ForwardIterator last,
1485 typename iterator_traits<ForwardIterator>::difference_type n); // C++20
1486
Howard Hinnant3e519522010-05-11 19:42:161487template <class InputIterator, class Predicate>
Marshall Clow49c76432018-01-15 16:16:321488 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161489 is_partitioned(InputIterator first, InputIterator last, Predicate pred);
1490
1491template <class ForwardIterator, class Predicate>
Arthur O'Dwyerf851db32020-12-17 05:01:081492 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161493 partition(ForwardIterator first, ForwardIterator last, Predicate pred);
1494
1495template <class InputIterator, class OutputIterator1,
1496 class OutputIterator2, class Predicate>
Marshall Clow1b9a4ff2018-01-22 20:44:331497 constexpr pair<OutputIterator1, OutputIterator2> // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161498 partition_copy(InputIterator first, InputIterator last,
1499 OutputIterator1 out_true, OutputIterator2 out_false,
1500 Predicate pred);
1501
1502template <class ForwardIterator, class Predicate>
A. Jiangbf9bf292025-03-04 01:23:291503 constexpr ForwardIterator // constexpr in C++26
Howard Hinnant3e519522010-05-11 19:42:161504 stable_partition(ForwardIterator first, ForwardIterator last, Predicate pred);
1505
1506template<class ForwardIterator, class Predicate>
Marshall Clowd57c03d2018-01-16 02:34:411507 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161508 partition_point(ForwardIterator first, ForwardIterator last, Predicate pred);
1509
1510template <class ForwardIterator>
Marshall Clow49c76432018-01-15 16:16:321511 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161512 is_sorted(ForwardIterator first, ForwardIterator last);
1513
1514template <class ForwardIterator, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181515 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161516 is_sorted(ForwardIterator first, ForwardIterator last, Compare comp);
1517
1518template<class ForwardIterator>
Marshall Clow056f15e2018-01-15 19:40:341519 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161520 is_sorted_until(ForwardIterator first, ForwardIterator last);
1521
1522template <class ForwardIterator, class Compare>
Marshall Clow056f15e2018-01-15 19:40:341523 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161524 is_sorted_until(ForwardIterator first, ForwardIterator last, Compare comp);
1525
1526template <class RandomAccessIterator>
Arthur O'Dwyer493f1402020-12-20 20:21:421527 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161528 sort(RandomAccessIterator first, RandomAccessIterator last);
1529
1530template <class RandomAccessIterator, class Compare>
Arthur O'Dwyer493f1402020-12-20 20:21:421531 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161532 sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1533
1534template <class RandomAccessIterator>
PaulXiCao438e2cc2025-01-14 15:24:351535 constexpr void // constexpr in C++26
Howard Hinnant3e519522010-05-11 19:42:161536 stable_sort(RandomAccessIterator first, RandomAccessIterator last);
1537
1538template <class RandomAccessIterator, class Compare>
PaulXiCao438e2cc2025-01-14 15:24:351539 constexpr void // constexpr in C++26
Howard Hinnant3e519522010-05-11 19:42:161540 stable_sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1541
1542template <class RandomAccessIterator>
Arthur O'Dwyer5386aa22020-12-17 05:26:181543 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161544 partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last);
1545
1546template <class RandomAccessIterator, class Compare>
Arthur O'Dwyer5386aa22020-12-17 05:26:181547 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161548 partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last, Compare comp);
1549
1550template <class InputIterator, class RandomAccessIterator>
Arthur O'Dwyer5386aa22020-12-17 05:26:181551 constexpr RandomAccessIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161552 partial_sort_copy(InputIterator first, InputIterator last,
1553 RandomAccessIterator result_first, RandomAccessIterator result_last);
1554
1555template <class InputIterator, class RandomAccessIterator, class Compare>
Arthur O'Dwyer5386aa22020-12-17 05:26:181556 constexpr RandomAccessIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161557 partial_sort_copy(InputIterator first, InputIterator last,
1558 RandomAccessIterator result_first, RandomAccessIterator result_last, Compare comp);
1559
1560template <class RandomAccessIterator>
Arthur O'Dwyer5d956562021-02-04 23:12:521561 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161562 nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last);
1563
1564template <class RandomAccessIterator, class Compare>
Arthur O'Dwyer5d956562021-02-04 23:12:521565 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161566 nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last, Compare comp);
1567
1568template <class ForwardIterator, class T>
Marshall Clowd57c03d2018-01-16 02:34:411569 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161570 lower_bound(ForwardIterator first, ForwardIterator last, const T& value);
1571
1572template <class ForwardIterator, class T, class Compare>
Marshall Clowd57c03d2018-01-16 02:34:411573 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161574 lower_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
1575
1576template <class ForwardIterator, class T>
Marshall Clowd57c03d2018-01-16 02:34:411577 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161578 upper_bound(ForwardIterator first, ForwardIterator last, const T& value);
1579
1580template <class ForwardIterator, class T, class Compare>
Marshall Clowd57c03d2018-01-16 02:34:411581 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161582 upper_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
1583
1584template <class ForwardIterator, class T>
Marshall Clowd57c03d2018-01-16 02:34:411585 constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161586 equal_range(ForwardIterator first, ForwardIterator last, const T& value);
1587
1588template <class ForwardIterator, class T, class Compare>
Marshall Clowd57c03d2018-01-16 02:34:411589 constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161590 equal_range(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
1591
1592template <class ForwardIterator, class T>
Marshall Clowd57c03d2018-01-16 02:34:411593 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161594 binary_search(ForwardIterator first, ForwardIterator last, const T& value);
1595
1596template <class ForwardIterator, class T, class Compare>
Marshall Clow8da1a482018-01-22 23:10:401597 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161598 binary_search(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
1599
1600template <class InputIterator1, class InputIterator2, class OutputIterator>
Arthur O'Dwyer14098cf2020-12-04 18:47:121601 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161602 merge(InputIterator1 first1, InputIterator1 last1,
1603 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1604
1605template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
Arthur O'Dwyer14098cf2020-12-04 18:47:121606 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161607 merge(InputIterator1 first1, InputIterator1 last1,
1608 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1609
1610template <class BidirectionalIterator>
1611 void
1612 inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last);
1613
1614template <class BidirectionalIterator, class Compare>
1615 void
1616 inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last, Compare comp);
1617
1618template <class InputIterator1, class InputIterator2>
Marshall Clow8da1a482018-01-22 23:10:401619 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161620 includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2);
1621
1622template <class InputIterator1, class InputIterator2, class Compare>
Marshall Clow8da1a482018-01-22 23:10:401623 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161624 includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, Compare comp);
1625
1626template <class InputIterator1, class InputIterator2, class OutputIterator>
Arthur O'Dwyer14098cf2020-12-04 18:47:121627 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161628 set_union(InputIterator1 first1, InputIterator1 last1,
1629 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1630
1631template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
Arthur O'Dwyer14098cf2020-12-04 18:47:121632 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161633 set_union(InputIterator1 first1, InputIterator1 last1,
1634 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1635
1636template <class InputIterator1, class InputIterator2, class OutputIterator>
Marshall Clow8da1a482018-01-22 23:10:401637 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161638 set_intersection(InputIterator1 first1, InputIterator1 last1,
1639 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1640
1641template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
Marshall Clow8da1a482018-01-22 23:10:401642 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161643 set_intersection(InputIterator1 first1, InputIterator1 last1,
1644 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1645
1646template <class InputIterator1, class InputIterator2, class OutputIterator>
Arthur O'Dwyer14098cf2020-12-04 18:47:121647 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161648 set_difference(InputIterator1 first1, InputIterator1 last1,
1649 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1650
1651template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
Arthur O'Dwyer14098cf2020-12-04 18:47:121652 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161653 set_difference(InputIterator1 first1, InputIterator1 last1,
1654 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1655
1656template <class InputIterator1, class InputIterator2, class OutputIterator>
Arthur O'Dwyer14098cf2020-12-04 18:47:121657 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161658 set_symmetric_difference(InputIterator1 first1, InputIterator1 last1,
1659 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1660
1661template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
Arthur O'Dwyer14098cf2020-12-04 18:47:121662 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161663 set_symmetric_difference(InputIterator1 first1, InputIterator1 last1,
1664 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1665
1666template <class RandomAccessIterator>
Arthur O'Dwyer5386aa22020-12-17 05:26:181667 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161668 push_heap(RandomAccessIterator first, RandomAccessIterator last);
1669
1670template <class RandomAccessIterator, class Compare>
Arthur O'Dwyer5386aa22020-12-17 05:26:181671 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161672 push_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1673
1674template <class RandomAccessIterator>
Arthur O'Dwyer5386aa22020-12-17 05:26:181675 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161676 pop_heap(RandomAccessIterator first, RandomAccessIterator last);
1677
1678template <class RandomAccessIterator, class Compare>
Arthur O'Dwyer5386aa22020-12-17 05:26:181679 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161680 pop_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1681
1682template <class RandomAccessIterator>
Arthur O'Dwyer5386aa22020-12-17 05:26:181683 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161684 make_heap(RandomAccessIterator first, RandomAccessIterator last);
1685
1686template <class RandomAccessIterator, class Compare>
Arthur O'Dwyer5386aa22020-12-17 05:26:181687 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161688 make_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1689
1690template <class RandomAccessIterator>
Arthur O'Dwyer5386aa22020-12-17 05:26:181691 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161692 sort_heap(RandomAccessIterator first, RandomAccessIterator last);
1693
1694template <class RandomAccessIterator, class Compare>
Arthur O'Dwyer5386aa22020-12-17 05:26:181695 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161696 sort_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1697
Howard Hinnantb3371f62010-08-22 00:02:431698template <class RandomAccessIterator>
Marshall Clow49c76432018-01-15 16:16:321699 constexpr bool // constexpr in C++20
Howard Hinnantb3371f62010-08-22 00:02:431700 is_heap(RandomAccessIterator first, RandomAccessiterator last);
Howard Hinnant3e519522010-05-11 19:42:161701
Howard Hinnantb3371f62010-08-22 00:02:431702template <class RandomAccessIterator, class Compare>
Marshall Clow49c76432018-01-15 16:16:321703 constexpr bool // constexpr in C++20
Howard Hinnantb3371f62010-08-22 00:02:431704 is_heap(RandomAccessIterator first, RandomAccessiterator last, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161705
Howard Hinnantb3371f62010-08-22 00:02:431706template <class RandomAccessIterator>
Marshall Clow49c76432018-01-15 16:16:321707 constexpr RandomAccessIterator // constexpr in C++20
Howard Hinnantb3371f62010-08-22 00:02:431708 is_heap_until(RandomAccessIterator first, RandomAccessiterator last);
Howard Hinnant3e519522010-05-11 19:42:161709
Howard Hinnantb3371f62010-08-22 00:02:431710template <class RandomAccessIterator, class Compare>
Marshall Clow49c76432018-01-15 16:16:321711 constexpr RandomAccessIterator // constexpr in C++20
Howard Hinnantb3371f62010-08-22 00:02:431712 is_heap_until(RandomAccessIterator first, RandomAccessiterator last, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161713
Howard Hinnant4eb27b72010-08-21 20:10:011714template <class ForwardIterator>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181715 constexpr ForwardIterator // constexpr in C++14
1716 min_element(ForwardIterator first, ForwardIterator last);
Howard Hinnant4eb27b72010-08-21 20:10:011717
1718template <class ForwardIterator, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181719 constexpr ForwardIterator // constexpr in C++14
1720 min_element(ForwardIterator first, ForwardIterator last, Compare comp);
Howard Hinnant4eb27b72010-08-21 20:10:011721
Howard Hinnant3e519522010-05-11 19:42:161722template <class T>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181723 constexpr const T& // constexpr in C++14
1724 min(const T& a, const T& b);
Howard Hinnant3e519522010-05-11 19:42:161725
1726template <class T, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181727 constexpr const T& // constexpr in C++14
1728 min(const T& a, const T& b, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161729
Howard Hinnant4eb27b72010-08-21 20:10:011730template<class T>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181731 constexpr T // constexpr in C++14
1732 min(initializer_list<T> t);
Howard Hinnant4eb27b72010-08-21 20:10:011733
1734template<class T, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181735 constexpr T // constexpr in C++14
1736 min(initializer_list<T> t, Compare comp);
Howard Hinnant4eb27b72010-08-21 20:10:011737
Marshall Clow146c14a2016-03-07 22:43:491738template<class T>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181739 constexpr const T& clamp(const T& v, const T& lo, const T& hi); // C++17
Marshall Clow146c14a2016-03-07 22:43:491740
1741template<class T, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181742 constexpr const T& clamp(const T& v, const T& lo, const T& hi, Compare comp); // C++17
Marshall Clow146c14a2016-03-07 22:43:491743
Howard Hinnant4eb27b72010-08-21 20:10:011744template <class ForwardIterator>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181745 constexpr ForwardIterator // constexpr in C++14
1746 max_element(ForwardIterator first, ForwardIterator last);
Howard Hinnant4eb27b72010-08-21 20:10:011747
1748template <class ForwardIterator, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181749 constexpr ForwardIterator // constexpr in C++14
1750 max_element(ForwardIterator first, ForwardIterator last, Compare comp);
Howard Hinnant4eb27b72010-08-21 20:10:011751
Howard Hinnant3e519522010-05-11 19:42:161752template <class T>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181753 constexpr const T& // constexpr in C++14
1754 max(const T& a, const T& b);
Howard Hinnant3e519522010-05-11 19:42:161755
1756template <class T, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181757 constexpr const T& // constexpr in C++14
1758 max(const T& a, const T& b, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161759
Howard Hinnant4eb27b72010-08-21 20:10:011760template<class T>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181761 constexpr T // constexpr in C++14
1762 max(initializer_list<T> t);
Howard Hinnant3e519522010-05-11 19:42:161763
Howard Hinnant4eb27b72010-08-21 20:10:011764template<class T, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181765 constexpr T // constexpr in C++14
1766 max(initializer_list<T> t, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161767
Howard Hinnant4eb27b72010-08-21 20:10:011768template<class ForwardIterator>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181769 constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++14
1770 minmax_element(ForwardIterator first, ForwardIterator last);
Howard Hinnant3e519522010-05-11 19:42:161771
Howard Hinnant4eb27b72010-08-21 20:10:011772template<class ForwardIterator, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181773 constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++14
1774 minmax_element(ForwardIterator first, ForwardIterator last, Compare comp);
Howard Hinnant4eb27b72010-08-21 20:10:011775
1776template<class T>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181777 constexpr pair<const T&, const T&> // constexpr in C++14
1778 minmax(const T& a, const T& b);
Howard Hinnant4eb27b72010-08-21 20:10:011779
1780template<class T, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181781 constexpr pair<const T&, const T&> // constexpr in C++14
1782 minmax(const T& a, const T& b, Compare comp);
Howard Hinnant4eb27b72010-08-21 20:10:011783
1784template<class T>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181785 constexpr pair<T, T> // constexpr in C++14
1786 minmax(initializer_list<T> t);
Howard Hinnant4eb27b72010-08-21 20:10:011787
1788template<class T, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181789 constexpr pair<T, T> // constexpr in C++14
1790 minmax(initializer_list<T> t, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161791
1792template <class InputIterator1, class InputIterator2>
Marshall Clow1b9a4ff2018-01-22 20:44:331793 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161794 lexicographical_compare(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2);
1795
1796template <class InputIterator1, class InputIterator2, class Compare>
Marshall Clow1b9a4ff2018-01-22 20:44:331797 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161798 lexicographical_compare(InputIterator1 first1, InputIterator1 last1,
1799 InputIterator2 first2, InputIterator2 last2, Compare comp);
1800
Adrian Vogelsgesang2a067572022-08-04 22:21:271801template<class InputIterator1, class InputIterator2, class Cmp>
1802 constexpr auto
1803 lexicographical_compare_three_way(InputIterator1 first1, InputIterator1 last1,
1804 InputIterator2 first2, InputIterator2 last2,
1805 Cmp comp)
1806 -> decltype(comp(*b1, *b2)); // since C++20
1807
1808template<class InputIterator1, class InputIterator2>
1809 constexpr auto
1810 lexicographical_compare_three_way(InputIterator1 first1, InputIterator1 last1,
1811 InputIterator2 first2, InputIterator2 last2); // since C++20
1812
Howard Hinnant3e519522010-05-11 19:42:161813template <class BidirectionalIterator>
Arthur O'Dwyerf851db32020-12-17 05:01:081814 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161815 next_permutation(BidirectionalIterator first, BidirectionalIterator last);
1816
1817template <class BidirectionalIterator, class Compare>
Arthur O'Dwyerf851db32020-12-17 05:01:081818 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161819 next_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp);
1820
1821template <class BidirectionalIterator>
Arthur O'Dwyerf851db32020-12-17 05:01:081822 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161823 prev_permutation(BidirectionalIterator first, BidirectionalIterator last);
1824
1825template <class BidirectionalIterator, class Compare>
Arthur O'Dwyerf851db32020-12-17 05:01:081826 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161827 prev_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161828} // std
1829
1830*/
1831
Nikolas Klauserb9a26582024-12-21 12:01:481832#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
1833# include <__cxx03/algorithm>
1834#else
Nikolas Klauserc166a9c2024-12-10 15:02:121835# include <__config>
Howard Hinnant5d1a7012013-08-14 18:00:201836
Nikolas Klauserc166a9c2024-12-10 15:02:121837# include <__algorithm/adjacent_find.h>
1838# include <__algorithm/all_of.h>
1839# include <__algorithm/any_of.h>
1840# include <__algorithm/binary_search.h>
1841# include <__algorithm/copy.h>
1842# include <__algorithm/copy_backward.h>
1843# include <__algorithm/copy_if.h>
1844# include <__algorithm/copy_n.h>
1845# include <__algorithm/count.h>
1846# include <__algorithm/count_if.h>
1847# include <__algorithm/equal.h>
1848# include <__algorithm/equal_range.h>
1849# include <__algorithm/fill.h>
1850# include <__algorithm/fill_n.h>
1851# include <__algorithm/find.h>
1852# include <__algorithm/find_end.h>
1853# include <__algorithm/find_first_of.h>
1854# include <__algorithm/find_if.h>
1855# include <__algorithm/find_if_not.h>
1856# include <__algorithm/for_each.h>
1857# include <__algorithm/generate.h>
1858# include <__algorithm/generate_n.h>
1859# include <__algorithm/includes.h>
1860# include <__algorithm/inplace_merge.h>
1861# include <__algorithm/is_heap.h>
1862# include <__algorithm/is_heap_until.h>
1863# include <__algorithm/is_partitioned.h>
1864# include <__algorithm/is_permutation.h>
1865# include <__algorithm/is_sorted.h>
1866# include <__algorithm/is_sorted_until.h>
1867# include <__algorithm/iter_swap.h>
1868# include <__algorithm/lexicographical_compare.h>
1869# include <__algorithm/lower_bound.h>
1870# include <__algorithm/make_heap.h>
1871# include <__algorithm/max.h>
1872# include <__algorithm/max_element.h>
1873# include <__algorithm/merge.h>
1874# include <__algorithm/min.h>
1875# include <__algorithm/min_element.h>
1876# include <__algorithm/minmax.h>
1877# include <__algorithm/minmax_element.h>
1878# include <__algorithm/mismatch.h>
1879# include <__algorithm/move.h>
1880# include <__algorithm/move_backward.h>
1881# include <__algorithm/next_permutation.h>
1882# include <__algorithm/none_of.h>
1883# include <__algorithm/nth_element.h>
1884# include <__algorithm/partial_sort.h>
1885# include <__algorithm/partial_sort_copy.h>
1886# include <__algorithm/partition.h>
1887# include <__algorithm/partition_copy.h>
1888# include <__algorithm/partition_point.h>
1889# include <__algorithm/pop_heap.h>
1890# include <__algorithm/prev_permutation.h>
1891# include <__algorithm/push_heap.h>
1892# include <__algorithm/remove.h>
1893# include <__algorithm/remove_copy.h>
1894# include <__algorithm/remove_copy_if.h>
1895# include <__algorithm/remove_if.h>
1896# include <__algorithm/replace.h>
1897# include <__algorithm/replace_copy.h>
1898# include <__algorithm/replace_copy_if.h>
1899# include <__algorithm/replace_if.h>
1900# include <__algorithm/reverse.h>
1901# include <__algorithm/reverse_copy.h>
1902# include <__algorithm/rotate.h>
1903# include <__algorithm/rotate_copy.h>
1904# include <__algorithm/search.h>
1905# include <__algorithm/search_n.h>
1906# include <__algorithm/set_difference.h>
1907# include <__algorithm/set_intersection.h>
1908# include <__algorithm/set_symmetric_difference.h>
1909# include <__algorithm/set_union.h>
1910# include <__algorithm/shuffle.h>
1911# include <__algorithm/sort.h>
1912# include <__algorithm/sort_heap.h>
1913# include <__algorithm/stable_partition.h>
1914# include <__algorithm/stable_sort.h>
1915# include <__algorithm/swap_ranges.h>
1916# include <__algorithm/transform.h>
1917# include <__algorithm/unique.h>
1918# include <__algorithm/unique_copy.h>
1919# include <__algorithm/upper_bound.h>
Eric Fiselierc1bd9192014-08-10 23:53:081920
Nikolas Klauserc166a9c2024-12-10 15:02:121921# if _LIBCPP_STD_VER >= 17
1922# include <__algorithm/clamp.h>
1923# include <__algorithm/for_each_n.h>
1924# include <__algorithm/pstl.h>
1925# include <__algorithm/sample.h>
1926# endif // _LIBCPP_STD_VER >= 17
Nikolas Klauserd5c654b2024-04-14 13:52:561927
Nikolas Klauserc166a9c2024-12-10 15:02:121928# if _LIBCPP_STD_VER >= 20
1929# include <__algorithm/in_found_result.h>
1930# include <__algorithm/in_fun_result.h>
1931# include <__algorithm/in_in_out_result.h>
1932# include <__algorithm/in_in_result.h>
1933# include <__algorithm/in_out_out_result.h>
1934# include <__algorithm/in_out_result.h>
1935# include <__algorithm/lexicographical_compare_three_way.h>
1936# include <__algorithm/min_max_result.h>
1937# include <__algorithm/ranges_adjacent_find.h>
1938# include <__algorithm/ranges_all_of.h>
1939# include <__algorithm/ranges_any_of.h>
1940# include <__algorithm/ranges_binary_search.h>
1941# include <__algorithm/ranges_clamp.h>
1942# include <__algorithm/ranges_contains.h>
1943# include <__algorithm/ranges_copy.h>
1944# include <__algorithm/ranges_copy_backward.h>
1945# include <__algorithm/ranges_copy_if.h>
1946# include <__algorithm/ranges_copy_n.h>
1947# include <__algorithm/ranges_count.h>
1948# include <__algorithm/ranges_count_if.h>
1949# include <__algorithm/ranges_equal.h>
1950# include <__algorithm/ranges_equal_range.h>
1951# include <__algorithm/ranges_fill.h>
1952# include <__algorithm/ranges_fill_n.h>
1953# include <__algorithm/ranges_find.h>
1954# include <__algorithm/ranges_find_end.h>
1955# include <__algorithm/ranges_find_first_of.h>
1956# include <__algorithm/ranges_find_if.h>
1957# include <__algorithm/ranges_find_if_not.h>
1958# include <__algorithm/ranges_for_each.h>
1959# include <__algorithm/ranges_for_each_n.h>
1960# include <__algorithm/ranges_generate.h>
1961# include <__algorithm/ranges_generate_n.h>
1962# include <__algorithm/ranges_includes.h>
1963# include <__algorithm/ranges_inplace_merge.h>
1964# include <__algorithm/ranges_is_heap.h>
1965# include <__algorithm/ranges_is_heap_until.h>
1966# include <__algorithm/ranges_is_partitioned.h>
1967# include <__algorithm/ranges_is_permutation.h>
1968# include <__algorithm/ranges_is_sorted.h>
1969# include <__algorithm/ranges_is_sorted_until.h>
1970# include <__algorithm/ranges_lexicographical_compare.h>
1971# include <__algorithm/ranges_lower_bound.h>
1972# include <__algorithm/ranges_make_heap.h>
1973# include <__algorithm/ranges_max.h>
1974# include <__algorithm/ranges_max_element.h>
1975# include <__algorithm/ranges_merge.h>
1976# include <__algorithm/ranges_min.h>
1977# include <__algorithm/ranges_min_element.h>
1978# include <__algorithm/ranges_minmax.h>
1979# include <__algorithm/ranges_minmax_element.h>
1980# include <__algorithm/ranges_mismatch.h>
1981# include <__algorithm/ranges_move.h>
1982# include <__algorithm/ranges_move_backward.h>
1983# include <__algorithm/ranges_next_permutation.h>
1984# include <__algorithm/ranges_none_of.h>
1985# include <__algorithm/ranges_nth_element.h>
1986# include <__algorithm/ranges_partial_sort.h>
1987# include <__algorithm/ranges_partial_sort_copy.h>
1988# include <__algorithm/ranges_partition.h>
1989# include <__algorithm/ranges_partition_copy.h>
1990# include <__algorithm/ranges_partition_point.h>
1991# include <__algorithm/ranges_pop_heap.h>
1992# include <__algorithm/ranges_prev_permutation.h>
1993# include <__algorithm/ranges_push_heap.h>
1994# include <__algorithm/ranges_remove.h>
1995# include <__algorithm/ranges_remove_copy.h>
1996# include <__algorithm/ranges_remove_copy_if.h>
1997# include <__algorithm/ranges_remove_if.h>
1998# include <__algorithm/ranges_replace.h>
1999# include <__algorithm/ranges_replace_copy.h>
2000# include <__algorithm/ranges_replace_copy_if.h>
2001# include <__algorithm/ranges_replace_if.h>
2002# include <__algorithm/ranges_reverse.h>
2003# include <__algorithm/ranges_reverse_copy.h>
2004# include <__algorithm/ranges_rotate.h>
2005# include <__algorithm/ranges_rotate_copy.h>
2006# include <__algorithm/ranges_sample.h>
2007# include <__algorithm/ranges_search.h>
2008# include <__algorithm/ranges_search_n.h>
2009# include <__algorithm/ranges_set_difference.h>
2010# include <__algorithm/ranges_set_intersection.h>
2011# include <__algorithm/ranges_set_symmetric_difference.h>
2012# include <__algorithm/ranges_set_union.h>
2013# include <__algorithm/ranges_shuffle.h>
2014# include <__algorithm/ranges_sort.h>
2015# include <__algorithm/ranges_sort_heap.h>
2016# include <__algorithm/ranges_stable_partition.h>
2017# include <__algorithm/ranges_stable_sort.h>
2018# include <__algorithm/ranges_swap_ranges.h>
2019# include <__algorithm/ranges_transform.h>
2020# include <__algorithm/ranges_unique.h>
2021# include <__algorithm/ranges_unique_copy.h>
2022# include <__algorithm/ranges_upper_bound.h>
2023# include <__algorithm/shift_left.h>
2024# include <__algorithm/shift_right.h>
2025# endif
Nikolas Klauserd5c654b2024-04-14 13:52:562026
Nikolas Klauserc166a9c2024-12-10 15:02:122027# if _LIBCPP_STD_VER >= 23
2028# include <__algorithm/ranges_contains_subrange.h>
2029# include <__algorithm/ranges_ends_with.h>
2030# include <__algorithm/ranges_find_last.h>
2031# include <__algorithm/ranges_fold.h>
2032# include <__algorithm/ranges_starts_with.h>
2033# endif // _LIBCPP_STD_VER >= 23
Nikolas Klauserd5c654b2024-04-14 13:52:562034
Nikolas Klauserc166a9c2024-12-10 15:02:122035# include <version>
Nikolas Klauserd5c654b2024-04-14 13:52:562036
Nikolas Klauserdb1978b2022-06-16 20:43:462037// standard-mandated includes
Nikolas Klauser473a1602022-09-22 16:05:082038
2039// [algorithm.syn]
Nikolas Klauserc166a9c2024-12-10 15:02:122040# include <initializer_list>
Nikolas Klauserdb1978b2022-06-16 20:43:462041
Nikolas Klauserc166a9c2024-12-10 15:02:122042# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2043# pragma GCC system_header
2044# endif
Howard Hinnant3e519522010-05-11 19:42:162045
Nikolas Klauserc166a9c2024-12-10 15:02:122046# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER == 14
2047# include <execution>
2048# endif
Nikolas Klauserd5c654b2024-04-14 13:52:562049
Nikolas Klauserc166a9c2024-12-10 15:02:122050# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
2051# include <atomic>
2052# include <bit>
2053# include <concepts>
2054# include <cstdlib>
2055# include <cstring>
2056# include <iterator>
2057# include <memory>
2058# include <stdexcept>
2059# include <type_traits>
2060# include <utility>
2061# endif
Nikolas Klauserb9a26582024-12-21 12:01:482062#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
Mark de Wevere31c2a12022-09-02 15:53:282063
Louis Dionne4cd6ca12021-04-20 16:03:322064#endif // _LIBCPP_ALGORITHM