blob: 6ba903ad3ce1e02bfd0470aa8e53e6b0683d0fed [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>
A. Jiang053a7142025-03-19 17:59:321034 constexpr I // constexpr since C++26
1035 inplace_merge(I first, I middle, S last, Comp comp = {}, Proj proj = {}); // since C++20
Hui Xie8a617492022-07-27 12:20:161036
1037 template<bidirectional_range R, class Comp = ranges::less, class Proj = identity>
1038 requires sortable<iterator_t<R>, Comp, Proj>
A. Jiang053a7142025-03-19 17:59:321039 constexpr borrowed_iterator_t<R> // constexpr since C++26
Hui Xie8a617492022-07-27 12:20:161040 inplace_merge(R&& r, iterator_t<R> middle, Comp comp = {},
A. Jiang053a7142025-03-19 17:59:321041 Proj proj = {}); // since C++20
Hui Xie72f57e32022-07-23 00:44:251042
1043 template<permutable I, sentinel_for<I> S, class Proj = identity,
1044 indirect_equivalence_relation<projected<I, Proj>> C = ranges::equal_to>
Mark de Weverde6827b2023-02-24 20:35:411045 constexpr subrange<I> unique(I first, S last, C comp = {}, Proj proj = {}); // since C++20
Hui Xie72f57e32022-07-23 00:44:251046
1047 template<forward_range R, class Proj = identity,
1048 indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to>
1049 requires permutable<iterator_t<R>>
1050 constexpr borrowed_subrange_t<R>
Mark de Weverde6827b2023-02-24 20:35:411051 unique(R&& r, C comp = {}, Proj proj = {}); // since C++20
Hui Xie72f57e32022-07-23 00:44:251052
1053 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Proj = identity,
1054 indirect_equivalence_relation<projected<I, Proj>> C = ranges::equal_to>
1055 requires indirectly_copyable<I, O> &&
1056 (forward_iterator<I> ||
1057 (input_iterator<O> && same_as<iter_value_t<I>, iter_value_t<O>>) ||
1058 indirectly_copyable_storable<I, O>)
1059 constexpr unique_copy_result<I, O>
Mark de Weverde6827b2023-02-24 20:35:411060 unique_copy(I first, S last, O result, C comp = {}, Proj proj = {}); // since C++20
Hui Xie72f57e32022-07-23 00:44:251061
1062 template<input_range R, weakly_incrementable O, class Proj = identity,
1063 indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to>
1064 requires indirectly_copyable<iterator_t<R>, O> &&
1065 (forward_iterator<iterator_t<R>> ||
1066 (input_iterator<O> && same_as<range_value_t<R>, iter_value_t<O>>) ||
1067 indirectly_copyable_storable<iterator_t<R>, O>)
1068 constexpr unique_copy_result<borrowed_iterator_t<R>, O>
Mark de Weverde6827b2023-02-24 20:35:411069 unique_copy(R&& r, O result, C comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591070
1071 template<class I, class O>
Mark de Weverde6827b2023-02-24 20:35:411072 using remove_copy_result = in_out_result<I, O>; // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591073
1074 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class T,
1075 class Proj = identity>
1076 indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
1077 constexpr remove_copy_result<I, O>
Mark de Weverde6827b2023-02-24 20:35:411078 remove_copy(I first, S last, O result, const T& value, Proj proj = {}); // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591079
1080 template<input_range R, weakly_incrementable O, class T, class Proj = identity>
1081 requires indirectly_copyable<iterator_t<R>, O> &&
1082 indirect_binary_predicate<ranges::equal_to,
1083 projected<iterator_t<R>, Proj>, const T*>
1084 constexpr remove_copy_result<borrowed_iterator_t<R>, O>
Mark de Weverde6827b2023-02-24 20:35:411085 remove_copy(R&& r, O result, const T& value, Proj proj = {}); // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591086
1087 template<class I, class O>
Mark de Weverde6827b2023-02-24 20:35:411088 using remove_copy_if_result = in_out_result<I, O>; // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591089
1090 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O,
1091 class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
1092 requires indirectly_copyable<I, O>
1093 constexpr remove_copy_if_result<I, O>
Mark de Weverde6827b2023-02-24 20:35:411094 remove_copy_if(I first, S last, O result, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591095
1096 template<input_range R, weakly_incrementable O, class Proj = identity,
1097 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
1098 requires indirectly_copyable<iterator_t<R>, O>
1099 constexpr remove_copy_if_result<borrowed_iterator_t<R>, O>
Mark de Weverde6827b2023-02-24 20:35:411100 remove_copy_if(R&& r, O result, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591101
Nikolas Klauser93172c12022-08-03 05:25:001102 template<class I, class O>
Mark de Weverde6827b2023-02-24 20:35:411103 using replace_copy_result = in_out_result<I, O>; // since C++20
Nikolas Klauser93172c12022-08-03 05:25:001104
1105 template<input_iterator I, sentinel_for<I> S, class T1, class T2,
1106 output_iterator<const T2&> O, class Proj = identity>
1107 requires indirectly_copyable<I, O> &&
1108 indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*>
1109 constexpr replace_copy_result<I, O>
1110 replace_copy(I first, S last, O result, const T1& old_value, const T2& new_value,
Mark de Weverde6827b2023-02-24 20:35:411111 Proj proj = {}); // since C++20
Nikolas Klauser93172c12022-08-03 05:25:001112
1113 template<input_range R, class T1, class T2, output_iterator<const T2&> O,
1114 class Proj = identity>
1115 requires indirectly_copyable<iterator_t<R>, O> &&
1116 indirect_binary_predicate<ranges::equal_to,
1117 projected<iterator_t<R>, Proj>, const T1*>
1118 constexpr replace_copy_result<borrowed_iterator_t<R>, O>
1119 replace_copy(R&& r, O result, const T1& old_value, const T2& new_value,
Mark de Weverde6827b2023-02-24 20:35:411120 Proj proj = {}); // since C++20
Nikolas Klauser93172c12022-08-03 05:25:001121
1122 template<class I, class O>
Mark de Weverde6827b2023-02-24 20:35:411123 using replace_copy_if_result = in_out_result<I, O>; // since C++20
Nikolas Klauser93172c12022-08-03 05:25:001124
1125 template<input_iterator I, sentinel_for<I> S, class T, output_iterator<const T&> O,
1126 class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
1127 requires indirectly_copyable<I, O>
1128 constexpr replace_copy_if_result<I, O>
1129 replace_copy_if(I first, S last, O result, Pred pred, const T& new_value,
Mark de Weverde6827b2023-02-24 20:35:411130 Proj proj = {}); // since C++20
Nikolas Klauser93172c12022-08-03 05:25:001131
1132 template<input_range R, class T, output_iterator<const T&> O, class Proj = identity,
1133 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
1134 requires indirectly_copyable<iterator_t<R>, O>
1135 constexpr replace_copy_if_result<borrowed_iterator_t<R>, O>
1136 replace_copy_if(R&& r, O result, Pred pred, const T& new_value,
Mark de Weverde6827b2023-02-24 20:35:411137 Proj proj = {}); // since C++20
Nikolas Klauser93172c12022-08-03 05:25:001138
Nikolas Klauser68264b62022-08-03 05:40:131139 template<class I>
Mark de Weverde6827b2023-02-24 20:35:411140 using prev_permutation_result = in_found_result<I>; // since C++20
Nikolas Klauser68264b62022-08-03 05:40:131141
1142 template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
1143 class Proj = identity>
1144 requires sortable<I, Comp, Proj>
1145 constexpr ranges::prev_permutation_result<I>
Mark de Weverde6827b2023-02-24 20:35:411146 ranges::prev_permutation(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser68264b62022-08-03 05:40:131147
1148 template<bidirectional_range R, class Comp = ranges::less,
1149 class Proj = identity>
1150 requires sortable<iterator_t<R>, Comp, Proj>
1151 constexpr ranges::prev_permutation_result<borrowed_iterator_t<R>>
Mark de Weverde6827b2023-02-24 20:35:411152 ranges::prev_permutation(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser68264b62022-08-03 05:40:131153
1154 template<class I>
Mark de Weverde6827b2023-02-24 20:35:411155 using next_permutation_result = in_found_result<I>; // since C++20
Nikolas Klauser68264b62022-08-03 05:40:131156
1157 template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
1158 class Proj = identity>
1159 requires sortable<I, Comp, Proj>
1160 constexpr ranges::next_permutation_result<I>
Mark de Weverde6827b2023-02-24 20:35:411161 ranges::next_permutation(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser68264b62022-08-03 05:40:131162
1163 template<bidirectional_range R, class Comp = ranges::less,
1164 class Proj = identity>
1165 requires sortable<iterator_t<R>, Comp, Proj>
1166 constexpr ranges::next_permutation_result<borrowed_iterator_t<R>>
Mark de Weverde6827b2023-02-24 20:35:411167 ranges::next_permutation(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser68264b62022-08-03 05:40:131168
Nikolas Klauserd3729bb2022-01-14 01:55:511169}
1170
Nikolas Klauser68264b62022-08-03 05:40:131171template <class InputIterator, class Predicate>
A. Jiangba9aeed2025-03-06 17:27:481172 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161173 all_of(InputIterator first, InputIterator last, Predicate pred);
1174
1175template <class InputIterator, class Predicate>
A. Jiangba9aeed2025-03-06 17:27:481176 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161177 any_of(InputIterator first, InputIterator last, Predicate pred);
1178
1179template <class InputIterator, class Predicate>
A. Jiangba9aeed2025-03-06 17:27:481180 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161181 none_of(InputIterator first, InputIterator last, Predicate pred);
1182
1183template <class InputIterator, class Function>
A. Jiangba9aeed2025-03-06 17:27:481184 constexpr Function // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161185 for_each(InputIterator first, InputIterator last, Function f);
1186
Marshall Clowd5c65ff2017-05-25 02:29:541187template<class InputIterator, class Size, class Function>
A. Jiangba9aeed2025-03-06 17:27:481188 constexpr InputIterator // constexpr since C++20
Marshall Clow1b9a4ff2018-01-22 20:44:331189 for_each_n(InputIterator first, Size n, Function f); // C++17
Marshall Clowd5c65ff2017-05-25 02:29:541190
Howard Hinnant3e519522010-05-11 19:42:161191template <class InputIterator, class T>
A. Jiangba9aeed2025-03-06 17:27:481192 constexpr InputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161193 find(InputIterator first, InputIterator last, const T& value);
1194
1195template <class InputIterator, class Predicate>
A. Jiangba9aeed2025-03-06 17:27:481196 constexpr InputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161197 find_if(InputIterator first, InputIterator last, Predicate pred);
1198
1199template<class InputIterator, class Predicate>
A. Jiangba9aeed2025-03-06 17:27:481200 constexpr InputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161201 find_if_not(InputIterator first, InputIterator last, Predicate pred);
1202
1203template <class ForwardIterator1, class ForwardIterator2>
A. Jiangba9aeed2025-03-06 17:27:481204 constexpr ForwardIterator1 // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161205 find_end(ForwardIterator1 first1, ForwardIterator1 last1,
1206 ForwardIterator2 first2, ForwardIterator2 last2);
1207
1208template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
A. Jiangba9aeed2025-03-06 17:27:481209 constexpr ForwardIterator1 // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161210 find_end(ForwardIterator1 first1, ForwardIterator1 last1,
1211 ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
1212
1213template <class ForwardIterator1, class ForwardIterator2>
A. Jiangba9aeed2025-03-06 17:27:481214 constexpr ForwardIterator1 // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161215 find_first_of(ForwardIterator1 first1, ForwardIterator1 last1,
1216 ForwardIterator2 first2, ForwardIterator2 last2);
1217
1218template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
A. Jiangba9aeed2025-03-06 17:27:481219 constexpr ForwardIterator1 // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161220 find_first_of(ForwardIterator1 first1, ForwardIterator1 last1,
1221 ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
1222
1223template <class ForwardIterator>
A. Jiangba9aeed2025-03-06 17:27:481224 constexpr ForwardIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161225 adjacent_find(ForwardIterator first, ForwardIterator last);
1226
1227template <class ForwardIterator, class BinaryPredicate>
A. Jiangba9aeed2025-03-06 17:27:481228 constexpr ForwardIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161229 adjacent_find(ForwardIterator first, ForwardIterator last, BinaryPredicate pred);
1230
1231template <class InputIterator, class T>
A. Jiangba9aeed2025-03-06 17:27:481232 constexpr typename iterator_traits<InputIterator>::difference_type // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161233 count(InputIterator first, InputIterator last, const T& value);
1234
1235template <class InputIterator, class Predicate>
A. Jiangba9aeed2025-03-06 17:27:481236 constexpr typename iterator_traits<InputIterator>::difference_type // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161237 count_if(InputIterator first, InputIterator last, Predicate pred);
1238
1239template <class InputIterator1, class InputIterator2>
A. Jiangba9aeed2025-03-06 17:27:481240 constexpr pair<InputIterator1, InputIterator2> // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161241 mismatch(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2);
1242
Marshall Clow0b0bbd22013-05-09 21:14:231243template <class InputIterator1, class InputIterator2>
Louis Dionne5366bf52024-10-01 16:59:361244 constexpr pair<InputIterator1, InputIterator2>
Aditya Kumar331fb802016-08-25 11:52:381245 mismatch(InputIterator1 first1, InputIterator1 last1,
A. Jiangba9aeed2025-03-06 17:27:481246 InputIterator2 first2, InputIterator2 last2); // since C++14, constexpr since C++20
Marshall Clow0b0bbd22013-05-09 21:14:231247
Howard Hinnant3e519522010-05-11 19:42:161248template <class InputIterator1, class InputIterator2, class BinaryPredicate>
A. Jiangba9aeed2025-03-06 17:27:481249 constexpr pair<InputIterator1, InputIterator2> // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161250 mismatch(InputIterator1 first1, InputIterator1 last1,
1251 InputIterator2 first2, BinaryPredicate pred);
1252
Marshall Clow0b0bbd22013-05-09 21:14:231253template <class InputIterator1, class InputIterator2, class BinaryPredicate>
Louis Dionne5366bf52024-10-01 16:59:361254 constexpr pair<InputIterator1, InputIterator2>
Marshall Clow0b0bbd22013-05-09 21:14:231255 mismatch(InputIterator1 first1, InputIterator1 last1,
1256 InputIterator2 first2, InputIterator2 last2,
A. Jiangba9aeed2025-03-06 17:27:481257 BinaryPredicate pred); // since C++14, constexpr since C++20
Marshall Clow0b0bbd22013-05-09 21:14:231258
Howard Hinnant3e519522010-05-11 19:42:161259template <class InputIterator1, class InputIterator2>
A. Jiangba9aeed2025-03-06 17:27:481260 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161261 equal(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2);
1262
Marshall Clow0b0bbd22013-05-09 21:14:231263template <class InputIterator1, class InputIterator2>
Louis Dionne5366bf52024-10-01 16:59:361264 constexpr bool
Aditya Kumar331fb802016-08-25 11:52:381265 equal(InputIterator1 first1, InputIterator1 last1,
A. Jiangba9aeed2025-03-06 17:27:481266 InputIterator2 first2, InputIterator2 last2); // since C++14, constexpr since C++20
Marshall Clow0b0bbd22013-05-09 21:14:231267
Howard Hinnant3e519522010-05-11 19:42:161268template <class InputIterator1, class InputIterator2, class BinaryPredicate>
A. Jiangba9aeed2025-03-06 17:27:481269 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161270 equal(InputIterator1 first1, InputIterator1 last1,
1271 InputIterator2 first2, BinaryPredicate pred);
1272
Marshall Clow0b0bbd22013-05-09 21:14:231273template <class InputIterator1, class InputIterator2, class BinaryPredicate>
Louis Dionne5366bf52024-10-01 16:59:361274 constexpr bool
Marshall Clow0b0bbd22013-05-09 21:14:231275 equal(InputIterator1 first1, InputIterator1 last1,
1276 InputIterator2 first2, InputIterator2 last2,
A. Jiangba9aeed2025-03-06 17:27:481277 BinaryPredicate pred); // since C++14, constexpr since C++20
Marshall Clow0b0bbd22013-05-09 21:14:231278
Howard Hinnant3e519522010-05-11 19:42:161279template<class ForwardIterator1, class ForwardIterator2>
A. Jiangba9aeed2025-03-06 17:27:481280 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161281 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
1282 ForwardIterator2 first2);
1283
Marshall Clow0b0bbd22013-05-09 21:14:231284template<class ForwardIterator1, class ForwardIterator2>
Louis Dionne5366bf52024-10-01 16:59:361285 constexpr bool
Marshall Clow0b0bbd22013-05-09 21:14:231286 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
A. Jiangba9aeed2025-03-06 17:27:481287 ForwardIterator2 first2, ForwardIterator2 last2); // since C++14, constexpr since C++20
Marshall Clow0b0bbd22013-05-09 21:14:231288
Howard Hinnant3e519522010-05-11 19:42:161289template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
A. Jiangba9aeed2025-03-06 17:27:481290 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161291 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
1292 ForwardIterator2 first2, BinaryPredicate pred);
1293
Marshall Clow0b0bbd22013-05-09 21:14:231294template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
Louis Dionne5366bf52024-10-01 16:59:361295 constexpr bool
Marshall Clow0b0bbd22013-05-09 21:14:231296 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
1297 ForwardIterator2 first2, ForwardIterator2 last2,
A. Jiangba9aeed2025-03-06 17:27:481298 BinaryPredicate pred); // since C++14, constexpr since C++20
Marshall Clow0b0bbd22013-05-09 21:14:231299
Howard Hinnant3e519522010-05-11 19:42:161300template <class ForwardIterator1, class ForwardIterator2>
A. Jiangba9aeed2025-03-06 17:27:481301 constexpr ForwardIterator1 // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161302 search(ForwardIterator1 first1, ForwardIterator1 last1,
1303 ForwardIterator2 first2, ForwardIterator2 last2);
1304
1305template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
A. Jiangba9aeed2025-03-06 17:27:481306 constexpr ForwardIterator1 // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161307 search(ForwardIterator1 first1, ForwardIterator1 last1,
1308 ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
1309
1310template <class ForwardIterator, class Size, class T>
A. Jiangba9aeed2025-03-06 17:27:481311 constexpr ForwardIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161312 search_n(ForwardIterator first, ForwardIterator last, Size count, const T& value);
1313
1314template <class ForwardIterator, class Size, class T, class BinaryPredicate>
A. Jiangba9aeed2025-03-06 17:27:481315 constexpr ForwardIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161316 search_n(ForwardIterator first, ForwardIterator last,
1317 Size count, const T& value, BinaryPredicate pred);
1318
1319template <class InputIterator, class OutputIterator>
A. Jiangba9aeed2025-03-06 17:27:481320 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161321 copy(InputIterator first, InputIterator last, OutputIterator result);
1322
1323template<class InputIterator, class OutputIterator, class Predicate>
A. Jiangba9aeed2025-03-06 17:27:481324 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161325 copy_if(InputIterator first, InputIterator last,
1326 OutputIterator result, Predicate pred);
1327
1328template<class InputIterator, class Size, class OutputIterator>
A. Jiangba9aeed2025-03-06 17:27:481329 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161330 copy_n(InputIterator first, Size n, OutputIterator result);
1331
1332template <class BidirectionalIterator1, class BidirectionalIterator2>
A. Jiangba9aeed2025-03-06 17:27:481333 constexpr BidirectionalIterator2 // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161334 copy_backward(BidirectionalIterator1 first, BidirectionalIterator1 last,
1335 BidirectionalIterator2 result);
1336
Konstantin Varlamov79a2b4b2022-06-28 18:59:591337// [alg.move], move
1338template<class InputIterator, class OutputIterator>
1339 constexpr OutputIterator move(InputIterator first, InputIterator last,
1340 OutputIterator result);
1341
1342template<class BidirectionalIterator1, class BidirectionalIterator2>
1343 constexpr BidirectionalIterator2
1344 move_backward(BidirectionalIterator1 first, BidirectionalIterator1 last,
1345 BidirectionalIterator2 result);
1346
Howard Hinnant3e519522010-05-11 19:42:161347template <class ForwardIterator1, class ForwardIterator2>
A. Jiangba9aeed2025-03-06 17:27:481348 constexpr ForwardIterator2 // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161349 swap_ranges(ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2);
1350
Konstantin Varlamov79a2b4b2022-06-28 18:59:591351namespace ranges {
1352 template<class I1, class I2>
1353 using swap_ranges_result = in_in_result<I1, I2>;
1354
Nikolas Klauser9d905312022-02-10 12:33:031355template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2>
1356 requires indirectly_swappable<I1, I2>
1357 constexpr ranges::swap_ranges_result<I1, I2>
Konstantin Varlamov79a2b4b2022-06-28 18:59:591358 swap_ranges(I1 first1, S1 last1, I2 first2, S2 last2);
Nikolas Klauser9d905312022-02-10 12:33:031359
1360template<input_range R1, input_range R2>
1361 requires indirectly_swappable<iterator_t<R1>, iterator_t<R2>>
1362 constexpr ranges::swap_ranges_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
Konstantin Varlamov79a2b4b2022-06-28 18:59:591363 swap_ranges(R1&& r1, R2&& r2);
1364}
Nikolas Klauser9d905312022-02-10 12:33:031365
Howard Hinnant3e519522010-05-11 19:42:161366template <class ForwardIterator1, class ForwardIterator2>
A. Jiangba9aeed2025-03-06 17:27:481367 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161368 iter_swap(ForwardIterator1 a, ForwardIterator2 b);
1369
1370template <class InputIterator, class OutputIterator, class UnaryOperation>
A. Jiangba9aeed2025-03-06 17:27:481371 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161372 transform(InputIterator first, InputIterator last, OutputIterator result, UnaryOperation op);
1373
1374template <class InputIterator1, class InputIterator2, class OutputIterator, class BinaryOperation>
A. Jiangba9aeed2025-03-06 17:27:481375 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161376 transform(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2,
1377 OutputIterator result, BinaryOperation binary_op);
1378
1379template <class ForwardIterator, class T>
A. Jiangba9aeed2025-03-06 17:27:481380 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161381 replace(ForwardIterator first, ForwardIterator last, const T& old_value, const T& new_value);
1382
1383template <class ForwardIterator, class Predicate, class T>
A. Jiangba9aeed2025-03-06 17:27:481384 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161385 replace_if(ForwardIterator first, ForwardIterator last, Predicate pred, const T& new_value);
1386
1387template <class InputIterator, class OutputIterator, class T>
A. Jiangba9aeed2025-03-06 17:27:481388 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161389 replace_copy(InputIterator first, InputIterator last, OutputIterator result,
1390 const T& old_value, const T& new_value);
1391
1392template <class InputIterator, class OutputIterator, class Predicate, class T>
A. Jiangba9aeed2025-03-06 17:27:481393 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161394 replace_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred, const T& new_value);
1395
1396template <class ForwardIterator, class T>
A. Jiangba9aeed2025-03-06 17:27:481397 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161398 fill(ForwardIterator first, ForwardIterator last, const T& value);
1399
1400template <class OutputIterator, class Size, class T>
A. Jiangba9aeed2025-03-06 17:27:481401 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161402 fill_n(OutputIterator first, Size n, const T& value);
1403
1404template <class ForwardIterator, class Generator>
A. Jiangba9aeed2025-03-06 17:27:481405 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161406 generate(ForwardIterator first, ForwardIterator last, Generator gen);
1407
1408template <class OutputIterator, class Size, class Generator>
A. Jiangba9aeed2025-03-06 17:27:481409 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161410 generate_n(OutputIterator first, Size n, Generator gen);
1411
1412template <class ForwardIterator, class T>
A. Jiangba9aeed2025-03-06 17:27:481413 constexpr ForwardIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161414 remove(ForwardIterator first, ForwardIterator last, const T& value);
1415
1416template <class ForwardIterator, class Predicate>
A. Jiangba9aeed2025-03-06 17:27:481417 constexpr ForwardIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161418 remove_if(ForwardIterator first, ForwardIterator last, Predicate pred);
1419
1420template <class InputIterator, class OutputIterator, class T>
A. Jiangba9aeed2025-03-06 17:27:481421 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161422 remove_copy(InputIterator first, InputIterator last, OutputIterator result, const T& value);
1423
1424template <class InputIterator, class OutputIterator, class Predicate>
A. Jiangba9aeed2025-03-06 17:27:481425 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161426 remove_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred);
1427
1428template <class ForwardIterator>
A. Jiangba9aeed2025-03-06 17:27:481429 constexpr ForwardIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161430 unique(ForwardIterator first, ForwardIterator last);
1431
1432template <class ForwardIterator, class BinaryPredicate>
A. Jiangba9aeed2025-03-06 17:27:481433 constexpr ForwardIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161434 unique(ForwardIterator first, ForwardIterator last, BinaryPredicate pred);
1435
1436template <class InputIterator, class OutputIterator>
A. Jiangba9aeed2025-03-06 17:27:481437 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161438 unique_copy(InputIterator first, InputIterator last, OutputIterator result);
1439
1440template <class InputIterator, class OutputIterator, class BinaryPredicate>
A. Jiangba9aeed2025-03-06 17:27:481441 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161442 unique_copy(InputIterator first, InputIterator last, OutputIterator result, BinaryPredicate pred);
1443
1444template <class BidirectionalIterator>
A. Jiangba9aeed2025-03-06 17:27:481445 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161446 reverse(BidirectionalIterator first, BidirectionalIterator last);
1447
1448template <class BidirectionalIterator, class OutputIterator>
A. Jiangba9aeed2025-03-06 17:27:481449 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161450 reverse_copy(BidirectionalIterator first, BidirectionalIterator last, OutputIterator result);
1451
1452template <class ForwardIterator>
A. Jiangba9aeed2025-03-06 17:27:481453 constexpr ForwardIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161454 rotate(ForwardIterator first, ForwardIterator middle, ForwardIterator last);
1455
1456template <class ForwardIterator, class OutputIterator>
A. Jiangba9aeed2025-03-06 17:27:481457 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161458 rotate_copy(ForwardIterator first, ForwardIterator middle, ForwardIterator last, OutputIterator result);
1459
1460template <class RandomAccessIterator>
1461 void
Marshall Clow0f37a412017-03-23 13:43:371462 random_shuffle(RandomAccessIterator first, RandomAccessIterator last); // deprecated in C++14, removed in C++17
Howard Hinnant3e519522010-05-11 19:42:161463
1464template <class RandomAccessIterator, class RandomNumberGenerator>
1465 void
Marshall Clow06965c12014-03-03 06:14:191466 random_shuffle(RandomAccessIterator first, RandomAccessIterator last,
Marshall Clow0f37a412017-03-23 13:43:371467 RandomNumberGenerator& rand); // deprecated in C++14, removed in C++17
Howard Hinnant3e519522010-05-11 19:42:161468
Eric Fiseliere7154702016-08-28 22:14:371469template<class PopulationIterator, class SampleIterator,
1470 class Distance, class UniformRandomBitGenerator>
1471 SampleIterator sample(PopulationIterator first, PopulationIterator last,
1472 SampleIterator out, Distance n,
1473 UniformRandomBitGenerator&& g); // C++17
1474
Howard Hinnantf9d540b2010-05-26 17:49:341475template<class RandomAccessIterator, class UniformRandomNumberGenerator>
1476 void shuffle(RandomAccessIterator first, RandomAccessIterator last,
Howard Hinnantfb340102010-11-18 01:47:021477 UniformRandomNumberGenerator&& g);
Howard Hinnantf9d540b2010-05-26 17:49:341478
Arthur O'Dwyer3fbd3ea2020-12-26 06:39:031479template<class ForwardIterator>
1480 constexpr ForwardIterator
1481 shift_left(ForwardIterator first, ForwardIterator last,
1482 typename iterator_traits<ForwardIterator>::difference_type n); // C++20
1483
1484template<class ForwardIterator>
1485 constexpr ForwardIterator
1486 shift_right(ForwardIterator first, ForwardIterator last,
1487 typename iterator_traits<ForwardIterator>::difference_type n); // C++20
1488
Howard Hinnant3e519522010-05-11 19:42:161489template <class InputIterator, class Predicate>
A. Jiangba9aeed2025-03-06 17:27:481490 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161491 is_partitioned(InputIterator first, InputIterator last, Predicate pred);
1492
1493template <class ForwardIterator, class Predicate>
A. Jiangba9aeed2025-03-06 17:27:481494 constexpr ForwardIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161495 partition(ForwardIterator first, ForwardIterator last, Predicate pred);
1496
1497template <class InputIterator, class OutputIterator1,
1498 class OutputIterator2, class Predicate>
A. Jiangba9aeed2025-03-06 17:27:481499 constexpr pair<OutputIterator1, OutputIterator2> // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161500 partition_copy(InputIterator first, InputIterator last,
1501 OutputIterator1 out_true, OutputIterator2 out_false,
1502 Predicate pred);
1503
1504template <class ForwardIterator, class Predicate>
A. Jiangba9aeed2025-03-06 17:27:481505 constexpr ForwardIterator // constexpr since C++26
Howard Hinnant3e519522010-05-11 19:42:161506 stable_partition(ForwardIterator first, ForwardIterator last, Predicate pred);
1507
1508template<class ForwardIterator, class Predicate>
A. Jiangba9aeed2025-03-06 17:27:481509 constexpr ForwardIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161510 partition_point(ForwardIterator first, ForwardIterator last, Predicate pred);
1511
1512template <class ForwardIterator>
A. Jiangba9aeed2025-03-06 17:27:481513 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161514 is_sorted(ForwardIterator first, ForwardIterator last);
1515
1516template <class ForwardIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481517 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161518 is_sorted(ForwardIterator first, ForwardIterator last, Compare comp);
1519
1520template<class ForwardIterator>
A. Jiangba9aeed2025-03-06 17:27:481521 constexpr ForwardIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161522 is_sorted_until(ForwardIterator first, ForwardIterator last);
1523
1524template <class ForwardIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481525 constexpr ForwardIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161526 is_sorted_until(ForwardIterator first, ForwardIterator last, Compare comp);
1527
1528template <class RandomAccessIterator>
A. Jiangba9aeed2025-03-06 17:27:481529 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161530 sort(RandomAccessIterator first, RandomAccessIterator last);
1531
1532template <class RandomAccessIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481533 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161534 sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1535
1536template <class RandomAccessIterator>
A. Jiangba9aeed2025-03-06 17:27:481537 constexpr void // constexpr since C++26
Howard Hinnant3e519522010-05-11 19:42:161538 stable_sort(RandomAccessIterator first, RandomAccessIterator last);
1539
1540template <class RandomAccessIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481541 constexpr void // constexpr since C++26
Howard Hinnant3e519522010-05-11 19:42:161542 stable_sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1543
1544template <class RandomAccessIterator>
A. Jiangba9aeed2025-03-06 17:27:481545 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161546 partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last);
1547
1548template <class RandomAccessIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481549 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161550 partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last, Compare comp);
1551
1552template <class InputIterator, class RandomAccessIterator>
A. Jiangba9aeed2025-03-06 17:27:481553 constexpr RandomAccessIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161554 partial_sort_copy(InputIterator first, InputIterator last,
1555 RandomAccessIterator result_first, RandomAccessIterator result_last);
1556
1557template <class InputIterator, class RandomAccessIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481558 constexpr RandomAccessIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161559 partial_sort_copy(InputIterator first, InputIterator last,
1560 RandomAccessIterator result_first, RandomAccessIterator result_last, Compare comp);
1561
1562template <class RandomAccessIterator>
A. Jiangba9aeed2025-03-06 17:27:481563 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161564 nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last);
1565
1566template <class RandomAccessIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481567 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161568 nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last, Compare comp);
1569
1570template <class ForwardIterator, class T>
A. Jiangba9aeed2025-03-06 17:27:481571 constexpr ForwardIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161572 lower_bound(ForwardIterator first, ForwardIterator last, const T& value);
1573
1574template <class ForwardIterator, class T, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481575 constexpr ForwardIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161576 lower_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
1577
1578template <class ForwardIterator, class T>
A. Jiangba9aeed2025-03-06 17:27:481579 constexpr ForwardIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161580 upper_bound(ForwardIterator first, ForwardIterator last, const T& value);
1581
1582template <class ForwardIterator, class T, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481583 constexpr ForwardIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161584 upper_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
1585
1586template <class ForwardIterator, class T>
A. Jiangba9aeed2025-03-06 17:27:481587 constexpr pair<ForwardIterator, ForwardIterator> // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161588 equal_range(ForwardIterator first, ForwardIterator last, const T& value);
1589
1590template <class ForwardIterator, class T, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481591 constexpr pair<ForwardIterator, ForwardIterator> // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161592 equal_range(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
1593
1594template <class ForwardIterator, class T>
A. Jiangba9aeed2025-03-06 17:27:481595 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161596 binary_search(ForwardIterator first, ForwardIterator last, const T& value);
1597
1598template <class ForwardIterator, class T, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481599 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161600 binary_search(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
1601
1602template <class InputIterator1, class InputIterator2, class OutputIterator>
A. Jiangba9aeed2025-03-06 17:27:481603 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161604 merge(InputIterator1 first1, InputIterator1 last1,
1605 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1606
1607template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481608 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161609 merge(InputIterator1 first1, InputIterator1 last1,
1610 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1611
1612template <class BidirectionalIterator>
A. Jiang854a4f22025-03-18 23:42:231613 constexpr void // constexpr since C++26
Howard Hinnant3e519522010-05-11 19:42:161614 inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last);
1615
1616template <class BidirectionalIterator, class Compare>
A. Jiang854a4f22025-03-18 23:42:231617 constexpr void // constexpr since C++26
Howard Hinnant3e519522010-05-11 19:42:161618 inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last, Compare comp);
1619
1620template <class InputIterator1, class InputIterator2>
A. Jiangba9aeed2025-03-06 17:27:481621 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161622 includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2);
1623
1624template <class InputIterator1, class InputIterator2, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481625 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161626 includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, Compare comp);
1627
1628template <class InputIterator1, class InputIterator2, class OutputIterator>
A. Jiangba9aeed2025-03-06 17:27:481629 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161630 set_union(InputIterator1 first1, InputIterator1 last1,
1631 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1632
1633template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481634 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161635 set_union(InputIterator1 first1, InputIterator1 last1,
1636 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1637
1638template <class InputIterator1, class InputIterator2, class OutputIterator>
A. Jiangba9aeed2025-03-06 17:27:481639 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161640 set_intersection(InputIterator1 first1, InputIterator1 last1,
1641 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1642
1643template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481644 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161645 set_intersection(InputIterator1 first1, InputIterator1 last1,
1646 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1647
1648template <class InputIterator1, class InputIterator2, class OutputIterator>
A. Jiangba9aeed2025-03-06 17:27:481649 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161650 set_difference(InputIterator1 first1, InputIterator1 last1,
1651 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1652
1653template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481654 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161655 set_difference(InputIterator1 first1, InputIterator1 last1,
1656 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1657
1658template <class InputIterator1, class InputIterator2, class OutputIterator>
A. Jiangba9aeed2025-03-06 17:27:481659 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161660 set_symmetric_difference(InputIterator1 first1, InputIterator1 last1,
1661 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1662
1663template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481664 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161665 set_symmetric_difference(InputIterator1 first1, InputIterator1 last1,
1666 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1667
1668template <class RandomAccessIterator>
A. Jiangba9aeed2025-03-06 17:27:481669 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161670 push_heap(RandomAccessIterator first, RandomAccessIterator last);
1671
1672template <class RandomAccessIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481673 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161674 push_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1675
1676template <class RandomAccessIterator>
A. Jiangba9aeed2025-03-06 17:27:481677 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161678 pop_heap(RandomAccessIterator first, RandomAccessIterator last);
1679
1680template <class RandomAccessIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481681 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161682 pop_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1683
1684template <class RandomAccessIterator>
A. Jiangba9aeed2025-03-06 17:27:481685 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161686 make_heap(RandomAccessIterator first, RandomAccessIterator last);
1687
1688template <class RandomAccessIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481689 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161690 make_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1691
1692template <class RandomAccessIterator>
A. Jiangba9aeed2025-03-06 17:27:481693 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161694 sort_heap(RandomAccessIterator first, RandomAccessIterator last);
1695
1696template <class RandomAccessIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481697 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161698 sort_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1699
Howard Hinnantb3371f62010-08-22 00:02:431700template <class RandomAccessIterator>
A. Jiangba9aeed2025-03-06 17:27:481701 constexpr bool // constexpr since C++20
Howard Hinnantb3371f62010-08-22 00:02:431702 is_heap(RandomAccessIterator first, RandomAccessiterator last);
Howard Hinnant3e519522010-05-11 19:42:161703
Howard Hinnantb3371f62010-08-22 00:02:431704template <class RandomAccessIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481705 constexpr bool // constexpr since C++20
Howard Hinnantb3371f62010-08-22 00:02:431706 is_heap(RandomAccessIterator first, RandomAccessiterator last, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161707
Howard Hinnantb3371f62010-08-22 00:02:431708template <class RandomAccessIterator>
A. Jiangba9aeed2025-03-06 17:27:481709 constexpr RandomAccessIterator // constexpr since C++20
Howard Hinnantb3371f62010-08-22 00:02:431710 is_heap_until(RandomAccessIterator first, RandomAccessiterator last);
Howard Hinnant3e519522010-05-11 19:42:161711
Howard Hinnantb3371f62010-08-22 00:02:431712template <class RandomAccessIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481713 constexpr RandomAccessIterator // constexpr since C++20
Howard Hinnantb3371f62010-08-22 00:02:431714 is_heap_until(RandomAccessIterator first, RandomAccessiterator last, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161715
Howard Hinnant4eb27b72010-08-21 20:10:011716template <class ForwardIterator>
A. Jiangba9aeed2025-03-06 17:27:481717 constexpr ForwardIterator // constexpr since C++14
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181718 min_element(ForwardIterator first, ForwardIterator last);
Howard Hinnant4eb27b72010-08-21 20:10:011719
1720template <class ForwardIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481721 constexpr ForwardIterator // constexpr since C++14
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181722 min_element(ForwardIterator first, ForwardIterator last, Compare comp);
Howard Hinnant4eb27b72010-08-21 20:10:011723
Howard Hinnant3e519522010-05-11 19:42:161724template <class T>
A. Jiangba9aeed2025-03-06 17:27:481725 constexpr const T& // constexpr since C++14
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181726 min(const T& a, const T& b);
Howard Hinnant3e519522010-05-11 19:42:161727
1728template <class T, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481729 constexpr const T& // constexpr since C++14
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181730 min(const T& a, const T& b, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161731
Howard Hinnant4eb27b72010-08-21 20:10:011732template<class T>
A. Jiangba9aeed2025-03-06 17:27:481733 constexpr T // constexpr since C++14
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181734 min(initializer_list<T> t);
Howard Hinnant4eb27b72010-08-21 20:10:011735
1736template<class T, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481737 constexpr T // constexpr since C++14
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181738 min(initializer_list<T> t, Compare comp);
Howard Hinnant4eb27b72010-08-21 20:10:011739
Marshall Clow146c14a2016-03-07 22:43:491740template<class T>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181741 constexpr const T& clamp(const T& v, const T& lo, const T& hi); // C++17
Marshall Clow146c14a2016-03-07 22:43:491742
1743template<class T, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181744 constexpr const T& clamp(const T& v, const T& lo, const T& hi, Compare comp); // C++17
Marshall Clow146c14a2016-03-07 22:43:491745
Howard Hinnant4eb27b72010-08-21 20:10:011746template <class ForwardIterator>
A. Jiangba9aeed2025-03-06 17:27:481747 constexpr ForwardIterator // constexpr since C++14
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181748 max_element(ForwardIterator first, ForwardIterator last);
Howard Hinnant4eb27b72010-08-21 20:10:011749
1750template <class ForwardIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481751 constexpr ForwardIterator // constexpr since C++14
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181752 max_element(ForwardIterator first, ForwardIterator last, Compare comp);
Howard Hinnant4eb27b72010-08-21 20:10:011753
Howard Hinnant3e519522010-05-11 19:42:161754template <class T>
A. Jiangba9aeed2025-03-06 17:27:481755 constexpr const T& // constexpr since C++14
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181756 max(const T& a, const T& b);
Howard Hinnant3e519522010-05-11 19:42:161757
1758template <class T, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481759 constexpr const T& // constexpr since C++14
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181760 max(const T& a, const T& b, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161761
Howard Hinnant4eb27b72010-08-21 20:10:011762template<class T>
A. Jiangba9aeed2025-03-06 17:27:481763 constexpr T // constexpr since C++14
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181764 max(initializer_list<T> t);
Howard Hinnant3e519522010-05-11 19:42:161765
Howard Hinnant4eb27b72010-08-21 20:10:011766template<class T, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481767 constexpr T // constexpr since C++14
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181768 max(initializer_list<T> t, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161769
Howard Hinnant4eb27b72010-08-21 20:10:011770template<class ForwardIterator>
A. Jiangba9aeed2025-03-06 17:27:481771 constexpr pair<ForwardIterator, ForwardIterator> // constexpr since C++14
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181772 minmax_element(ForwardIterator first, ForwardIterator last);
Howard Hinnant3e519522010-05-11 19:42:161773
Howard Hinnant4eb27b72010-08-21 20:10:011774template<class ForwardIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481775 constexpr pair<ForwardIterator, ForwardIterator> // constexpr since C++14
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181776 minmax_element(ForwardIterator first, ForwardIterator last, Compare comp);
Howard Hinnant4eb27b72010-08-21 20:10:011777
1778template<class T>
A. Jiangba9aeed2025-03-06 17:27:481779 constexpr pair<const T&, const T&> // constexpr since C++14
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181780 minmax(const T& a, const T& b);
Howard Hinnant4eb27b72010-08-21 20:10:011781
1782template<class T, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481783 constexpr pair<const T&, const T&> // constexpr since C++14
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181784 minmax(const T& a, const T& b, Compare comp);
Howard Hinnant4eb27b72010-08-21 20:10:011785
1786template<class T>
A. Jiangba9aeed2025-03-06 17:27:481787 constexpr pair<T, T> // constexpr since C++14
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181788 minmax(initializer_list<T> t);
Howard Hinnant4eb27b72010-08-21 20:10:011789
1790template<class T, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481791 constexpr pair<T, T> // constexpr since C++14
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181792 minmax(initializer_list<T> t, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161793
1794template <class InputIterator1, class InputIterator2>
A. Jiangba9aeed2025-03-06 17:27:481795 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161796 lexicographical_compare(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2);
1797
1798template <class InputIterator1, class InputIterator2, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481799 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161800 lexicographical_compare(InputIterator1 first1, InputIterator1 last1,
1801 InputIterator2 first2, InputIterator2 last2, Compare comp);
1802
Adrian Vogelsgesang2a067572022-08-04 22:21:271803template<class InputIterator1, class InputIterator2, class Cmp>
1804 constexpr auto
1805 lexicographical_compare_three_way(InputIterator1 first1, InputIterator1 last1,
1806 InputIterator2 first2, InputIterator2 last2,
1807 Cmp comp)
1808 -> decltype(comp(*b1, *b2)); // since C++20
1809
1810template<class InputIterator1, class InputIterator2>
1811 constexpr auto
1812 lexicographical_compare_three_way(InputIterator1 first1, InputIterator1 last1,
1813 InputIterator2 first2, InputIterator2 last2); // since C++20
1814
Howard Hinnant3e519522010-05-11 19:42:161815template <class BidirectionalIterator>
A. Jiangba9aeed2025-03-06 17:27:481816 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161817 next_permutation(BidirectionalIterator first, BidirectionalIterator last);
1818
1819template <class BidirectionalIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481820 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161821 next_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp);
1822
1823template <class BidirectionalIterator>
A. Jiangba9aeed2025-03-06 17:27:481824 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161825 prev_permutation(BidirectionalIterator first, BidirectionalIterator last);
1826
1827template <class BidirectionalIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481828 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161829 prev_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161830} // std
1831
1832*/
1833
Nikolas Klauserb9a26582024-12-21 12:01:481834#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
1835# include <__cxx03/algorithm>
1836#else
Nikolas Klauserc166a9c2024-12-10 15:02:121837# include <__config>
Howard Hinnant5d1a7012013-08-14 18:00:201838
Nikolas Klauserc166a9c2024-12-10 15:02:121839# include <__algorithm/adjacent_find.h>
1840# include <__algorithm/all_of.h>
1841# include <__algorithm/any_of.h>
1842# include <__algorithm/binary_search.h>
1843# include <__algorithm/copy.h>
1844# include <__algorithm/copy_backward.h>
1845# include <__algorithm/copy_if.h>
1846# include <__algorithm/copy_n.h>
1847# include <__algorithm/count.h>
1848# include <__algorithm/count_if.h>
1849# include <__algorithm/equal.h>
1850# include <__algorithm/equal_range.h>
1851# include <__algorithm/fill.h>
1852# include <__algorithm/fill_n.h>
1853# include <__algorithm/find.h>
1854# include <__algorithm/find_end.h>
1855# include <__algorithm/find_first_of.h>
1856# include <__algorithm/find_if.h>
1857# include <__algorithm/find_if_not.h>
1858# include <__algorithm/for_each.h>
1859# include <__algorithm/generate.h>
1860# include <__algorithm/generate_n.h>
1861# include <__algorithm/includes.h>
1862# include <__algorithm/inplace_merge.h>
1863# include <__algorithm/is_heap.h>
1864# include <__algorithm/is_heap_until.h>
1865# include <__algorithm/is_partitioned.h>
1866# include <__algorithm/is_permutation.h>
1867# include <__algorithm/is_sorted.h>
1868# include <__algorithm/is_sorted_until.h>
1869# include <__algorithm/iter_swap.h>
1870# include <__algorithm/lexicographical_compare.h>
1871# include <__algorithm/lower_bound.h>
1872# include <__algorithm/make_heap.h>
1873# include <__algorithm/max.h>
1874# include <__algorithm/max_element.h>
1875# include <__algorithm/merge.h>
1876# include <__algorithm/min.h>
1877# include <__algorithm/min_element.h>
1878# include <__algorithm/minmax.h>
1879# include <__algorithm/minmax_element.h>
1880# include <__algorithm/mismatch.h>
1881# include <__algorithm/move.h>
1882# include <__algorithm/move_backward.h>
1883# include <__algorithm/next_permutation.h>
1884# include <__algorithm/none_of.h>
1885# include <__algorithm/nth_element.h>
1886# include <__algorithm/partial_sort.h>
1887# include <__algorithm/partial_sort_copy.h>
1888# include <__algorithm/partition.h>
1889# include <__algorithm/partition_copy.h>
1890# include <__algorithm/partition_point.h>
1891# include <__algorithm/pop_heap.h>
1892# include <__algorithm/prev_permutation.h>
1893# include <__algorithm/push_heap.h>
1894# include <__algorithm/remove.h>
1895# include <__algorithm/remove_copy.h>
1896# include <__algorithm/remove_copy_if.h>
1897# include <__algorithm/remove_if.h>
1898# include <__algorithm/replace.h>
1899# include <__algorithm/replace_copy.h>
1900# include <__algorithm/replace_copy_if.h>
1901# include <__algorithm/replace_if.h>
1902# include <__algorithm/reverse.h>
1903# include <__algorithm/reverse_copy.h>
1904# include <__algorithm/rotate.h>
1905# include <__algorithm/rotate_copy.h>
1906# include <__algorithm/search.h>
1907# include <__algorithm/search_n.h>
1908# include <__algorithm/set_difference.h>
1909# include <__algorithm/set_intersection.h>
1910# include <__algorithm/set_symmetric_difference.h>
1911# include <__algorithm/set_union.h>
1912# include <__algorithm/shuffle.h>
1913# include <__algorithm/sort.h>
1914# include <__algorithm/sort_heap.h>
1915# include <__algorithm/stable_partition.h>
1916# include <__algorithm/stable_sort.h>
1917# include <__algorithm/swap_ranges.h>
1918# include <__algorithm/transform.h>
1919# include <__algorithm/unique.h>
1920# include <__algorithm/unique_copy.h>
1921# include <__algorithm/upper_bound.h>
Eric Fiselierc1bd9192014-08-10 23:53:081922
Nikolas Klauserc166a9c2024-12-10 15:02:121923# if _LIBCPP_STD_VER >= 17
1924# include <__algorithm/clamp.h>
1925# include <__algorithm/for_each_n.h>
1926# include <__algorithm/pstl.h>
1927# include <__algorithm/sample.h>
1928# endif // _LIBCPP_STD_VER >= 17
Nikolas Klauserd5c654b2024-04-14 13:52:561929
Nikolas Klauserc166a9c2024-12-10 15:02:121930# if _LIBCPP_STD_VER >= 20
1931# include <__algorithm/in_found_result.h>
1932# include <__algorithm/in_fun_result.h>
1933# include <__algorithm/in_in_out_result.h>
1934# include <__algorithm/in_in_result.h>
1935# include <__algorithm/in_out_out_result.h>
1936# include <__algorithm/in_out_result.h>
1937# include <__algorithm/lexicographical_compare_three_way.h>
1938# include <__algorithm/min_max_result.h>
1939# include <__algorithm/ranges_adjacent_find.h>
1940# include <__algorithm/ranges_all_of.h>
1941# include <__algorithm/ranges_any_of.h>
1942# include <__algorithm/ranges_binary_search.h>
1943# include <__algorithm/ranges_clamp.h>
1944# include <__algorithm/ranges_contains.h>
1945# include <__algorithm/ranges_copy.h>
1946# include <__algorithm/ranges_copy_backward.h>
1947# include <__algorithm/ranges_copy_if.h>
1948# include <__algorithm/ranges_copy_n.h>
1949# include <__algorithm/ranges_count.h>
1950# include <__algorithm/ranges_count_if.h>
1951# include <__algorithm/ranges_equal.h>
1952# include <__algorithm/ranges_equal_range.h>
1953# include <__algorithm/ranges_fill.h>
1954# include <__algorithm/ranges_fill_n.h>
1955# include <__algorithm/ranges_find.h>
1956# include <__algorithm/ranges_find_end.h>
1957# include <__algorithm/ranges_find_first_of.h>
1958# include <__algorithm/ranges_find_if.h>
1959# include <__algorithm/ranges_find_if_not.h>
1960# include <__algorithm/ranges_for_each.h>
1961# include <__algorithm/ranges_for_each_n.h>
1962# include <__algorithm/ranges_generate.h>
1963# include <__algorithm/ranges_generate_n.h>
1964# include <__algorithm/ranges_includes.h>
1965# include <__algorithm/ranges_inplace_merge.h>
1966# include <__algorithm/ranges_is_heap.h>
1967# include <__algorithm/ranges_is_heap_until.h>
1968# include <__algorithm/ranges_is_partitioned.h>
1969# include <__algorithm/ranges_is_permutation.h>
1970# include <__algorithm/ranges_is_sorted.h>
1971# include <__algorithm/ranges_is_sorted_until.h>
1972# include <__algorithm/ranges_lexicographical_compare.h>
1973# include <__algorithm/ranges_lower_bound.h>
1974# include <__algorithm/ranges_make_heap.h>
1975# include <__algorithm/ranges_max.h>
1976# include <__algorithm/ranges_max_element.h>
1977# include <__algorithm/ranges_merge.h>
1978# include <__algorithm/ranges_min.h>
1979# include <__algorithm/ranges_min_element.h>
1980# include <__algorithm/ranges_minmax.h>
1981# include <__algorithm/ranges_minmax_element.h>
1982# include <__algorithm/ranges_mismatch.h>
1983# include <__algorithm/ranges_move.h>
1984# include <__algorithm/ranges_move_backward.h>
1985# include <__algorithm/ranges_next_permutation.h>
1986# include <__algorithm/ranges_none_of.h>
1987# include <__algorithm/ranges_nth_element.h>
1988# include <__algorithm/ranges_partial_sort.h>
1989# include <__algorithm/ranges_partial_sort_copy.h>
1990# include <__algorithm/ranges_partition.h>
1991# include <__algorithm/ranges_partition_copy.h>
1992# include <__algorithm/ranges_partition_point.h>
1993# include <__algorithm/ranges_pop_heap.h>
1994# include <__algorithm/ranges_prev_permutation.h>
1995# include <__algorithm/ranges_push_heap.h>
1996# include <__algorithm/ranges_remove.h>
1997# include <__algorithm/ranges_remove_copy.h>
1998# include <__algorithm/ranges_remove_copy_if.h>
1999# include <__algorithm/ranges_remove_if.h>
2000# include <__algorithm/ranges_replace.h>
2001# include <__algorithm/ranges_replace_copy.h>
2002# include <__algorithm/ranges_replace_copy_if.h>
2003# include <__algorithm/ranges_replace_if.h>
2004# include <__algorithm/ranges_reverse.h>
2005# include <__algorithm/ranges_reverse_copy.h>
2006# include <__algorithm/ranges_rotate.h>
2007# include <__algorithm/ranges_rotate_copy.h>
2008# include <__algorithm/ranges_sample.h>
2009# include <__algorithm/ranges_search.h>
2010# include <__algorithm/ranges_search_n.h>
2011# include <__algorithm/ranges_set_difference.h>
2012# include <__algorithm/ranges_set_intersection.h>
2013# include <__algorithm/ranges_set_symmetric_difference.h>
2014# include <__algorithm/ranges_set_union.h>
2015# include <__algorithm/ranges_shuffle.h>
2016# include <__algorithm/ranges_sort.h>
2017# include <__algorithm/ranges_sort_heap.h>
2018# include <__algorithm/ranges_stable_partition.h>
2019# include <__algorithm/ranges_stable_sort.h>
2020# include <__algorithm/ranges_swap_ranges.h>
2021# include <__algorithm/ranges_transform.h>
2022# include <__algorithm/ranges_unique.h>
2023# include <__algorithm/ranges_unique_copy.h>
2024# include <__algorithm/ranges_upper_bound.h>
2025# include <__algorithm/shift_left.h>
2026# include <__algorithm/shift_right.h>
2027# endif
Nikolas Klauserd5c654b2024-04-14 13:52:562028
Nikolas Klauserc166a9c2024-12-10 15:02:122029# if _LIBCPP_STD_VER >= 23
2030# include <__algorithm/ranges_contains_subrange.h>
2031# include <__algorithm/ranges_ends_with.h>
2032# include <__algorithm/ranges_find_last.h>
2033# include <__algorithm/ranges_fold.h>
2034# include <__algorithm/ranges_starts_with.h>
2035# endif // _LIBCPP_STD_VER >= 23
Nikolas Klauserd5c654b2024-04-14 13:52:562036
Nikolas Klauserc166a9c2024-12-10 15:02:122037# include <version>
Nikolas Klauserd5c654b2024-04-14 13:52:562038
Nikolas Klauserdb1978b2022-06-16 20:43:462039// standard-mandated includes
Nikolas Klauser473a1602022-09-22 16:05:082040
2041// [algorithm.syn]
Nikolas Klauserc166a9c2024-12-10 15:02:122042# include <initializer_list>
Nikolas Klauserdb1978b2022-06-16 20:43:462043
Nikolas Klauserc166a9c2024-12-10 15:02:122044# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2045# pragma GCC system_header
2046# endif
Howard Hinnant3e519522010-05-11 19:42:162047
Nikolas Klauserc166a9c2024-12-10 15:02:122048# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER == 14
2049# include <execution>
2050# endif
Nikolas Klauserd5c654b2024-04-14 13:52:562051
Nikolas Klauserc166a9c2024-12-10 15:02:122052# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
2053# include <atomic>
2054# include <bit>
2055# include <concepts>
2056# include <cstdlib>
2057# include <cstring>
2058# include <iterator>
2059# include <memory>
2060# include <stdexcept>
2061# include <type_traits>
2062# include <utility>
2063# endif
Nikolas Klauserb9a26582024-12-21 12:01:482064#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
Mark de Wevere31c2a12022-09-02 15:53:282065
Louis Dionne4cd6ca12021-04-20 16:03:322066#endif // _LIBCPP_ALGORITHM