blob: 7dcafbc838edd53e76ef6af8cd61da31c26e5715 [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>
A. Jiangba9aeed2025-03-06 17:27:48425 constexpr I // constexpr since C++26
426 ranges::stable_sort(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
Konstantin Varlamov94c7b892022-07-01 23:34:08427
428 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
429 requires sortable<iterator_t<R>, Comp, Proj>
A. Jiangba9aeed2025-03-06 17:27:48430 constexpr borrowed_iterator_t<R> // constexpr since C++26
Konstantin Varlamov94c7b892022-07-01 23:34:08431 ranges::stable_sort(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Konstantin Varlamovff3989e2022-06-16 22:20:53432
varconst5dd19ad2022-07-20 03:10:02433 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
434 class Proj = identity>
435 requires sortable<I, Comp, Proj>
436 constexpr I
437 ranges::partial_sort(I first, I middle, S last, Comp comp = {}, Proj proj = {}); // since C++20
438
439 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
440 requires sortable<iterator_t<R>, Comp, Proj>
441 constexpr borrowed_iterator_t<R>
442 ranges::partial_sort(R&& r, iterator_t<R> middle, Comp comp = {}, Proj proj = {}); // since C++20
443
Nikolas Klauser7af89a32022-05-21 16:26:29444 template<class T, output_iterator<const T&> O, sentinel_for<O> S>
445 constexpr O ranges::fill(O first, S last, const T& value); // since C++20
446
447 template<class T, output_range<const T&> R>
448 constexpr borrowed_iterator_t<R> ranges::fill(R&& r, const T& value); // since C++20
449
450 template<class T, output_iterator<const T&> O>
451 constexpr O ranges::fill_n(O first, iter_difference_t<O> n, const T& value); // since C++20
Nikolas Klauser569d6632022-05-25 09:09:43452
Konstantin Varlamovead73022022-07-26 22:50:14453 template<input_or_output_iterator O, sentinel_for<O> S, copy_constructible F>
454 requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>>
Mark de Weverde6827b2023-02-24 20:35:41455 constexpr O generate(O first, S last, F gen); // since C++20
Konstantin Varlamovead73022022-07-26 22:50:14456
Nikolas Klausercd916102023-06-09 20:45:34457 template<class ExecutionPolicy, class ForwardIterator, class Generator>
458 void generate(ExecutionPolicy&& exec,
459 ForwardIterator first, ForwardIterator last,
460 Generator gen); // since C++17
461
Konstantin Varlamovead73022022-07-26 22:50:14462 template<class R, copy_constructible F>
463 requires invocable<F&> && output_range<R, invoke_result_t<F&>>
Mark de Weverde6827b2023-02-24 20:35:41464 constexpr borrowed_iterator_t<R> generate(R&& r, F gen); // since C++20
Konstantin Varlamovead73022022-07-26 22:50:14465
466 template<input_or_output_iterator O, copy_constructible F>
467 requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>>
Mark de Weverde6827b2023-02-24 20:35:41468 constexpr O generate_n(O first, iter_difference_t<O> n, F gen); // since C++20
Konstantin Varlamovead73022022-07-26 22:50:14469
Nikolas Klausercd916102023-06-09 20:45:34470 template<class ExecutionPolicy, class ForwardIterator, class Size, class Generator>
471 ForwardIterator generate_n(ExecutionPolicy&& exec,
472 ForwardIterator first, Size n, Generator gen); // since C++17
473
Nikolas Klauser569d6632022-05-25 09:09:43474 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
475 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
476 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
477 constexpr bool ranges::equal(I1 first1, S1 last1, I2 first2, S2 last2,
478 Pred pred = {},
479 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
480
481 template<input_range R1, input_range R2, class Pred = ranges::equal_to,
482 class Proj1 = identity, class Proj2 = identity>
483 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
484 constexpr bool ranges::equal(R1&& r1, R2&& r2, Pred pred = {},
485 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
486
Nikolas Klauser0e3dc1a2022-05-26 14:42:46487 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
488 indirect_unary_predicate<projected<I, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:41489 constexpr bool ranges::all_of(I first, S last, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser0e3dc1a2022-05-26 14:42:46490
491 template<input_range R, class Proj = identity,
492 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:41493 constexpr bool ranges::all_of(R&& r, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser0e3dc1a2022-05-26 14:42:46494
495 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
496 indirect_unary_predicate<projected<I, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:41497 constexpr bool ranges::any_of(I first, S last, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser0e3dc1a2022-05-26 14:42:46498
499 template<input_range R, class Proj = identity,
500 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:41501 constexpr bool ranges::any_of(R&& r, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser0e3dc1a2022-05-26 14:42:46502
Zijun Zhao0218ea42023-09-18 18:28:11503 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
504 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
505 requires (forward_iterator<I1> || sized_sentinel_for<S1, I1>) &&
506 (forward_iterator<I2> || sized_sentinel_for<S2, I2>) &&
507 indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
508 constexpr bool ranges::ends_with(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
509 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23
510
511 template<input_range R1, input_range R2, class Pred = ranges::equal_to, class Proj1 = identity,
512 class Proj2 = identity>
513 requires (forward_range<R1> || sized_range<R1>) &&
514 (forward_range<R2> || sized_range<R2>) &&
515 indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
516 constexpr bool ranges::ends_with(R1&& r1, R2&& r2, Pred pred = {},
517 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23
518
Nikolas Klauser0e3dc1a2022-05-26 14:42:46519 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
520 indirect_unary_predicate<projected<I, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:41521 constexpr bool ranges::none_of(I first, S last, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser0e3dc1a2022-05-26 14:42:46522
523 template<input_range R, class Proj = identity,
524 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:41525 constexpr bool ranges::none_of(R&& r, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser0e3dc1a2022-05-26 14:42:46526
zijunzhao20517552023-05-08 22:04:00527 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
528 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
529 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
530 constexpr bool ranges::starts_with(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
531 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23
532
533 template<input_range R1, input_range R2, class Pred = ranges::equal_to, class Proj1 = identity,
534 class Proj2 = identity>
535 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
536 constexpr bool ranges::starts_with(R1&& r1, R2&& r2, Pred pred = {},
537 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23
538
Konstantin Varlamovdb7d7952022-07-30 09:42:05539 template<input_iterator I1, sentinel_for<I1> S1,
540 random_access_iterator I2, sentinel_for<I2> S2,
541 class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
542 requires indirectly_copyable<I1, I2> && sortable<I2, Comp, Proj2> &&
543 indirect_strict_weak_order<Comp, projected<I1, Proj1>, projected<I2, Proj2>>
544 constexpr partial_sort_copy_result<I1, I2>
545 partial_sort_copy(I1 first, S1 last, I2 result_first, S2 result_last,
Mark de Weverde6827b2023-02-24 20:35:41546 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Konstantin Varlamovdb7d7952022-07-30 09:42:05547
548 template<input_range R1, random_access_range R2, class Comp = ranges::less,
549 class Proj1 = identity, class Proj2 = identity>
550 requires indirectly_copyable<iterator_t<R1>, iterator_t<R2>> &&
551 sortable<iterator_t<R2>, Comp, Proj2> &&
552 indirect_strict_weak_order<Comp, projected<iterator_t<R1>, Proj1>,
553 projected<iterator_t<R2>, Proj2>>
554 constexpr partial_sort_copy_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
555 partial_sort_copy(R1&& r, R2&& result_r, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:41556 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Konstantin Varlamovdb7d7952022-07-30 09:42:05557
Nikolas Klauser11e3ad22022-05-26 14:08:55558 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
559 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
560 constexpr bool ranges::is_sorted(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
561
562 template<forward_range R, class Proj = identity,
563 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
564 constexpr bool ranges::is_sorted(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
565
566 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
567 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
568 constexpr I ranges::is_sorted_until(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
569
570 template<forward_range R, class Proj = identity,
571 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
572 constexpr borrowed_iterator_t<R>
573 ranges::is_sorted_until(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser81715862022-06-05 19:15:16574
Konstantin Varlamov23c73282022-07-08 03:35:51575 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
576 class Proj = identity>
577 requires sortable<I, Comp, Proj>
578 constexpr I
Mark de Weverde6827b2023-02-24 20:35:41579 ranges::nth_element(I first, I nth, S last, Comp comp = {}, Proj proj = {}); // since C++20
Konstantin Varlamov23c73282022-07-08 03:35:51580
581 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
582 requires sortable<iterator_t<R>, Comp, Proj>
583 constexpr borrowed_iterator_t<R>
Mark de Weverde6827b2023-02-24 20:35:41584 ranges::nth_element(R&& r, iterator_t<R> nth, Comp comp = {}, Proj proj = {}); // since C++20
Konstantin Varlamov23c73282022-07-08 03:35:51585
Nikolas Klauser81715862022-06-05 19:15:16586 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
Mark de Weverde6827b2023-02-24 20:35:41587 indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less> // since C++20
588 constexpr I upper_bound(I first, S last, const T& value, Comp comp = {}, Proj proj = {});
Nikolas Klauser81715862022-06-05 19:15:16589
590 template<forward_range R, class T, class Proj = identity,
591 indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
592 ranges::less>
593 constexpr borrowed_iterator_t<R>
Mark de Weverde6827b2023-02-24 20:35:41594 upper_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser81715862022-06-05 19:15:16595
596 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
597 indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
598 constexpr I lower_bound(I first, S last, const T& value, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:41599 Proj proj = {}); // since C++20
Nikolas Klauser81715862022-06-05 19:15:16600 template<forward_range R, class T, class Proj = identity,
601 indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
602 ranges::less>
603 constexpr borrowed_iterator_t<R>
Mark de Weverde6827b2023-02-24 20:35:41604 lower_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser81715862022-06-05 19:15:16605
606 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
607 indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
608 constexpr bool binary_search(I first, S last, const T& value, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:41609 Proj proj = {}); // since C++20
Nikolas Klauserb79b2b62022-06-06 11:57:34610
Nikolas Klauser81715862022-06-05 19:15:16611 template<forward_range R, class T, class Proj = identity,
612 indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
613 ranges::less>
614 constexpr bool binary_search(R&& r, const T& value, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:41615 Proj proj = {}); // since C++20
Konstantin Varlamov8ed702b2022-07-19 04:05:51616
617 template<permutable I, sentinel_for<I> S, class Proj = identity,
618 indirect_unary_predicate<projected<I, Proj>> Pred>
619 constexpr subrange<I>
Mark de Weverde6827b2023-02-24 20:35:41620 partition(I first, S last, Pred pred, Proj proj = {}); // since C++20
Konstantin Varlamov8ed702b2022-07-19 04:05:51621
622 template<forward_range R, class Proj = identity,
623 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
624 requires permutable<iterator_t<R>>
625 constexpr borrowed_subrange_t<R>
Mark de Weverde6827b2023-02-24 20:35:41626 partition(R&& r, Pred pred, Proj proj = {}); // since C++20
Konstantin Varlamov8ed702b2022-07-19 04:05:51627
628 template<bidirectional_iterator I, sentinel_for<I> S, class Proj = identity,
629 indirect_unary_predicate<projected<I, Proj>> Pred>
630 requires permutable<I>
A. Jiangc28c5082025-03-06 01:23:55631 constexpr subrange<I> // constexpr since C++26
632 stable_partition(I first, S last, Pred pred, Proj proj = {}); // since C++20
Konstantin Varlamov8ed702b2022-07-19 04:05:51633
634 template<bidirectional_range R, class Proj = identity,
635 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
636 requires permutable<iterator_t<R>>
A. Jiangc28c5082025-03-06 01:23:55637 constexpr borrowed_subrange_t<R> // constexpr since C++26
638 stable_partition(R&& r, Pred pred, Proj proj = {}); // since C++20
Konstantin Varlamov8ed702b2022-07-19 04:05:51639
Nikolas Klauserb79b2b62022-06-06 11:57:34640 template<input_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2,
641 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
642 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
643 constexpr I1 ranges::find_first_of(I1 first1, S1 last1, I2 first2, S2 last2,
644 Pred pred = {},
645 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
646
647 template<input_range R1, forward_range R2,
648 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
649 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
650 constexpr borrowed_iterator_t<R1>
651 ranges::find_first_of(R1&& r1, R2&& r2,
652 Pred pred = {},
653 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauser81715862022-06-05 19:15:16654
Nikolas Klauser916e9052022-06-08 10:14:12655 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
656 indirect_binary_predicate<projected<I, Proj>,
657 projected<I, Proj>> Pred = ranges::equal_to>
Mark de Weverde6827b2023-02-24 20:35:41658 constexpr I ranges::adjacent_find(I first, S last, Pred pred = {}, Proj proj = {}); // since C++20
Nikolas Klauser916e9052022-06-08 10:14:12659
660 template<forward_range R, class Proj = identity,
661 indirect_binary_predicate<projected<iterator_t<R>, Proj>,
662 projected<iterator_t<R>, Proj>> Pred = ranges::equal_to>
663 constexpr borrowed_iterator_t<R> ranges::adjacent_find(R&& r, Pred pred = {}, Proj proj = {}); // since C++20
664
Nikolas Klauserff6d5de2022-06-07 07:42:10665 template<input_iterator I, sentinel_for<I> S, class T1, class T2, class Proj = identity>
666 requires indirectly_writable<I, const T2&> &&
667 indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*>
668 constexpr I
669 ranges::replace(I first, S last, const T1& old_value, const T2& new_value, Proj proj = {}); // since C++20
670
671 template<input_range R, class T1, class T2, class Proj = identity>
672 requires indirectly_writable<iterator_t<R>, const T2&> &&
673 indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T1*>
674 constexpr borrowed_iterator_t<R>
675 ranges::replace(R&& r, const T1& old_value, const T2& new_value, Proj proj = {}); // since C++20
676
677 template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity,
678 indirect_unary_predicate<projected<I, Proj>> Pred>
679 requires indirectly_writable<I, const T&>
680 constexpr I ranges::replace_if(I first, S last, Pred pred, const T& new_value, Proj proj = {}); // since C++20
681
682 template<input_range R, class T, class Proj = identity,
683 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
684 requires indirectly_writable<iterator_t<R>, const T&>
685 constexpr borrowed_iterator_t<R>
686 ranges::replace_if(R&& r, Pred pred, const T& new_value, Proj proj = {}); // since C++20
687
Nikolas Klausera203acb2022-08-03 23:30:50688 template<class T, class Proj = identity,
689 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
690 constexpr const T&
691 ranges::clamp(const T& v, const T& lo, const T& hi, Comp comp = {}, Proj proj = {}); // since C++20
692
Nikolas Klauserafd5a4f2022-06-15 14:24:43693 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
694 class Proj1 = identity, class Proj2 = identity,
695 indirect_strict_weak_order<projected<I1, Proj1>,
696 projected<I2, Proj2>> Comp = ranges::less>
697 constexpr bool
698 ranges::lexicographical_compare(I1 first1, S1 last1, I2 first2, S2 last2,
Mark de Weverde6827b2023-02-24 20:35:41699 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauserafd5a4f2022-06-15 14:24:43700
701 template<input_range R1, input_range R2, class Proj1 = identity,
702 class Proj2 = identity,
703 indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>,
704 projected<iterator_t<R2>, Proj2>> Comp = ranges::less>
705 constexpr bool
706 ranges::lexicographical_compare(R1&& r1, R2&& r2, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:41707 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauserafd5a4f2022-06-15 14:24:43708
Louis Dionne09e3a362024-09-16 19:06:20709 template<class I, class O>
710 using move_result = in_out_result<I, O>; // since C++20
711
712 template<class I, class O>
713 using move_backward_result = in_out_result<I, O>; // since C++20
714
Nikolas Klauser2c3bbac2022-06-23 10:23:41715 template<bidirectional_iterator I1, sentinel_for<I1> S1, bidirectional_iterator I2>
716 requires indirectly_movable<I1, I2>
717 constexpr ranges::move_backward_result<I1, I2>
718 ranges::move_backward(I1 first, S1 last, I2 result); // since C++20
719
720 template<bidirectional_range R, bidirectional_iterator I>
721 requires indirectly_movable<iterator_t<R>, I>
722 constexpr ranges::move_backward_result<borrowed_iterator_t<R>, I>
723 ranges::move_backward(R&& r, I result); // since C++20
724
725 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O>
726 requires indirectly_movable<I, O>
727 constexpr ranges::move_result<I, O>
728 ranges::move(I first, S last, O result); // since C++20
729
730 template<input_range R, weakly_incrementable O>
731 requires indirectly_movable<iterator_t<R>, O>
732 constexpr ranges::move_result<borrowed_iterator_t<R>, O>
733 ranges::move(R&& r, O result); // since C++20
734
Konstantin Varlamov065202f2022-07-20 08:57:13735 template<class I, class O1, class O2>
736 using partition_copy_result = in_out_out_result<I, O1, O2>; // since C++20
737
738 template<input_iterator I, sentinel_for<I> S,
739 weakly_incrementable O1, weakly_incrementable O2,
740 class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
741 requires indirectly_copyable<I, O1> && indirectly_copyable<I, O2>
742 constexpr partition_copy_result<I, O1, O2>
743 partition_copy(I first, S last, O1 out_true, O2 out_false, Pred pred,
Mark de Weverde6827b2023-02-24 20:35:41744 Proj proj = {}); // since C++20
Konstantin Varlamov065202f2022-07-20 08:57:13745
746 template<input_range R, weakly_incrementable O1, weakly_incrementable O2,
747 class Proj = identity,
748 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
749 requires indirectly_copyable<iterator_t<R>, O1> &&
750 indirectly_copyable<iterator_t<R>, O2>
751 constexpr partition_copy_result<borrowed_iterator_t<R>, O1, O2>
Mark de Weverde6827b2023-02-24 20:35:41752 partition_copy(R&& r, O1 out_true, O2 out_false, Pred pred, Proj proj = {}); // since C++20
Konstantin Varlamov065202f2022-07-20 08:57:13753
754 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
755 indirect_unary_predicate<projected<I, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:41756 constexpr I partition_point(I first, S last, Pred pred, Proj proj = {}); // since C++20
Konstantin Varlamov065202f2022-07-20 08:57:13757
758 template<forward_range R, class Proj = identity,
759 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
760 constexpr borrowed_iterator_t<R>
Mark de Weverde6827b2023-02-24 20:35:41761 partition_point(R&& r, Pred pred, Proj proj = {}); // since C++20
Konstantin Varlamov065202f2022-07-20 08:57:13762
Hui Xie25607d12022-06-26 15:13:43763 template<class I1, class I2, class O>
764 using merge_result = in_in_out_result<I1, I2, O>; // since C++20
765
766 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
767 weakly_incrementable O, class Comp = ranges::less, class Proj1 = identity,
768 class Proj2 = identity>
769 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
770 constexpr merge_result<I1, I2, O>
771 merge(I1 first1, S1 last1, I2 first2, S2 last2, O result,
772 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
773
774 template<input_range R1, input_range R2, weakly_incrementable O, class Comp = ranges::less,
775 class Proj1 = identity, class Proj2 = identity>
776 requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
777 constexpr merge_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
778 merge(R1&& r1, R2&& r2, O result,
779 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauser2c3bbac2022-06-23 10:23:41780
Nikolas Klauserf8cbe3cdf2022-07-06 12:03:00781 template<permutable I, sentinel_for<I> S, class T, class Proj = identity>
782 requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
783 constexpr subrange<I> ranges::remove(I first, S last, const T& value, Proj proj = {}); // since C++20
784
785 template<forward_range R, class T, class Proj = identity>
786 requires permutable<iterator_t<R>> &&
787 indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
788 constexpr borrowed_subrange_t<R>
789 ranges::remove(R&& r, const T& value, Proj proj = {}); // since C++20
790
791 template<permutable I, sentinel_for<I> S, class Proj = identity,
792 indirect_unary_predicate<projected<I, Proj>> Pred>
793 constexpr subrange<I> ranges::remove_if(I first, S last, Pred pred, Proj proj = {}); // since C++20
794
795 template<forward_range R, class Proj = identity,
796 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
797 requires permutable<iterator_t<R>>
798 constexpr borrowed_subrange_t<R>
799 ranges::remove_if(R&& r, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser7d426a32022-07-11 15:07:35800
Hui Xie1cdec6c2022-06-26 15:13:43801 template<class I, class O>
Nikolas Klauser7d426a32022-07-11 15:07:35802 using set_difference_result = in_out_result<I, O>; // since C++20
Hui Xie1cdec6c2022-06-26 15:13:43803
804 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
805 weakly_incrementable O, class Comp = ranges::less,
806 class Proj1 = identity, class Proj2 = identity>
807 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
808 constexpr set_difference_result<I1, O>
809 set_difference(I1 first1, S1 last1, I2 first2, S2 last2, O result,
810 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
811
812 template<input_range R1, input_range R2, weakly_incrementable O,
813 class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
814 requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
815 constexpr set_difference_result<borrowed_iterator_t<R1>, O>
816 set_difference(R1&& r1, R2&& r2, O result,
817 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauserf8cbe3cdf2022-07-06 12:03:00818
Hui Xie96b674f2022-07-08 14:21:40819 template<class I1, class I2, class O>
820 using set_intersection_result = in_in_out_result<I1, I2, O>; // since C++20
821
822 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
823 weakly_incrementable O, class Comp = ranges::less,
824 class Proj1 = identity, class Proj2 = identity>
825 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
826 constexpr set_intersection_result<I1, I2, O>
827 set_intersection(I1 first1, S1 last1, I2 first2, S2 last2, O result,
828 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
829
830 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
831 weakly_incrementable O, class Comp = ranges::less,
832 class Proj1 = identity, class Proj2 = identity>
833 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
834 constexpr set_intersection_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
835 set_intersection(R1&& r1, R2&& r2, O result,
836 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
837
Nikolas Klauser7d426a32022-07-11 15:07:35838 template <class _InIter, class _OutIter>
839 using reverse_copy_result = in_out_result<_InIter, _OutIter>; // since C++20
840
841 template<bidirectional_iterator I, sentinel_for<I> S, weakly_incrementable O>
842 requires indirectly_copyable<I, O>
843 constexpr ranges::reverse_copy_result<I, O>
844 ranges::reverse_copy(I first, S last, O result); // since C++20
845
846 template<bidirectional_range R, weakly_incrementable O>
847 requires indirectly_copyable<iterator_t<R>, O>
848 constexpr ranges::reverse_copy_result<borrowed_iterator_t<R>, O>
849 ranges::reverse_copy(R&& r, O result); // since C++20
850
Konstantin Varlamov36c746c2022-08-03 23:04:14851 template<permutable I, sentinel_for<I> S>
852 constexpr subrange<I> rotate(I first, I middle, S last); // since C++20
853
854 template<forward_range R>
855 requires permutable<iterator_t<R>>
Mark de Weverde6827b2023-02-24 20:35:41856 constexpr borrowed_subrange_t<R> rotate(R&& r, iterator_t<R> middle); // since C++20
Konstantin Varlamov36c746c2022-08-03 23:04:14857
Nikolas Klauser7d426a32022-07-11 15:07:35858 template <class _InIter, class _OutIter>
859 using rotate_copy_result = in_out_result<_InIter, _OutIter>; // since C++20
860
861 template<forward_iterator I, sentinel_for<I> S, weakly_incrementable O>
862 requires indirectly_copyable<I, O>
863 constexpr ranges::rotate_copy_result<I, O>
864 ranges::rotate_copy(I first, I middle, S last, O result); // since C++20
865
866 template<forward_range R, weakly_incrementable O>
867 requires indirectly_copyable<iterator_t<R>, O>
868 constexpr ranges::rotate_copy_result<borrowed_iterator_t<R>, O>
869 ranges::rotate_copy(R&& r, iterator_t<R> middle, O result); // since C++20
870
Konstantin Varlamov6bdb6422022-08-03 05:33:12871 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Gen>
872 requires (forward_iterator<I> || random_access_iterator<O>) &&
873 indirectly_copyable<I, O> &&
874 uniform_random_bit_generator<remove_reference_t<Gen>>
Mark de Weverde6827b2023-02-24 20:35:41875 O sample(I first, S last, O out, iter_difference_t<I> n, Gen&& g); // since C++20
Konstantin Varlamov6bdb6422022-08-03 05:33:12876
877 template<input_range R, weakly_incrementable O, class Gen>
878 requires (forward_range<R> || random_access_iterator<O>) &&
879 indirectly_copyable<iterator_t<R>, O> &&
880 uniform_random_bit_generator<remove_reference_t<Gen>>
Mark de Weverde6827b2023-02-24 20:35:41881 O sample(R&& r, O out, range_difference_t<R> n, Gen&& g); // since C++20
Konstantin Varlamov6bdb6422022-08-03 05:33:12882
Konstantin Varlamov14cf74d2022-07-22 16:58:56883 template<random_access_iterator I, sentinel_for<I> S, class Gen>
884 requires permutable<I> &&
885 uniform_random_bit_generator<remove_reference_t<Gen>>
Mark de Weverde6827b2023-02-24 20:35:41886 I shuffle(I first, S last, Gen&& g); // since C++20
Konstantin Varlamov14cf74d2022-07-22 16:58:56887
888 template<random_access_range R, class Gen>
889 requires permutable<iterator_t<R>> &&
890 uniform_random_bit_generator<remove_reference_t<Gen>>
Mark de Weverde6827b2023-02-24 20:35:41891 borrowed_iterator_t<R> shuffle(R&& r, Gen&& g); // since C++20
Konstantin Varlamov14cf74d2022-07-22 16:58:56892
Nikolas Klauser101d1e92022-07-13 16:07:26893 template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2,
Nikolas Klauser4038c852022-08-04 17:54:13894 sentinel_for<I2> S2, class Proj1 = identity, class Proj2 = identity,
895 indirect_equivalence_relation<projected<I1, Proj1>,
896 projected<I2, Proj2>> Pred = ranges::equal_to>
897 constexpr bool ranges::is_permutation(I1 first1, S1 last1, I2 first2, S2 last2,
898 Pred pred = {},
Mark de Weverde6827b2023-02-24 20:35:41899 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauser4038c852022-08-04 17:54:13900
901 template<forward_range R1, forward_range R2,
902 class Proj1 = identity, class Proj2 = identity,
903 indirect_equivalence_relation<projected<iterator_t<R1>, Proj1>,
904 projected<iterator_t<R2>, Proj2>> Pred = ranges::equal_to>
905 constexpr bool ranges::is_permutation(R1&& r1, R2&& r2, Pred pred = {},
Mark de Weverde6827b2023-02-24 20:35:41906 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauser4038c852022-08-04 17:54:13907
908 template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2,
Nikolas Klauser101d1e92022-07-13 16:07:26909 sentinel_for<I2> S2, class Pred = ranges::equal_to,
910 class Proj1 = identity, class Proj2 = identity>
911 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
912 constexpr subrange<I1>
913 ranges::search(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
914 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
915
916 template<forward_range R1, forward_range R2, class Pred = ranges::equal_to,
917 class Proj1 = identity, class Proj2 = identity>
918 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
919 constexpr borrowed_subrange_t<R1>
920 ranges::search(R1&& r1, R2&& r2, Pred pred = {},
921 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
922
923 template<forward_iterator I, sentinel_for<I> S, class T,
924 class Pred = ranges::equal_to, class Proj = identity>
925 requires indirectly_comparable<I, const T*, Pred, Proj>
926 constexpr subrange<I>
927 ranges::search_n(I first, S last, iter_difference_t<I> count,
928 const T& value, Pred pred = {}, Proj proj = {}); // since C++20
929
930 template<forward_range R, class T, class Pred = ranges::equal_to,
931 class Proj = identity>
932 requires indirectly_comparable<iterator_t<R>, const T*, Pred, Proj>
933 constexpr borrowed_subrange_t<R>
934 ranges::search_n(R&& r, range_difference_t<R> count,
935 const T& value, Pred pred = {}, Proj proj = {}); // since C++20
936
Christopher Di Bella39034382023-12-20 05:57:50937 template<input_iterator I, sentinel_for<I> S, class T,
938 indirectly-binary-left-foldable<T, I> F>
939 constexpr auto ranges::fold_left(I first, S last, T init, F f); // since C++23
940
941 template<input_range R, class T, indirectly-binary-left-foldable<T, iterator_t<R>> F>
942 constexpr auto fold_left(R&& r, T init, F f); // since C++23
943
944 template<class I, class T>
945 using fold_left_with_iter_result = in_value_result<I, T>; // since C++23
946
947 template<input_iterator I, sentinel_for<I> S, class T,
948 indirectly-binary-left-foldable<T, I> F>
949 constexpr see below fold_left_with_iter(I first, S last, T init, F f); // since C++23
950
951 template<input_range R, class T, indirectly-binary-left-foldable<T, iterator_t<R>> F>
952 constexpr see below fold_left_with_iter(R&& r, T init, F f); // since C++23
953
Nikolas Klauser101d1e92022-07-13 16:07:26954 template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2,
955 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
956 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
957 constexpr subrange<I1>
958 ranges::find_end(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
959 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
960
961 template<forward_range R1, forward_range R2,
962 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
963 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
964 constexpr borrowed_subrange_t<R1>
965 ranges::find_end(R1&& r1, R2&& r2, Pred pred = {},
966 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
967
Hui Xiea5c06382022-07-11 22:39:59968 template<class I1, class I2, class O>
969 using set_symmetric_difference_result = in_in_out_result<I1, I2, O>; // since C++20
970
971 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
972 weakly_incrementable O, class Comp = ranges::less,
973 class Proj1 = identity, class Proj2 = identity>
974 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
975 constexpr set_symmetric_difference_result<I1, I2, O>
976 set_symmetric_difference(I1 first1, S1 last1, I2 first2, S2 last2, O result,
977 Comp comp = {}, Proj1 proj1 = {},
978 Proj2 proj2 = {}); // since C++20
Hui Xie8a617492022-07-27 12:20:16979
Hui Xiea5c06382022-07-11 22:39:59980 template<input_range R1, input_range R2, weakly_incrementable O,
981 class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
982 requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
983 constexpr set_symmetric_difference_result<borrowed_iterator_t<R1>,
984 borrowed_iterator_t<R2>, O>
985 set_symmetric_difference(R1&& r1, R2&& r2, O result, Comp comp = {},
986 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Hui Xie0f6364b82022-07-14 19:35:15987
988 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
989 indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
990 constexpr subrange<I>
991 equal_range(I first, S last, const T& value, Comp comp = {}, Proj proj = {}); // since C++20
Hui Xie8a617492022-07-27 12:20:16992
Hui Xie0f6364b82022-07-14 19:35:15993 template<forward_range R, class T, class Proj = identity,
994 indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
995 ranges::less>
996 constexpr borrowed_subrange_t<R>
997 equal_range(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20
Hui Xie8a617492022-07-27 12:20:16998
Hui Xie3151b952022-07-13 16:20:22999 template<class I1, class I2, class O>
1000 using set_union_result = in_in_out_result<I1, I2, O>; // since C++20
1001
1002 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
1003 weakly_incrementable O, class Comp = ranges::less,
1004 class Proj1 = identity, class Proj2 = identity>
1005 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
1006 constexpr set_union_result<I1, I2, O>
1007 set_union(I1 first1, S1 last1, I2 first2, S2 last2, O result, Comp comp = {},
1008 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
1009
1010 template<input_range R1, input_range R2, weakly_incrementable O,
1011 class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
1012 requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
1013 constexpr set_union_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
1014 set_union(R1&& r1, R2&& r2, O result, Comp comp = {},
1015 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Hui Xiec5599642022-07-19 19:54:351016
1017 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
1018 class Proj1 = identity, class Proj2 = identity,
1019 indirect_strict_weak_order<projected<I1, Proj1>, projected<I2, Proj2>> Comp =
1020 ranges::less>
1021 constexpr bool includes(I1 first1, S1 last1, I2 first2, S2 last2, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:411022 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Hui Xie8a617492022-07-27 12:20:161023
Hui Xiec5599642022-07-19 19:54:351024 template<input_range R1, input_range R2, class Proj1 = identity,
1025 class Proj2 = identity,
1026 indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>,
1027 projected<iterator_t<R2>, Proj2>> Comp = ranges::less>
1028 constexpr bool includes(R1&& r1, R2&& r2, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:411029 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Hui Xie8a617492022-07-27 12:20:161030
1031 template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
1032 class Proj = identity>
1033 requires sortable<I, Comp, Proj>
Mark de Weverde6827b2023-02-24 20:35:411034 I inplace_merge(I first, I middle, S last, Comp comp = {}, Proj proj = {}); // since C++20
Hui Xie8a617492022-07-27 12:20:161035
1036 template<bidirectional_range R, class Comp = ranges::less, class Proj = identity>
1037 requires sortable<iterator_t<R>, Comp, Proj>
1038 borrowed_iterator_t<R>
1039 inplace_merge(R&& r, iterator_t<R> middle, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:411040 Proj proj = {}); // since C++20
Hui Xie72f57e32022-07-23 00:44:251041
1042 template<permutable I, sentinel_for<I> S, class Proj = identity,
1043 indirect_equivalence_relation<projected<I, Proj>> C = ranges::equal_to>
Mark de Weverde6827b2023-02-24 20:35:411044 constexpr subrange<I> unique(I first, S last, C comp = {}, Proj proj = {}); // since C++20
Hui Xie72f57e32022-07-23 00:44:251045
1046 template<forward_range R, class Proj = identity,
1047 indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to>
1048 requires permutable<iterator_t<R>>
1049 constexpr borrowed_subrange_t<R>
Mark de Weverde6827b2023-02-24 20:35:411050 unique(R&& r, C comp = {}, Proj proj = {}); // since C++20
Hui Xie72f57e32022-07-23 00:44:251051
1052 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Proj = identity,
1053 indirect_equivalence_relation<projected<I, Proj>> C = ranges::equal_to>
1054 requires indirectly_copyable<I, O> &&
1055 (forward_iterator<I> ||
1056 (input_iterator<O> && same_as<iter_value_t<I>, iter_value_t<O>>) ||
1057 indirectly_copyable_storable<I, O>)
1058 constexpr unique_copy_result<I, O>
Mark de Weverde6827b2023-02-24 20:35:411059 unique_copy(I first, S last, O result, C comp = {}, Proj proj = {}); // since C++20
Hui Xie72f57e32022-07-23 00:44:251060
1061 template<input_range R, weakly_incrementable O, class Proj = identity,
1062 indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to>
1063 requires indirectly_copyable<iterator_t<R>, O> &&
1064 (forward_iterator<iterator_t<R>> ||
1065 (input_iterator<O> && same_as<range_value_t<R>, iter_value_t<O>>) ||
1066 indirectly_copyable_storable<iterator_t<R>, O>)
1067 constexpr unique_copy_result<borrowed_iterator_t<R>, O>
Mark de Weverde6827b2023-02-24 20:35:411068 unique_copy(R&& r, O result, C comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591069
1070 template<class I, class O>
Mark de Weverde6827b2023-02-24 20:35:411071 using remove_copy_result = in_out_result<I, O>; // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591072
1073 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class T,
1074 class Proj = identity>
1075 indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
1076 constexpr remove_copy_result<I, O>
Mark de Weverde6827b2023-02-24 20:35:411077 remove_copy(I first, S last, O result, const T& value, Proj proj = {}); // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591078
1079 template<input_range R, weakly_incrementable O, class T, class Proj = identity>
1080 requires indirectly_copyable<iterator_t<R>, O> &&
1081 indirect_binary_predicate<ranges::equal_to,
1082 projected<iterator_t<R>, Proj>, const T*>
1083 constexpr remove_copy_result<borrowed_iterator_t<R>, O>
Mark de Weverde6827b2023-02-24 20:35:411084 remove_copy(R&& r, O result, const T& value, Proj proj = {}); // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591085
1086 template<class I, class O>
Mark de Weverde6827b2023-02-24 20:35:411087 using remove_copy_if_result = in_out_result<I, O>; // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591088
1089 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O,
1090 class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
1091 requires indirectly_copyable<I, O>
1092 constexpr remove_copy_if_result<I, O>
Mark de Weverde6827b2023-02-24 20:35:411093 remove_copy_if(I first, S last, O result, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591094
1095 template<input_range R, weakly_incrementable O, class Proj = identity,
1096 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
1097 requires indirectly_copyable<iterator_t<R>, O>
1098 constexpr remove_copy_if_result<borrowed_iterator_t<R>, O>
Mark de Weverde6827b2023-02-24 20:35:411099 remove_copy_if(R&& r, O result, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591100
Nikolas Klauser93172c12022-08-03 05:25:001101 template<class I, class O>
Mark de Weverde6827b2023-02-24 20:35:411102 using replace_copy_result = in_out_result<I, O>; // since C++20
Nikolas Klauser93172c12022-08-03 05:25:001103
1104 template<input_iterator I, sentinel_for<I> S, class T1, class T2,
1105 output_iterator<const T2&> O, class Proj = identity>
1106 requires indirectly_copyable<I, O> &&
1107 indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*>
1108 constexpr replace_copy_result<I, O>
1109 replace_copy(I first, S last, O result, const T1& old_value, const T2& new_value,
Mark de Weverde6827b2023-02-24 20:35:411110 Proj proj = {}); // since C++20
Nikolas Klauser93172c12022-08-03 05:25:001111
1112 template<input_range R, class T1, class T2, output_iterator<const T2&> O,
1113 class Proj = identity>
1114 requires indirectly_copyable<iterator_t<R>, O> &&
1115 indirect_binary_predicate<ranges::equal_to,
1116 projected<iterator_t<R>, Proj>, const T1*>
1117 constexpr replace_copy_result<borrowed_iterator_t<R>, O>
1118 replace_copy(R&& r, O result, const T1& old_value, const T2& new_value,
Mark de Weverde6827b2023-02-24 20:35:411119 Proj proj = {}); // since C++20
Nikolas Klauser93172c12022-08-03 05:25:001120
1121 template<class I, class O>
Mark de Weverde6827b2023-02-24 20:35:411122 using replace_copy_if_result = in_out_result<I, O>; // since C++20
Nikolas Klauser93172c12022-08-03 05:25:001123
1124 template<input_iterator I, sentinel_for<I> S, class T, output_iterator<const T&> O,
1125 class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
1126 requires indirectly_copyable<I, O>
1127 constexpr replace_copy_if_result<I, O>
1128 replace_copy_if(I first, S last, O result, Pred pred, const T& new_value,
Mark de Weverde6827b2023-02-24 20:35:411129 Proj proj = {}); // since C++20
Nikolas Klauser93172c12022-08-03 05:25:001130
1131 template<input_range R, class T, output_iterator<const T&> O, class Proj = identity,
1132 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
1133 requires indirectly_copyable<iterator_t<R>, O>
1134 constexpr replace_copy_if_result<borrowed_iterator_t<R>, O>
1135 replace_copy_if(R&& r, O result, Pred pred, const T& new_value,
Mark de Weverde6827b2023-02-24 20:35:411136 Proj proj = {}); // since C++20
Nikolas Klauser93172c12022-08-03 05:25:001137
Nikolas Klauser68264b62022-08-03 05:40:131138 template<class I>
Mark de Weverde6827b2023-02-24 20:35:411139 using prev_permutation_result = in_found_result<I>; // since C++20
Nikolas Klauser68264b62022-08-03 05:40:131140
1141 template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
1142 class Proj = identity>
1143 requires sortable<I, Comp, Proj>
1144 constexpr ranges::prev_permutation_result<I>
Mark de Weverde6827b2023-02-24 20:35:411145 ranges::prev_permutation(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser68264b62022-08-03 05:40:131146
1147 template<bidirectional_range R, class Comp = ranges::less,
1148 class Proj = identity>
1149 requires sortable<iterator_t<R>, Comp, Proj>
1150 constexpr ranges::prev_permutation_result<borrowed_iterator_t<R>>
Mark de Weverde6827b2023-02-24 20:35:411151 ranges::prev_permutation(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser68264b62022-08-03 05:40:131152
1153 template<class I>
Mark de Weverde6827b2023-02-24 20:35:411154 using next_permutation_result = in_found_result<I>; // since C++20
Nikolas Klauser68264b62022-08-03 05:40:131155
1156 template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
1157 class Proj = identity>
1158 requires sortable<I, Comp, Proj>
1159 constexpr ranges::next_permutation_result<I>
Mark de Weverde6827b2023-02-24 20:35:411160 ranges::next_permutation(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser68264b62022-08-03 05:40:131161
1162 template<bidirectional_range R, class Comp = ranges::less,
1163 class Proj = identity>
1164 requires sortable<iterator_t<R>, Comp, Proj>
1165 constexpr ranges::next_permutation_result<borrowed_iterator_t<R>>
Mark de Weverde6827b2023-02-24 20:35:411166 ranges::next_permutation(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser68264b62022-08-03 05:40:131167
Nikolas Klauserd3729bb2022-01-14 01:55:511168}
1169
Nikolas Klauser68264b62022-08-03 05:40:131170template <class InputIterator, class Predicate>
A. Jiangba9aeed2025-03-06 17:27:481171 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161172 all_of(InputIterator first, InputIterator last, Predicate pred);
1173
1174template <class InputIterator, class Predicate>
A. Jiangba9aeed2025-03-06 17:27:481175 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161176 any_of(InputIterator first, InputIterator last, Predicate pred);
1177
1178template <class InputIterator, class Predicate>
A. Jiangba9aeed2025-03-06 17:27:481179 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161180 none_of(InputIterator first, InputIterator last, Predicate pred);
1181
1182template <class InputIterator, class Function>
A. Jiangba9aeed2025-03-06 17:27:481183 constexpr Function // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161184 for_each(InputIterator first, InputIterator last, Function f);
1185
Marshall Clowd5c65ff2017-05-25 02:29:541186template<class InputIterator, class Size, class Function>
A. Jiangba9aeed2025-03-06 17:27:481187 constexpr InputIterator // constexpr since C++20
Marshall Clow1b9a4ff2018-01-22 20:44:331188 for_each_n(InputIterator first, Size n, Function f); // C++17
Marshall Clowd5c65ff2017-05-25 02:29:541189
Howard Hinnant3e519522010-05-11 19:42:161190template <class InputIterator, class T>
A. Jiangba9aeed2025-03-06 17:27:481191 constexpr InputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161192 find(InputIterator first, InputIterator last, const T& value);
1193
1194template <class InputIterator, class Predicate>
A. Jiangba9aeed2025-03-06 17:27:481195 constexpr InputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161196 find_if(InputIterator first, InputIterator last, Predicate pred);
1197
1198template<class InputIterator, class Predicate>
A. Jiangba9aeed2025-03-06 17:27:481199 constexpr InputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161200 find_if_not(InputIterator first, InputIterator last, Predicate pred);
1201
1202template <class ForwardIterator1, class ForwardIterator2>
A. Jiangba9aeed2025-03-06 17:27:481203 constexpr ForwardIterator1 // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161204 find_end(ForwardIterator1 first1, ForwardIterator1 last1,
1205 ForwardIterator2 first2, ForwardIterator2 last2);
1206
1207template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
A. Jiangba9aeed2025-03-06 17:27:481208 constexpr ForwardIterator1 // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161209 find_end(ForwardIterator1 first1, ForwardIterator1 last1,
1210 ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
1211
1212template <class ForwardIterator1, class ForwardIterator2>
A. Jiangba9aeed2025-03-06 17:27:481213 constexpr ForwardIterator1 // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161214 find_first_of(ForwardIterator1 first1, ForwardIterator1 last1,
1215 ForwardIterator2 first2, ForwardIterator2 last2);
1216
1217template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
A. Jiangba9aeed2025-03-06 17:27:481218 constexpr ForwardIterator1 // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161219 find_first_of(ForwardIterator1 first1, ForwardIterator1 last1,
1220 ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
1221
1222template <class ForwardIterator>
A. Jiangba9aeed2025-03-06 17:27:481223 constexpr ForwardIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161224 adjacent_find(ForwardIterator first, ForwardIterator last);
1225
1226template <class ForwardIterator, class BinaryPredicate>
A. Jiangba9aeed2025-03-06 17:27:481227 constexpr ForwardIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161228 adjacent_find(ForwardIterator first, ForwardIterator last, BinaryPredicate pred);
1229
1230template <class InputIterator, class T>
A. Jiangba9aeed2025-03-06 17:27:481231 constexpr typename iterator_traits<InputIterator>::difference_type // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161232 count(InputIterator first, InputIterator last, const T& value);
1233
1234template <class InputIterator, class Predicate>
A. Jiangba9aeed2025-03-06 17:27:481235 constexpr typename iterator_traits<InputIterator>::difference_type // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161236 count_if(InputIterator first, InputIterator last, Predicate pred);
1237
1238template <class InputIterator1, class InputIterator2>
A. Jiangba9aeed2025-03-06 17:27:481239 constexpr pair<InputIterator1, InputIterator2> // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161240 mismatch(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2);
1241
Marshall Clow0b0bbd22013-05-09 21:14:231242template <class InputIterator1, class InputIterator2>
Louis Dionne5366bf52024-10-01 16:59:361243 constexpr pair<InputIterator1, InputIterator2>
Aditya Kumar331fb802016-08-25 11:52:381244 mismatch(InputIterator1 first1, InputIterator1 last1,
A. Jiangba9aeed2025-03-06 17:27:481245 InputIterator2 first2, InputIterator2 last2); // since C++14, constexpr since C++20
Marshall Clow0b0bbd22013-05-09 21:14:231246
Howard Hinnant3e519522010-05-11 19:42:161247template <class InputIterator1, class InputIterator2, class BinaryPredicate>
A. Jiangba9aeed2025-03-06 17:27:481248 constexpr pair<InputIterator1, InputIterator2> // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161249 mismatch(InputIterator1 first1, InputIterator1 last1,
1250 InputIterator2 first2, BinaryPredicate pred);
1251
Marshall Clow0b0bbd22013-05-09 21:14:231252template <class InputIterator1, class InputIterator2, class BinaryPredicate>
Louis Dionne5366bf52024-10-01 16:59:361253 constexpr pair<InputIterator1, InputIterator2>
Marshall Clow0b0bbd22013-05-09 21:14:231254 mismatch(InputIterator1 first1, InputIterator1 last1,
1255 InputIterator2 first2, InputIterator2 last2,
A. Jiangba9aeed2025-03-06 17:27:481256 BinaryPredicate pred); // since C++14, constexpr since C++20
Marshall Clow0b0bbd22013-05-09 21:14:231257
Howard Hinnant3e519522010-05-11 19:42:161258template <class InputIterator1, class InputIterator2>
A. Jiangba9aeed2025-03-06 17:27:481259 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161260 equal(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2);
1261
Marshall Clow0b0bbd22013-05-09 21:14:231262template <class InputIterator1, class InputIterator2>
Louis Dionne5366bf52024-10-01 16:59:361263 constexpr bool
Aditya Kumar331fb802016-08-25 11:52:381264 equal(InputIterator1 first1, InputIterator1 last1,
A. Jiangba9aeed2025-03-06 17:27:481265 InputIterator2 first2, InputIterator2 last2); // since C++14, constexpr since C++20
Marshall Clow0b0bbd22013-05-09 21:14:231266
Howard Hinnant3e519522010-05-11 19:42:161267template <class InputIterator1, class InputIterator2, class BinaryPredicate>
A. Jiangba9aeed2025-03-06 17:27:481268 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161269 equal(InputIterator1 first1, InputIterator1 last1,
1270 InputIterator2 first2, BinaryPredicate pred);
1271
Marshall Clow0b0bbd22013-05-09 21:14:231272template <class InputIterator1, class InputIterator2, class BinaryPredicate>
Louis Dionne5366bf52024-10-01 16:59:361273 constexpr bool
Marshall Clow0b0bbd22013-05-09 21:14:231274 equal(InputIterator1 first1, InputIterator1 last1,
1275 InputIterator2 first2, InputIterator2 last2,
A. Jiangba9aeed2025-03-06 17:27:481276 BinaryPredicate pred); // since C++14, constexpr since C++20
Marshall Clow0b0bbd22013-05-09 21:14:231277
Howard Hinnant3e519522010-05-11 19:42:161278template<class ForwardIterator1, class ForwardIterator2>
A. Jiangba9aeed2025-03-06 17:27:481279 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161280 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
1281 ForwardIterator2 first2);
1282
Marshall Clow0b0bbd22013-05-09 21:14:231283template<class ForwardIterator1, class ForwardIterator2>
Louis Dionne5366bf52024-10-01 16:59:361284 constexpr bool
Marshall Clow0b0bbd22013-05-09 21:14:231285 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
A. Jiangba9aeed2025-03-06 17:27:481286 ForwardIterator2 first2, ForwardIterator2 last2); // since C++14, constexpr since C++20
Marshall Clow0b0bbd22013-05-09 21:14:231287
Howard Hinnant3e519522010-05-11 19:42:161288template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
A. Jiangba9aeed2025-03-06 17:27:481289 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161290 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
1291 ForwardIterator2 first2, BinaryPredicate pred);
1292
Marshall Clow0b0bbd22013-05-09 21:14:231293template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
Louis Dionne5366bf52024-10-01 16:59:361294 constexpr bool
Marshall Clow0b0bbd22013-05-09 21:14:231295 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
1296 ForwardIterator2 first2, ForwardIterator2 last2,
A. Jiangba9aeed2025-03-06 17:27:481297 BinaryPredicate pred); // since C++14, constexpr since C++20
Marshall Clow0b0bbd22013-05-09 21:14:231298
Howard Hinnant3e519522010-05-11 19:42:161299template <class ForwardIterator1, class ForwardIterator2>
A. Jiangba9aeed2025-03-06 17:27:481300 constexpr ForwardIterator1 // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161301 search(ForwardIterator1 first1, ForwardIterator1 last1,
1302 ForwardIterator2 first2, ForwardIterator2 last2);
1303
1304template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
A. Jiangba9aeed2025-03-06 17:27:481305 constexpr ForwardIterator1 // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161306 search(ForwardIterator1 first1, ForwardIterator1 last1,
1307 ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
1308
1309template <class ForwardIterator, class Size, class T>
A. Jiangba9aeed2025-03-06 17:27:481310 constexpr ForwardIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161311 search_n(ForwardIterator first, ForwardIterator last, Size count, const T& value);
1312
1313template <class ForwardIterator, class Size, class T, class BinaryPredicate>
A. Jiangba9aeed2025-03-06 17:27:481314 constexpr ForwardIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161315 search_n(ForwardIterator first, ForwardIterator last,
1316 Size count, const T& value, BinaryPredicate pred);
1317
1318template <class InputIterator, class OutputIterator>
A. Jiangba9aeed2025-03-06 17:27:481319 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161320 copy(InputIterator first, InputIterator last, OutputIterator result);
1321
1322template<class InputIterator, class OutputIterator, class Predicate>
A. Jiangba9aeed2025-03-06 17:27:481323 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161324 copy_if(InputIterator first, InputIterator last,
1325 OutputIterator result, Predicate pred);
1326
1327template<class InputIterator, class Size, class OutputIterator>
A. Jiangba9aeed2025-03-06 17:27:481328 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161329 copy_n(InputIterator first, Size n, OutputIterator result);
1330
1331template <class BidirectionalIterator1, class BidirectionalIterator2>
A. Jiangba9aeed2025-03-06 17:27:481332 constexpr BidirectionalIterator2 // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161333 copy_backward(BidirectionalIterator1 first, BidirectionalIterator1 last,
1334 BidirectionalIterator2 result);
1335
Konstantin Varlamov79a2b4b2022-06-28 18:59:591336// [alg.move], move
1337template<class InputIterator, class OutputIterator>
1338 constexpr OutputIterator move(InputIterator first, InputIterator last,
1339 OutputIterator result);
1340
1341template<class BidirectionalIterator1, class BidirectionalIterator2>
1342 constexpr BidirectionalIterator2
1343 move_backward(BidirectionalIterator1 first, BidirectionalIterator1 last,
1344 BidirectionalIterator2 result);
1345
Howard Hinnant3e519522010-05-11 19:42:161346template <class ForwardIterator1, class ForwardIterator2>
A. Jiangba9aeed2025-03-06 17:27:481347 constexpr ForwardIterator2 // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161348 swap_ranges(ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2);
1349
Konstantin Varlamov79a2b4b2022-06-28 18:59:591350namespace ranges {
1351 template<class I1, class I2>
1352 using swap_ranges_result = in_in_result<I1, I2>;
1353
Nikolas Klauser9d905312022-02-10 12:33:031354template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2>
1355 requires indirectly_swappable<I1, I2>
1356 constexpr ranges::swap_ranges_result<I1, I2>
Konstantin Varlamov79a2b4b2022-06-28 18:59:591357 swap_ranges(I1 first1, S1 last1, I2 first2, S2 last2);
Nikolas Klauser9d905312022-02-10 12:33:031358
1359template<input_range R1, input_range R2>
1360 requires indirectly_swappable<iterator_t<R1>, iterator_t<R2>>
1361 constexpr ranges::swap_ranges_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
Konstantin Varlamov79a2b4b2022-06-28 18:59:591362 swap_ranges(R1&& r1, R2&& r2);
1363}
Nikolas Klauser9d905312022-02-10 12:33:031364
Howard Hinnant3e519522010-05-11 19:42:161365template <class ForwardIterator1, class ForwardIterator2>
A. Jiangba9aeed2025-03-06 17:27:481366 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161367 iter_swap(ForwardIterator1 a, ForwardIterator2 b);
1368
1369template <class InputIterator, class OutputIterator, class UnaryOperation>
A. Jiangba9aeed2025-03-06 17:27:481370 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161371 transform(InputIterator first, InputIterator last, OutputIterator result, UnaryOperation op);
1372
1373template <class InputIterator1, class InputIterator2, class OutputIterator, class BinaryOperation>
A. Jiangba9aeed2025-03-06 17:27:481374 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161375 transform(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2,
1376 OutputIterator result, BinaryOperation binary_op);
1377
1378template <class ForwardIterator, class T>
A. Jiangba9aeed2025-03-06 17:27:481379 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161380 replace(ForwardIterator first, ForwardIterator last, const T& old_value, const T& new_value);
1381
1382template <class ForwardIterator, class Predicate, class T>
A. Jiangba9aeed2025-03-06 17:27:481383 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161384 replace_if(ForwardIterator first, ForwardIterator last, Predicate pred, const T& new_value);
1385
1386template <class InputIterator, class OutputIterator, class T>
A. Jiangba9aeed2025-03-06 17:27:481387 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161388 replace_copy(InputIterator first, InputIterator last, OutputIterator result,
1389 const T& old_value, const T& new_value);
1390
1391template <class InputIterator, class OutputIterator, class Predicate, class T>
A. Jiangba9aeed2025-03-06 17:27:481392 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161393 replace_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred, const T& new_value);
1394
1395template <class ForwardIterator, class T>
A. Jiangba9aeed2025-03-06 17:27:481396 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161397 fill(ForwardIterator first, ForwardIterator last, const T& value);
1398
1399template <class OutputIterator, class Size, class T>
A. Jiangba9aeed2025-03-06 17:27:481400 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161401 fill_n(OutputIterator first, Size n, const T& value);
1402
1403template <class ForwardIterator, class Generator>
A. Jiangba9aeed2025-03-06 17:27:481404 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161405 generate(ForwardIterator first, ForwardIterator last, Generator gen);
1406
1407template <class OutputIterator, class Size, class Generator>
A. Jiangba9aeed2025-03-06 17:27:481408 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161409 generate_n(OutputIterator first, Size n, Generator gen);
1410
1411template <class ForwardIterator, class T>
A. Jiangba9aeed2025-03-06 17:27:481412 constexpr ForwardIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161413 remove(ForwardIterator first, ForwardIterator last, const T& value);
1414
1415template <class ForwardIterator, class Predicate>
A. Jiangba9aeed2025-03-06 17:27:481416 constexpr ForwardIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161417 remove_if(ForwardIterator first, ForwardIterator last, Predicate pred);
1418
1419template <class InputIterator, class OutputIterator, class T>
A. Jiangba9aeed2025-03-06 17:27:481420 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161421 remove_copy(InputIterator first, InputIterator last, OutputIterator result, const T& value);
1422
1423template <class InputIterator, class OutputIterator, class Predicate>
A. Jiangba9aeed2025-03-06 17:27:481424 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161425 remove_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred);
1426
1427template <class ForwardIterator>
A. Jiangba9aeed2025-03-06 17:27:481428 constexpr ForwardIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161429 unique(ForwardIterator first, ForwardIterator last);
1430
1431template <class ForwardIterator, class BinaryPredicate>
A. Jiangba9aeed2025-03-06 17:27:481432 constexpr ForwardIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161433 unique(ForwardIterator first, ForwardIterator last, BinaryPredicate pred);
1434
1435template <class InputIterator, class OutputIterator>
A. Jiangba9aeed2025-03-06 17:27:481436 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161437 unique_copy(InputIterator first, InputIterator last, OutputIterator result);
1438
1439template <class InputIterator, class OutputIterator, class BinaryPredicate>
A. Jiangba9aeed2025-03-06 17:27:481440 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161441 unique_copy(InputIterator first, InputIterator last, OutputIterator result, BinaryPredicate pred);
1442
1443template <class BidirectionalIterator>
A. Jiangba9aeed2025-03-06 17:27:481444 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161445 reverse(BidirectionalIterator first, BidirectionalIterator last);
1446
1447template <class BidirectionalIterator, class OutputIterator>
A. Jiangba9aeed2025-03-06 17:27:481448 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161449 reverse_copy(BidirectionalIterator first, BidirectionalIterator last, OutputIterator result);
1450
1451template <class ForwardIterator>
A. Jiangba9aeed2025-03-06 17:27:481452 constexpr ForwardIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161453 rotate(ForwardIterator first, ForwardIterator middle, ForwardIterator last);
1454
1455template <class ForwardIterator, class OutputIterator>
A. Jiangba9aeed2025-03-06 17:27:481456 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161457 rotate_copy(ForwardIterator first, ForwardIterator middle, ForwardIterator last, OutputIterator result);
1458
1459template <class RandomAccessIterator>
1460 void
Marshall Clow0f37a412017-03-23 13:43:371461 random_shuffle(RandomAccessIterator first, RandomAccessIterator last); // deprecated in C++14, removed in C++17
Howard Hinnant3e519522010-05-11 19:42:161462
1463template <class RandomAccessIterator, class RandomNumberGenerator>
1464 void
Marshall Clow06965c12014-03-03 06:14:191465 random_shuffle(RandomAccessIterator first, RandomAccessIterator last,
Marshall Clow0f37a412017-03-23 13:43:371466 RandomNumberGenerator& rand); // deprecated in C++14, removed in C++17
Howard Hinnant3e519522010-05-11 19:42:161467
Eric Fiseliere7154702016-08-28 22:14:371468template<class PopulationIterator, class SampleIterator,
1469 class Distance, class UniformRandomBitGenerator>
1470 SampleIterator sample(PopulationIterator first, PopulationIterator last,
1471 SampleIterator out, Distance n,
1472 UniformRandomBitGenerator&& g); // C++17
1473
Howard Hinnantf9d540b2010-05-26 17:49:341474template<class RandomAccessIterator, class UniformRandomNumberGenerator>
1475 void shuffle(RandomAccessIterator first, RandomAccessIterator last,
Howard Hinnantfb340102010-11-18 01:47:021476 UniformRandomNumberGenerator&& g);
Howard Hinnantf9d540b2010-05-26 17:49:341477
Arthur O'Dwyer3fbd3ea2020-12-26 06:39:031478template<class ForwardIterator>
1479 constexpr ForwardIterator
1480 shift_left(ForwardIterator first, ForwardIterator last,
1481 typename iterator_traits<ForwardIterator>::difference_type n); // C++20
1482
1483template<class ForwardIterator>
1484 constexpr ForwardIterator
1485 shift_right(ForwardIterator first, ForwardIterator last,
1486 typename iterator_traits<ForwardIterator>::difference_type n); // C++20
1487
Howard Hinnant3e519522010-05-11 19:42:161488template <class InputIterator, class Predicate>
A. Jiangba9aeed2025-03-06 17:27:481489 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161490 is_partitioned(InputIterator first, InputIterator last, Predicate pred);
1491
1492template <class ForwardIterator, class Predicate>
A. Jiangba9aeed2025-03-06 17:27:481493 constexpr ForwardIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161494 partition(ForwardIterator first, ForwardIterator last, Predicate pred);
1495
1496template <class InputIterator, class OutputIterator1,
1497 class OutputIterator2, class Predicate>
A. Jiangba9aeed2025-03-06 17:27:481498 constexpr pair<OutputIterator1, OutputIterator2> // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161499 partition_copy(InputIterator first, InputIterator last,
1500 OutputIterator1 out_true, OutputIterator2 out_false,
1501 Predicate pred);
1502
1503template <class ForwardIterator, class Predicate>
A. Jiangba9aeed2025-03-06 17:27:481504 constexpr ForwardIterator // constexpr since C++26
Howard Hinnant3e519522010-05-11 19:42:161505 stable_partition(ForwardIterator first, ForwardIterator last, Predicate pred);
1506
1507template<class ForwardIterator, class Predicate>
A. Jiangba9aeed2025-03-06 17:27:481508 constexpr ForwardIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161509 partition_point(ForwardIterator first, ForwardIterator last, Predicate pred);
1510
1511template <class ForwardIterator>
A. Jiangba9aeed2025-03-06 17:27:481512 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161513 is_sorted(ForwardIterator first, ForwardIterator last);
1514
1515template <class ForwardIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481516 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161517 is_sorted(ForwardIterator first, ForwardIterator last, Compare comp);
1518
1519template<class ForwardIterator>
A. Jiangba9aeed2025-03-06 17:27:481520 constexpr ForwardIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161521 is_sorted_until(ForwardIterator first, ForwardIterator last);
1522
1523template <class ForwardIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481524 constexpr ForwardIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161525 is_sorted_until(ForwardIterator first, ForwardIterator last, Compare comp);
1526
1527template <class RandomAccessIterator>
A. Jiangba9aeed2025-03-06 17:27:481528 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161529 sort(RandomAccessIterator first, RandomAccessIterator last);
1530
1531template <class RandomAccessIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481532 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161533 sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1534
1535template <class RandomAccessIterator>
A. Jiangba9aeed2025-03-06 17:27:481536 constexpr void // constexpr since C++26
Howard Hinnant3e519522010-05-11 19:42:161537 stable_sort(RandomAccessIterator first, RandomAccessIterator last);
1538
1539template <class RandomAccessIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481540 constexpr void // constexpr since C++26
Howard Hinnant3e519522010-05-11 19:42:161541 stable_sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1542
1543template <class RandomAccessIterator>
A. Jiangba9aeed2025-03-06 17:27:481544 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161545 partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last);
1546
1547template <class RandomAccessIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481548 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161549 partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last, Compare comp);
1550
1551template <class InputIterator, class RandomAccessIterator>
A. Jiangba9aeed2025-03-06 17:27:481552 constexpr RandomAccessIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161553 partial_sort_copy(InputIterator first, InputIterator last,
1554 RandomAccessIterator result_first, RandomAccessIterator result_last);
1555
1556template <class InputIterator, class RandomAccessIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481557 constexpr RandomAccessIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161558 partial_sort_copy(InputIterator first, InputIterator last,
1559 RandomAccessIterator result_first, RandomAccessIterator result_last, Compare comp);
1560
1561template <class RandomAccessIterator>
A. Jiangba9aeed2025-03-06 17:27:481562 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161563 nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last);
1564
1565template <class RandomAccessIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481566 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161567 nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last, Compare comp);
1568
1569template <class ForwardIterator, class T>
A. Jiangba9aeed2025-03-06 17:27:481570 constexpr ForwardIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161571 lower_bound(ForwardIterator first, ForwardIterator last, const T& value);
1572
1573template <class ForwardIterator, class T, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481574 constexpr ForwardIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161575 lower_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
1576
1577template <class ForwardIterator, class T>
A. Jiangba9aeed2025-03-06 17:27:481578 constexpr ForwardIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161579 upper_bound(ForwardIterator first, ForwardIterator last, const T& value);
1580
1581template <class ForwardIterator, class T, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481582 constexpr ForwardIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161583 upper_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
1584
1585template <class ForwardIterator, class T>
A. Jiangba9aeed2025-03-06 17:27:481586 constexpr pair<ForwardIterator, ForwardIterator> // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161587 equal_range(ForwardIterator first, ForwardIterator last, const T& value);
1588
1589template <class ForwardIterator, class T, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481590 constexpr pair<ForwardIterator, ForwardIterator> // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161591 equal_range(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
1592
1593template <class ForwardIterator, class T>
A. Jiangba9aeed2025-03-06 17:27:481594 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161595 binary_search(ForwardIterator first, ForwardIterator last, const T& value);
1596
1597template <class ForwardIterator, class T, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481598 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161599 binary_search(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
1600
1601template <class InputIterator1, class InputIterator2, class OutputIterator>
A. Jiangba9aeed2025-03-06 17:27:481602 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161603 merge(InputIterator1 first1, InputIterator1 last1,
1604 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1605
1606template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481607 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161608 merge(InputIterator1 first1, InputIterator1 last1,
1609 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1610
1611template <class BidirectionalIterator>
1612 void
1613 inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last);
1614
1615template <class BidirectionalIterator, class Compare>
1616 void
1617 inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last, Compare comp);
1618
1619template <class InputIterator1, class InputIterator2>
A. Jiangba9aeed2025-03-06 17:27:481620 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161621 includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2);
1622
1623template <class InputIterator1, class InputIterator2, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481624 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161625 includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, Compare comp);
1626
1627template <class InputIterator1, class InputIterator2, class OutputIterator>
A. Jiangba9aeed2025-03-06 17:27:481628 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161629 set_union(InputIterator1 first1, InputIterator1 last1,
1630 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1631
1632template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481633 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161634 set_union(InputIterator1 first1, InputIterator1 last1,
1635 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1636
1637template <class InputIterator1, class InputIterator2, class OutputIterator>
A. Jiangba9aeed2025-03-06 17:27:481638 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161639 set_intersection(InputIterator1 first1, InputIterator1 last1,
1640 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1641
1642template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481643 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161644 set_intersection(InputIterator1 first1, InputIterator1 last1,
1645 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1646
1647template <class InputIterator1, class InputIterator2, class OutputIterator>
A. Jiangba9aeed2025-03-06 17:27:481648 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161649 set_difference(InputIterator1 first1, InputIterator1 last1,
1650 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1651
1652template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481653 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161654 set_difference(InputIterator1 first1, InputIterator1 last1,
1655 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1656
1657template <class InputIterator1, class InputIterator2, class OutputIterator>
A. Jiangba9aeed2025-03-06 17:27:481658 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161659 set_symmetric_difference(InputIterator1 first1, InputIterator1 last1,
1660 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1661
1662template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481663 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161664 set_symmetric_difference(InputIterator1 first1, InputIterator1 last1,
1665 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1666
1667template <class RandomAccessIterator>
A. Jiangba9aeed2025-03-06 17:27:481668 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161669 push_heap(RandomAccessIterator first, RandomAccessIterator last);
1670
1671template <class RandomAccessIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481672 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161673 push_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1674
1675template <class RandomAccessIterator>
A. Jiangba9aeed2025-03-06 17:27:481676 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161677 pop_heap(RandomAccessIterator first, RandomAccessIterator last);
1678
1679template <class RandomAccessIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481680 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161681 pop_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1682
1683template <class RandomAccessIterator>
A. Jiangba9aeed2025-03-06 17:27:481684 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161685 make_heap(RandomAccessIterator first, RandomAccessIterator last);
1686
1687template <class RandomAccessIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481688 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161689 make_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1690
1691template <class RandomAccessIterator>
A. Jiangba9aeed2025-03-06 17:27:481692 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161693 sort_heap(RandomAccessIterator first, RandomAccessIterator last);
1694
1695template <class RandomAccessIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481696 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161697 sort_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1698
Howard Hinnantb3371f62010-08-22 00:02:431699template <class RandomAccessIterator>
A. Jiangba9aeed2025-03-06 17:27:481700 constexpr bool // constexpr since C++20
Howard Hinnantb3371f62010-08-22 00:02:431701 is_heap(RandomAccessIterator first, RandomAccessiterator last);
Howard Hinnant3e519522010-05-11 19:42:161702
Howard Hinnantb3371f62010-08-22 00:02:431703template <class RandomAccessIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481704 constexpr bool // constexpr since C++20
Howard Hinnantb3371f62010-08-22 00:02:431705 is_heap(RandomAccessIterator first, RandomAccessiterator last, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161706
Howard Hinnantb3371f62010-08-22 00:02:431707template <class RandomAccessIterator>
A. Jiangba9aeed2025-03-06 17:27:481708 constexpr RandomAccessIterator // constexpr since C++20
Howard Hinnantb3371f62010-08-22 00:02:431709 is_heap_until(RandomAccessIterator first, RandomAccessiterator last);
Howard Hinnant3e519522010-05-11 19:42:161710
Howard Hinnantb3371f62010-08-22 00:02:431711template <class RandomAccessIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481712 constexpr RandomAccessIterator // constexpr since C++20
Howard Hinnantb3371f62010-08-22 00:02:431713 is_heap_until(RandomAccessIterator first, RandomAccessiterator last, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161714
Howard Hinnant4eb27b72010-08-21 20:10:011715template <class ForwardIterator>
A. Jiangba9aeed2025-03-06 17:27:481716 constexpr ForwardIterator // constexpr since C++14
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181717 min_element(ForwardIterator first, ForwardIterator last);
Howard Hinnant4eb27b72010-08-21 20:10:011718
1719template <class ForwardIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481720 constexpr ForwardIterator // constexpr since C++14
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181721 min_element(ForwardIterator first, ForwardIterator last, Compare comp);
Howard Hinnant4eb27b72010-08-21 20:10:011722
Howard Hinnant3e519522010-05-11 19:42:161723template <class T>
A. Jiangba9aeed2025-03-06 17:27:481724 constexpr const T& // constexpr since C++14
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181725 min(const T& a, const T& b);
Howard Hinnant3e519522010-05-11 19:42:161726
1727template <class T, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481728 constexpr const T& // constexpr since C++14
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181729 min(const T& a, const T& b, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161730
Howard Hinnant4eb27b72010-08-21 20:10:011731template<class T>
A. Jiangba9aeed2025-03-06 17:27:481732 constexpr T // constexpr since C++14
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181733 min(initializer_list<T> t);
Howard Hinnant4eb27b72010-08-21 20:10:011734
1735template<class T, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481736 constexpr T // constexpr since C++14
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181737 min(initializer_list<T> t, Compare comp);
Howard Hinnant4eb27b72010-08-21 20:10:011738
Marshall Clow146c14a2016-03-07 22:43:491739template<class T>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181740 constexpr const T& clamp(const T& v, const T& lo, const T& hi); // C++17
Marshall Clow146c14a2016-03-07 22:43:491741
1742template<class T, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181743 constexpr const T& clamp(const T& v, const T& lo, const T& hi, Compare comp); // C++17
Marshall Clow146c14a2016-03-07 22:43:491744
Howard Hinnant4eb27b72010-08-21 20:10:011745template <class ForwardIterator>
A. Jiangba9aeed2025-03-06 17:27:481746 constexpr ForwardIterator // constexpr since C++14
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181747 max_element(ForwardIterator first, ForwardIterator last);
Howard Hinnant4eb27b72010-08-21 20:10:011748
1749template <class ForwardIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481750 constexpr ForwardIterator // constexpr since C++14
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181751 max_element(ForwardIterator first, ForwardIterator last, Compare comp);
Howard Hinnant4eb27b72010-08-21 20:10:011752
Howard Hinnant3e519522010-05-11 19:42:161753template <class T>
A. Jiangba9aeed2025-03-06 17:27:481754 constexpr const T& // constexpr since C++14
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181755 max(const T& a, const T& b);
Howard Hinnant3e519522010-05-11 19:42:161756
1757template <class T, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481758 constexpr const T& // constexpr since C++14
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181759 max(const T& a, const T& b, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161760
Howard Hinnant4eb27b72010-08-21 20:10:011761template<class T>
A. Jiangba9aeed2025-03-06 17:27:481762 constexpr T // constexpr since C++14
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181763 max(initializer_list<T> t);
Howard Hinnant3e519522010-05-11 19:42:161764
Howard Hinnant4eb27b72010-08-21 20:10:011765template<class T, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481766 constexpr T // constexpr since C++14
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181767 max(initializer_list<T> t, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161768
Howard Hinnant4eb27b72010-08-21 20:10:011769template<class ForwardIterator>
A. Jiangba9aeed2025-03-06 17:27:481770 constexpr pair<ForwardIterator, ForwardIterator> // constexpr since C++14
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181771 minmax_element(ForwardIterator first, ForwardIterator last);
Howard Hinnant3e519522010-05-11 19:42:161772
Howard Hinnant4eb27b72010-08-21 20:10:011773template<class ForwardIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481774 constexpr pair<ForwardIterator, ForwardIterator> // constexpr since C++14
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181775 minmax_element(ForwardIterator first, ForwardIterator last, Compare comp);
Howard Hinnant4eb27b72010-08-21 20:10:011776
1777template<class T>
A. Jiangba9aeed2025-03-06 17:27:481778 constexpr pair<const T&, const T&> // constexpr since C++14
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181779 minmax(const T& a, const T& b);
Howard Hinnant4eb27b72010-08-21 20:10:011780
1781template<class T, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481782 constexpr pair<const T&, const T&> // constexpr since C++14
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181783 minmax(const T& a, const T& b, Compare comp);
Howard Hinnant4eb27b72010-08-21 20:10:011784
1785template<class T>
A. Jiangba9aeed2025-03-06 17:27:481786 constexpr pair<T, T> // constexpr since C++14
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181787 minmax(initializer_list<T> t);
Howard Hinnant4eb27b72010-08-21 20:10:011788
1789template<class T, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481790 constexpr pair<T, T> // constexpr since C++14
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181791 minmax(initializer_list<T> t, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161792
1793template <class InputIterator1, class InputIterator2>
A. Jiangba9aeed2025-03-06 17:27:481794 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161795 lexicographical_compare(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2);
1796
1797template <class InputIterator1, class InputIterator2, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481798 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161799 lexicographical_compare(InputIterator1 first1, InputIterator1 last1,
1800 InputIterator2 first2, InputIterator2 last2, Compare comp);
1801
Adrian Vogelsgesang2a067572022-08-04 22:21:271802template<class InputIterator1, class InputIterator2, class Cmp>
1803 constexpr auto
1804 lexicographical_compare_three_way(InputIterator1 first1, InputIterator1 last1,
1805 InputIterator2 first2, InputIterator2 last2,
1806 Cmp comp)
1807 -> decltype(comp(*b1, *b2)); // since C++20
1808
1809template<class InputIterator1, class InputIterator2>
1810 constexpr auto
1811 lexicographical_compare_three_way(InputIterator1 first1, InputIterator1 last1,
1812 InputIterator2 first2, InputIterator2 last2); // since C++20
1813
Howard Hinnant3e519522010-05-11 19:42:161814template <class BidirectionalIterator>
A. Jiangba9aeed2025-03-06 17:27:481815 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161816 next_permutation(BidirectionalIterator first, BidirectionalIterator last);
1817
1818template <class BidirectionalIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481819 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161820 next_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp);
1821
1822template <class BidirectionalIterator>
A. Jiangba9aeed2025-03-06 17:27:481823 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161824 prev_permutation(BidirectionalIterator first, BidirectionalIterator last);
1825
1826template <class BidirectionalIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481827 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161828 prev_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161829} // std
1830
1831*/
1832
Nikolas Klauserb9a26582024-12-21 12:01:481833#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
1834# include <__cxx03/algorithm>
1835#else
Nikolas Klauserc166a9c2024-12-10 15:02:121836# include <__config>
Howard Hinnant5d1a7012013-08-14 18:00:201837
Nikolas Klauserc166a9c2024-12-10 15:02:121838# include <__algorithm/adjacent_find.h>
1839# include <__algorithm/all_of.h>
1840# include <__algorithm/any_of.h>
1841# include <__algorithm/binary_search.h>
1842# include <__algorithm/copy.h>
1843# include <__algorithm/copy_backward.h>
1844# include <__algorithm/copy_if.h>
1845# include <__algorithm/copy_n.h>
1846# include <__algorithm/count.h>
1847# include <__algorithm/count_if.h>
1848# include <__algorithm/equal.h>
1849# include <__algorithm/equal_range.h>
1850# include <__algorithm/fill.h>
1851# include <__algorithm/fill_n.h>
1852# include <__algorithm/find.h>
1853# include <__algorithm/find_end.h>
1854# include <__algorithm/find_first_of.h>
1855# include <__algorithm/find_if.h>
1856# include <__algorithm/find_if_not.h>
1857# include <__algorithm/for_each.h>
1858# include <__algorithm/generate.h>
1859# include <__algorithm/generate_n.h>
1860# include <__algorithm/includes.h>
1861# include <__algorithm/inplace_merge.h>
1862# include <__algorithm/is_heap.h>
1863# include <__algorithm/is_heap_until.h>
1864# include <__algorithm/is_partitioned.h>
1865# include <__algorithm/is_permutation.h>
1866# include <__algorithm/is_sorted.h>
1867# include <__algorithm/is_sorted_until.h>
1868# include <__algorithm/iter_swap.h>
1869# include <__algorithm/lexicographical_compare.h>
1870# include <__algorithm/lower_bound.h>
1871# include <__algorithm/make_heap.h>
1872# include <__algorithm/max.h>
1873# include <__algorithm/max_element.h>
1874# include <__algorithm/merge.h>
1875# include <__algorithm/min.h>
1876# include <__algorithm/min_element.h>
1877# include <__algorithm/minmax.h>
1878# include <__algorithm/minmax_element.h>
1879# include <__algorithm/mismatch.h>
1880# include <__algorithm/move.h>
1881# include <__algorithm/move_backward.h>
1882# include <__algorithm/next_permutation.h>
1883# include <__algorithm/none_of.h>
1884# include <__algorithm/nth_element.h>
1885# include <__algorithm/partial_sort.h>
1886# include <__algorithm/partial_sort_copy.h>
1887# include <__algorithm/partition.h>
1888# include <__algorithm/partition_copy.h>
1889# include <__algorithm/partition_point.h>
1890# include <__algorithm/pop_heap.h>
1891# include <__algorithm/prev_permutation.h>
1892# include <__algorithm/push_heap.h>
1893# include <__algorithm/remove.h>
1894# include <__algorithm/remove_copy.h>
1895# include <__algorithm/remove_copy_if.h>
1896# include <__algorithm/remove_if.h>
1897# include <__algorithm/replace.h>
1898# include <__algorithm/replace_copy.h>
1899# include <__algorithm/replace_copy_if.h>
1900# include <__algorithm/replace_if.h>
1901# include <__algorithm/reverse.h>
1902# include <__algorithm/reverse_copy.h>
1903# include <__algorithm/rotate.h>
1904# include <__algorithm/rotate_copy.h>
1905# include <__algorithm/search.h>
1906# include <__algorithm/search_n.h>
1907# include <__algorithm/set_difference.h>
1908# include <__algorithm/set_intersection.h>
1909# include <__algorithm/set_symmetric_difference.h>
1910# include <__algorithm/set_union.h>
1911# include <__algorithm/shuffle.h>
1912# include <__algorithm/sort.h>
1913# include <__algorithm/sort_heap.h>
1914# include <__algorithm/stable_partition.h>
1915# include <__algorithm/stable_sort.h>
1916# include <__algorithm/swap_ranges.h>
1917# include <__algorithm/transform.h>
1918# include <__algorithm/unique.h>
1919# include <__algorithm/unique_copy.h>
1920# include <__algorithm/upper_bound.h>
Eric Fiselierc1bd9192014-08-10 23:53:081921
Nikolas Klauserc166a9c2024-12-10 15:02:121922# if _LIBCPP_STD_VER >= 17
1923# include <__algorithm/clamp.h>
1924# include <__algorithm/for_each_n.h>
1925# include <__algorithm/pstl.h>
1926# include <__algorithm/sample.h>
1927# endif // _LIBCPP_STD_VER >= 17
Nikolas Klauserd5c654b2024-04-14 13:52:561928
Nikolas Klauserc166a9c2024-12-10 15:02:121929# if _LIBCPP_STD_VER >= 20
1930# include <__algorithm/in_found_result.h>
1931# include <__algorithm/in_fun_result.h>
1932# include <__algorithm/in_in_out_result.h>
1933# include <__algorithm/in_in_result.h>
1934# include <__algorithm/in_out_out_result.h>
1935# include <__algorithm/in_out_result.h>
1936# include <__algorithm/lexicographical_compare_three_way.h>
1937# include <__algorithm/min_max_result.h>
1938# include <__algorithm/ranges_adjacent_find.h>
1939# include <__algorithm/ranges_all_of.h>
1940# include <__algorithm/ranges_any_of.h>
1941# include <__algorithm/ranges_binary_search.h>
1942# include <__algorithm/ranges_clamp.h>
1943# include <__algorithm/ranges_contains.h>
1944# include <__algorithm/ranges_copy.h>
1945# include <__algorithm/ranges_copy_backward.h>
1946# include <__algorithm/ranges_copy_if.h>
1947# include <__algorithm/ranges_copy_n.h>
1948# include <__algorithm/ranges_count.h>
1949# include <__algorithm/ranges_count_if.h>
1950# include <__algorithm/ranges_equal.h>
1951# include <__algorithm/ranges_equal_range.h>
1952# include <__algorithm/ranges_fill.h>
1953# include <__algorithm/ranges_fill_n.h>
1954# include <__algorithm/ranges_find.h>
1955# include <__algorithm/ranges_find_end.h>
1956# include <__algorithm/ranges_find_first_of.h>
1957# include <__algorithm/ranges_find_if.h>
1958# include <__algorithm/ranges_find_if_not.h>
1959# include <__algorithm/ranges_for_each.h>
1960# include <__algorithm/ranges_for_each_n.h>
1961# include <__algorithm/ranges_generate.h>
1962# include <__algorithm/ranges_generate_n.h>
1963# include <__algorithm/ranges_includes.h>
1964# include <__algorithm/ranges_inplace_merge.h>
1965# include <__algorithm/ranges_is_heap.h>
1966# include <__algorithm/ranges_is_heap_until.h>
1967# include <__algorithm/ranges_is_partitioned.h>
1968# include <__algorithm/ranges_is_permutation.h>
1969# include <__algorithm/ranges_is_sorted.h>
1970# include <__algorithm/ranges_is_sorted_until.h>
1971# include <__algorithm/ranges_lexicographical_compare.h>
1972# include <__algorithm/ranges_lower_bound.h>
1973# include <__algorithm/ranges_make_heap.h>
1974# include <__algorithm/ranges_max.h>
1975# include <__algorithm/ranges_max_element.h>
1976# include <__algorithm/ranges_merge.h>
1977# include <__algorithm/ranges_min.h>
1978# include <__algorithm/ranges_min_element.h>
1979# include <__algorithm/ranges_minmax.h>
1980# include <__algorithm/ranges_minmax_element.h>
1981# include <__algorithm/ranges_mismatch.h>
1982# include <__algorithm/ranges_move.h>
1983# include <__algorithm/ranges_move_backward.h>
1984# include <__algorithm/ranges_next_permutation.h>
1985# include <__algorithm/ranges_none_of.h>
1986# include <__algorithm/ranges_nth_element.h>
1987# include <__algorithm/ranges_partial_sort.h>
1988# include <__algorithm/ranges_partial_sort_copy.h>
1989# include <__algorithm/ranges_partition.h>
1990# include <__algorithm/ranges_partition_copy.h>
1991# include <__algorithm/ranges_partition_point.h>
1992# include <__algorithm/ranges_pop_heap.h>
1993# include <__algorithm/ranges_prev_permutation.h>
1994# include <__algorithm/ranges_push_heap.h>
1995# include <__algorithm/ranges_remove.h>
1996# include <__algorithm/ranges_remove_copy.h>
1997# include <__algorithm/ranges_remove_copy_if.h>
1998# include <__algorithm/ranges_remove_if.h>
1999# include <__algorithm/ranges_replace.h>
2000# include <__algorithm/ranges_replace_copy.h>
2001# include <__algorithm/ranges_replace_copy_if.h>
2002# include <__algorithm/ranges_replace_if.h>
2003# include <__algorithm/ranges_reverse.h>
2004# include <__algorithm/ranges_reverse_copy.h>
2005# include <__algorithm/ranges_rotate.h>
2006# include <__algorithm/ranges_rotate_copy.h>
2007# include <__algorithm/ranges_sample.h>
2008# include <__algorithm/ranges_search.h>
2009# include <__algorithm/ranges_search_n.h>
2010# include <__algorithm/ranges_set_difference.h>
2011# include <__algorithm/ranges_set_intersection.h>
2012# include <__algorithm/ranges_set_symmetric_difference.h>
2013# include <__algorithm/ranges_set_union.h>
2014# include <__algorithm/ranges_shuffle.h>
2015# include <__algorithm/ranges_sort.h>
2016# include <__algorithm/ranges_sort_heap.h>
2017# include <__algorithm/ranges_stable_partition.h>
2018# include <__algorithm/ranges_stable_sort.h>
2019# include <__algorithm/ranges_swap_ranges.h>
2020# include <__algorithm/ranges_transform.h>
2021# include <__algorithm/ranges_unique.h>
2022# include <__algorithm/ranges_unique_copy.h>
2023# include <__algorithm/ranges_upper_bound.h>
2024# include <__algorithm/shift_left.h>
2025# include <__algorithm/shift_right.h>
2026# endif
Nikolas Klauserd5c654b2024-04-14 13:52:562027
Nikolas Klauserc166a9c2024-12-10 15:02:122028# if _LIBCPP_STD_VER >= 23
2029# include <__algorithm/ranges_contains_subrange.h>
2030# include <__algorithm/ranges_ends_with.h>
2031# include <__algorithm/ranges_find_last.h>
2032# include <__algorithm/ranges_fold.h>
2033# include <__algorithm/ranges_starts_with.h>
2034# endif // _LIBCPP_STD_VER >= 23
Nikolas Klauserd5c654b2024-04-14 13:52:562035
Nikolas Klauserc166a9c2024-12-10 15:02:122036# include <version>
Nikolas Klauserd5c654b2024-04-14 13:52:562037
Nikolas Klauserdb1978b2022-06-16 20:43:462038// standard-mandated includes
Nikolas Klauser473a1602022-09-22 16:05:082039
2040// [algorithm.syn]
Nikolas Klauserc166a9c2024-12-10 15:02:122041# include <initializer_list>
Nikolas Klauserdb1978b2022-06-16 20:43:462042
Nikolas Klauserc166a9c2024-12-10 15:02:122043# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2044# pragma GCC system_header
2045# endif
Howard Hinnant3e519522010-05-11 19:42:162046
Nikolas Klauserc166a9c2024-12-10 15:02:122047# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER == 14
2048# include <execution>
2049# endif
Nikolas Klauserd5c654b2024-04-14 13:52:562050
Nikolas Klauserc166a9c2024-12-10 15:02:122051# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
2052# include <atomic>
2053# include <bit>
2054# include <concepts>
2055# include <cstdlib>
2056# include <cstring>
2057# include <iterator>
2058# include <memory>
2059# include <stdexcept>
2060# include <type_traits>
2061# include <utility>
2062# endif
Nikolas Klauserb9a26582024-12-21 12:01:482063#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
Mark de Wevere31c2a12022-09-02 15:53:282064
Louis Dionne4cd6ca12021-04-20 16:03:322065#endif // _LIBCPP_ALGORITHM