blob: 64e9fa630614591d387a468527af74918cc71f1b [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
James E T Smith475cbf02025-04-05 11:46:1148 template <class O, class T>
49 struct out_value_result; // since C++23
50
Nikolas Klauser3b470d12022-02-11 12:11:5751 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
Mark de Weverde6827b2023-02-24 20:35:4152 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> // since C++20
Nikolas Klauser3b470d12022-02-11 12:11:5753 constexpr I min_element(I first, S last, Comp comp = {}, Proj proj = {});
54
55 template<forward_range R, class Proj = identity,
Mark de Weverde6827b2023-02-24 20:35:4156 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> // since C++20
Nikolas Klauser3b470d12022-02-11 12:11:5757 constexpr borrowed_iterator_t<R> min_element(R&& r, Comp comp = {}, Proj proj = {});
Nikolas Klauserc2cd15a2022-03-08 22:12:3558
Nikolas Klauser40f7fca32022-05-22 11:43:3759 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
60 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
Mark de Weverde6827b2023-02-24 20:35:4161 constexpr I ranges::max_element(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser40f7fca32022-05-22 11:43:3762
63 template<forward_range R, class Proj = identity,
64 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
Mark de Weverde6827b2023-02-24 20:35:4165 constexpr borrowed_iterator_t<R> ranges::max_element(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser40f7fca32022-05-22 11:43:3766
Konstantin Varlamov79a2b4b2022-06-28 18:59:5967 template<class I1, class I2>
68 using mismatch_result = in_in_result<I1, I2>;
69
Nikolas Klauserc2cd15a2022-03-08 22:12:3570 template <input_iterator I1, sentinel_for<_I1> S1, input_iterator I2, sentinel_for<_I2> S2,
71 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
72 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
Mark de Weverde6827b2023-02-24 20:35:4173 constexpr mismatch_result<_I1, _I2> // since C++20
74 mismatch()(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {})
Nikolas Klauserc2cd15a2022-03-08 22:12:3575
76 template <input_range R1, input_range R2,
77 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
78 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
79 constexpr mismatch_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
Mark de Weverde6827b2023-02-24 20:35:4180 mismatch(R1&& r1, R2&& r2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}) // since C++20
Nikolas Klauseree0f8c42022-03-12 00:45:3581
Nikolas Klauseree0f8c42022-03-12 00:45:3582 requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
Mark de Weverde6827b2023-02-24 20:35:4183 constexpr I find(I first, S last, const T& value, Proj proj = {}); // since C++20
Nikolas Klauseree0f8c42022-03-12 00:45:3584
85 template<input_range R, class T, class Proj = identity>
86 requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
87 constexpr borrowed_iterator_t<R>
Mark de Weverde6827b2023-02-24 20:35:4188 find(R&& r, const T& value, Proj proj = {}); // since C++20
Nikolas Klauseree0f8c42022-03-12 00:45:3589
90 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
91 indirect_unary_predicate<projected<I, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:4192 constexpr I find_if(I first, S last, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauseree0f8c42022-03-12 00:45:3593
94 template<input_range R, class Proj = identity,
95 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
96 constexpr borrowed_iterator_t<R>
Mark de Weverde6827b2023-02-24 20:35:4197 find_if(R&& r, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauseree0f8c42022-03-12 00:45:3598
99 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
100 indirect_unary_predicate<projected<I, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:41101 constexpr I find_if_not(I first, S last, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauseree0f8c42022-03-12 00:45:35102
103 template<input_range R, class Proj = identity,
104 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
105 constexpr borrowed_iterator_t<R>
Mark de Weverde6827b2023-02-24 20:35:41106 find_if_not(R&& r, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauserf83d8332022-03-18 01:57:08107
nicole mazzuca04760bf2024-07-19 16:42:16108 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity>
109 requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
110 constexpr subrange<I> find_last(I first, S last, const T& value, Proj proj = {}); // since C++23
111
112 template<forward_range R, class T, class Proj = identity>
113 requires
114 indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
115 constexpr borrowed_subrange_t<R> find_last(R&& r, const T& value, Proj proj = {}); // since C++23
116
117 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
118 indirect_unary_predicate<projected<I, Proj>> Pred>
119 constexpr subrange<I> find_last_if(I first, S last, Pred pred, Proj proj = {}); // since C++23
120
121 template<forward_range R, class Proj = identity,
122 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
123 constexpr borrowed_subrange_t<R> find_last_if(R&& r, Pred pred, Proj proj = {}); // since C++23
124
125 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
126 indirect_unary_predicate<projected<I, Proj>> Pred>
127 constexpr subrange<I> find_last_if_not(I first, S last, Pred pred, Proj proj = {}); // since C++23
128
129 template<forward_range R, class Proj = identity,
130 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
131 constexpr borrowed_subrange_t<R> find_last_if_not(R&& r, Pred pred, Proj proj = {}); // since C++23
132
Nikolas Klausere476df52022-04-03 07:17:01133 template<class T, class Proj = identity,
134 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
Mark de Weverde6827b2023-02-24 20:35:41135 constexpr const T& min(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauserf83d8332022-03-18 01:57:08136
Nikolas Klausere476df52022-04-03 07:17:01137 template<copyable T, class Proj = identity,
138 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
Mark de Weverde6827b2023-02-24 20:35:41139 constexpr T min(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauserf83d8332022-03-18 01:57:08140
141 template<input_range R, class Proj = identity,
142 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
143 requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
144 constexpr range_value_t<R>
Mark de Weverde6827b2023-02-24 20:35:41145 min(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klausere476df52022-04-03 07:17:01146
147 template<class T, class Proj = identity,
148 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
Mark de Weverde6827b2023-02-24 20:35:41149 constexpr const T& max(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klausere476df52022-04-03 07:17:01150
151 template<copyable T, class Proj = identity,
152 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
Mark de Weverde6827b2023-02-24 20:35:41153 constexpr T max(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klausere476df52022-04-03 07:17:01154
155 template<input_range R, class Proj = identity,
156 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
157 requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
158 constexpr range_value_t<R>
Mark de Weverde6827b2023-02-24 20:35:41159 max(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser3ba85482022-04-05 09:05:36160
161 template<class I, class O>
Mark de Weverde6827b2023-02-24 20:35:41162 using unary_transform_result = in_out_result<I, O>; // since C++20
Nikolas Klauser3ba85482022-04-05 09:05:36163
164 template<class I1, class I2, class O>
Mark de Weverde6827b2023-02-24 20:35:41165 using binary_transform_result = in_in_out_result<I1, I2, O>; // since C++20
Nikolas Klauser3ba85482022-04-05 09:05:36166
167 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O,
168 copy_constructible F, class Proj = identity>
169 requires indirectly_writable<O, indirect_result_t<F&, projected<I, Proj>>>
170 constexpr ranges::unary_transform_result<I, O>
Mark de Weverde6827b2023-02-24 20:35:41171 transform(I first1, S last1, O result, F op, Proj proj = {}); // since C++20
Nikolas Klauser3ba85482022-04-05 09:05:36172
173 template<input_range R, weakly_incrementable O, copy_constructible F,
174 class Proj = identity>
175 requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R>, Proj>>>
176 constexpr ranges::unary_transform_result<borrowed_iterator_t<R>, O>
Mark de Weverde6827b2023-02-24 20:35:41177 transform(R&& r, O result, F op, Proj proj = {}); // since C++20
Nikolas Klauser3ba85482022-04-05 09:05:36178
179 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
180 weakly_incrementable O, copy_constructible F, class Proj1 = identity,
181 class Proj2 = identity>
182 requires indirectly_writable<O, indirect_result_t<F&, projected<I1, Proj1>,
183 projected<I2, Proj2>>>
184 constexpr ranges::binary_transform_result<I1, I2, O>
185 transform(I1 first1, S1 last1, I2 first2, S2 last2, O result,
Mark de Weverde6827b2023-02-24 20:35:41186 F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauser3ba85482022-04-05 09:05:36187
188 template<input_range R1, input_range R2, weakly_incrementable O,
189 copy_constructible F, class Proj1 = identity, class Proj2 = identity>
190 requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R1>, Proj1>,
191 projected<iterator_t<R2>, Proj2>>>
192 constexpr ranges::binary_transform_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
193 transform(R1&& r1, R2&& r2, O result,
Mark de Weverde6827b2023-02-24 20:35:41194 F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauser1306b102022-04-07 11:02:02195
196 template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity>
197 requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
198 constexpr iter_difference_t<I>
Mark de Weverde6827b2023-02-24 20:35:41199 count(I first, S last, const T& value, Proj proj = {}); // since C++20
Nikolas Klauser1306b102022-04-07 11:02:02200
201 template<input_range R, class T, class Proj = identity>
202 requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
203 constexpr range_difference_t<R>
Mark de Weverde6827b2023-02-24 20:35:41204 count(R&& r, const T& value, Proj proj = {}); // since C++20
Nikolas Klauser1306b102022-04-07 11:02:02205
206 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
207 indirect_unary_predicate<projected<I, Proj>> Pred>
208 constexpr iter_difference_t<I>
Mark de Weverde6827b2023-02-24 20:35:41209 count_if(I first, S last, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser1306b102022-04-07 11:02:02210
211 template<input_range R, class Proj = identity,
212 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
213 constexpr range_difference_t<R>
Mark de Weverde6827b2023-02-24 20:35:41214 count_if(R&& r, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser58d9ab72022-04-13 20:59:09215
Konstantin Varlamov79a2b4b2022-06-28 18:59:59216 template<class T>
217 using minmax_result = min_max_result<T>;
218
Nikolas Klauser58d9ab72022-04-13 20:59:09219 template<class T, class Proj = identity,
220 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
221 constexpr ranges::minmax_result<const T&>
Mark de Weverde6827b2023-02-24 20:35:41222 minmax(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser58d9ab72022-04-13 20:59:09223
224 template<copyable T, class Proj = identity,
225 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
226 constexpr ranges::minmax_result<T>
Mark de Weverde6827b2023-02-24 20:35:41227 minmax(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser58d9ab72022-04-13 20:59:09228
229 template<input_range R, class Proj = identity,
230 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
231 requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
232 constexpr ranges::minmax_result<range_value_t<R>>
Mark de Weverde6827b2023-02-24 20:35:41233 minmax(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser58d9ab72022-04-13 20:59:09234
Konstantin Varlamov79a2b4b2022-06-28 18:59:59235 template<class I>
236 using minmax_element_result = min_max_result<I>;
237
Nikolas Klauser58d9ab72022-04-13 20:59:09238 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
239 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
240 constexpr ranges::minmax_element_result<I>
Mark de Weverde6827b2023-02-24 20:35:41241 minmax_element(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser58d9ab72022-04-13 20:59:09242
243 template<forward_range R, class Proj = identity,
244 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
245 constexpr ranges::minmax_element_result<borrowed_iterator_t<R>>
Mark de Weverde6827b2023-02-24 20:35:41246 minmax_element(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser1d837502022-04-15 11:43:40247
ZijunZhaoCCKa6b846a2024-02-13 23:42:37248 template<forward_iterator I1, sentinel_for<I1> S1,
249 forward_iterator I2, sentinel_for<I2> S2,
250 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
251 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
252 constexpr bool contains_subrange(I1 first1, S1 last1, I2 first2, S2 last2,
253 Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23
254
255 template<forward_range R1, forward_range R2,
256 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
257 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
258 constexpr bool contains_subrange(R1&& r1, R2&& r2, Pred pred = {},
259 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23
260
Nikolas Klauser1d837502022-04-15 11:43:40261 template<class I, class O>
Mark de Weverde6827b2023-02-24 20:35:41262 using copy_result = in_out_result<I, O>; // since C++20
Nikolas Klauser1d837502022-04-15 11:43:40263
Konstantin Varlamov79a2b4b2022-06-28 18:59:59264 template<class I, class O>
Mark de Weverde6827b2023-02-24 20:35:41265 using copy_n_result = in_out_result<I, O>; // since C++20
Nikolas Klauser1d837502022-04-15 11:43:40266
267 template<class I, class O>
268 using copy_if_result = in_out_result<I, O>; // since C++20
269
270 template<class I1, class I2>
271 using copy_backward_result = in_out_result<I1, I2>; // since C++20
272
ZijunZhaoCCKfdd089b2023-12-20 00:34:19273 template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity>
274 requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
275 constexpr bool ranges::contains(I first, S last, const T& value, Proj proj = {}); // since C++23
276
277 template<input_range R, class T, class Proj = identity>
278 requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
279 constexpr bool ranges::contains(R&& r, const T& value, Proj proj = {}); // since C++23
280
Nikolas Klauser1d837502022-04-15 11:43:40281 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O>
282 requires indirectly_copyable<I, O>
283 constexpr ranges::copy_result<I, O> ranges::copy(I first, S last, O result); // since C++20
284
285 template<input_range R, weakly_incrementable O>
286 requires indirectly_copyable<iterator_t<R>, O>
287 constexpr ranges::copy_result<borrowed_iterator_t<R>, O> ranges::copy(R&& r, O result); // since C++20
288
289 template<input_iterator I, weakly_incrementable O>
290 requires indirectly_copyable<I, O>
291 constexpr ranges::copy_n_result<I, O>
292 ranges::copy_n(I first, iter_difference_t<I> n, O result); // since C++20
293
294 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Proj = identity,
295 indirect_unary_predicate<projected<I, Proj>> Pred>
296 requires indirectly_copyable<I, O>
297 constexpr ranges::copy_if_result<I, O>
298 ranges::copy_if(I first, S last, O result, Pred pred, Proj proj = {}); // since C++20
299
300 template<input_range R, weakly_incrementable O, class Proj = identity,
301 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
302 requires indirectly_copyable<iterator_t<R>, O>
303 constexpr ranges::copy_if_result<borrowed_iterator_t<R>, O>
304 ranges::copy_if(R&& r, O result, Pred pred, Proj proj = {}); // since C++20
305
306 template<bidirectional_iterator I1, sentinel_for<I1> S1, bidirectional_iterator I2>
307 requires indirectly_copyable<I1, I2>
308 constexpr ranges::copy_backward_result<I1, I2>
309 ranges::copy_backward(I1 first, S1 last, I2 result); // since C++20
310
311 template<bidirectional_range R, bidirectional_iterator I>
312 requires indirectly_copyable<iterator_t<R>, I>
313 constexpr ranges::copy_backward_result<borrowed_iterator_t<R>, I>
314 ranges::copy_backward(R&& r, I result); // since C++20
Nikolas Klauser80045e92022-05-04 18:27:07315
316 template<class I, class F>
317 using for_each_result = in_fun_result<I, F>; // since C++20
318
Louis Dionne09e3a362024-09-16 19:06:20319 template<class I, class F>
320 using for_each_n_result = in_fun_result<I, F>; // since C++20
321
Nikolas Klauser80045e92022-05-04 18:27:07322 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
323 indirectly_unary_invocable<projected<I, Proj>> Fun>
324 constexpr ranges::for_each_result<I, Fun>
325 ranges::for_each(I first, S last, Fun f, Proj proj = {}); // since C++20
326
327 template<input_range R, class Proj = identity,
328 indirectly_unary_invocable<projected<iterator_t<R>, Proj>> Fun>
329 constexpr ranges::for_each_result<borrowed_iterator_t<R>, Fun>
330 ranges::for_each(R&& r, Fun f, Proj proj = {}); // since C++20
331
332 template<input_iterator I, class Proj = identity,
333 indirectly_unary_invocable<projected<I, Proj>> Fun>
334 constexpr ranges::for_each_n_result<I, Fun>
335 ranges::for_each_n(I first, iter_difference_t<I> n, Fun f, Proj proj = {}); // since C++20
Nikolas Klauser37ba1b92022-05-04 12:19:09336
337 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
338 indirect_unary_predicate<projected<I, Proj>> Pred>
339 constexpr bool ranges::is_partitioned(I first, S last, Pred pred, Proj proj = {}); // since C++20
340
341 template<input_range R, class Proj = identity,
342 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
343 constexpr bool ranges::is_partitioned(R&& r, Pred pred, Proj proj = {}); // since C++20
344
Konstantin Varlamovc945bd02022-07-08 20:46:27345 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
346 class Proj = identity>
347 requires sortable<I, Comp, Proj>
348 constexpr I
349 ranges::push_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
350
351 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
352 requires sortable<iterator_t<R>, Comp, Proj>
353 constexpr borrowed_iterator_t<R>
354 ranges::push_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
355
356 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
357 class Proj = identity>
358 requires sortable<I, Comp, Proj>
359 constexpr I
360 ranges::pop_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
361
362 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
363 requires sortable<iterator_t<R>, Comp, Proj>
364 constexpr borrowed_iterator_t<R>
365 ranges::pop_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
366
367 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
368 class Proj = identity>
369 requires sortable<I, Comp, Proj>
370 constexpr I
371 ranges::make_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
372
373 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
374 requires sortable<iterator_t<R>, Comp, Proj>
375 constexpr borrowed_iterator_t<R>
376 ranges::make_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
377
378 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
379 class Proj = identity>
380 requires sortable<I, Comp, Proj>
381 constexpr I
382 ranges::sort_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
383
384 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
385 requires sortable<iterator_t<R>, Comp, Proj>
386 constexpr borrowed_iterator_t<R>
387 ranges::sort_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
388
Konstantin Varlamovd406c642022-07-26 23:11:09389 template<random_access_iterator I, sentinel_for<I> S, class Proj = identity,
390 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
Mark de Weverde6827b2023-02-24 20:35:41391 constexpr bool is_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
Konstantin Varlamovd406c642022-07-26 23:11:09392
393 template<random_access_range R, class Proj = identity,
394 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
Mark de Weverde6827b2023-02-24 20:35:41395 constexpr bool is_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Konstantin Varlamovd406c642022-07-26 23:11:09396
397 template<random_access_iterator I, sentinel_for<I> S, class Proj = identity,
398 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
Mark de Weverde6827b2023-02-24 20:35:41399 constexpr I is_heap_until(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
Konstantin Varlamovd406c642022-07-26 23:11:09400
401 template<random_access_range R, class Proj = identity,
402 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
403 constexpr borrowed_iterator_t<R>
Mark de Weverde6827b2023-02-24 20:35:41404 is_heap_until(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Konstantin Varlamovd406c642022-07-26 23:11:09405
Nikolas Klauser1d1a1912022-05-24 08:32:50406 template<bidirectional_iterator I, sentinel_for<I> S>
407 requires permutable<I>
408 constexpr I ranges::reverse(I first, S last); // since C++20
409
410 template<bidirectional_range R>
411 requires permutable<iterator_t<R>>
412 constexpr borrowed_iterator_t<R> ranges::reverse(R&& r); // since C++20
413
Konstantin Varlamovff3989e2022-06-16 22:20:53414 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
415 class Proj = identity>
416 requires sortable<I, Comp, Proj>
417 constexpr I
Konstantin Varlamov94c7b892022-07-01 23:34:08418 ranges::sort(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
Konstantin Varlamovff3989e2022-06-16 22:20:53419
420 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
421 requires sortable<iterator_t<R>, Comp, Proj>
422 constexpr borrowed_iterator_t<R>
Konstantin Varlamov94c7b892022-07-01 23:34:08423 ranges::sort(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
424
425 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
426 class Proj = identity>
427 requires sortable<I, Comp, Proj>
A. Jiangba9aeed2025-03-06 17:27:48428 constexpr I // constexpr since C++26
429 ranges::stable_sort(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
Konstantin Varlamov94c7b892022-07-01 23:34:08430
431 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
432 requires sortable<iterator_t<R>, Comp, Proj>
A. Jiangba9aeed2025-03-06 17:27:48433 constexpr borrowed_iterator_t<R> // constexpr since C++26
Konstantin Varlamov94c7b892022-07-01 23:34:08434 ranges::stable_sort(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Konstantin Varlamovff3989e2022-06-16 22:20:53435
varconst5dd19ad2022-07-20 03:10:02436 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
437 class Proj = identity>
438 requires sortable<I, Comp, Proj>
439 constexpr I
440 ranges::partial_sort(I first, I middle, S last, Comp comp = {}, Proj proj = {}); // since C++20
441
442 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
443 requires sortable<iterator_t<R>, Comp, Proj>
444 constexpr borrowed_iterator_t<R>
445 ranges::partial_sort(R&& r, iterator_t<R> middle, Comp comp = {}, Proj proj = {}); // since C++20
446
Nikolas Klauser7af89a32022-05-21 16:26:29447 template<class T, output_iterator<const T&> O, sentinel_for<O> S>
448 constexpr O ranges::fill(O first, S last, const T& value); // since C++20
449
450 template<class T, output_range<const T&> R>
451 constexpr borrowed_iterator_t<R> ranges::fill(R&& r, const T& value); // since C++20
452
453 template<class T, output_iterator<const T&> O>
454 constexpr O ranges::fill_n(O first, iter_difference_t<O> n, const T& value); // since C++20
Nikolas Klauser569d6632022-05-25 09:09:43455
Konstantin Varlamovead73022022-07-26 22:50:14456 template<input_or_output_iterator O, sentinel_for<O> S, copy_constructible F>
457 requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>>
Mark de Weverde6827b2023-02-24 20:35:41458 constexpr O generate(O first, S last, F gen); // since C++20
Konstantin Varlamovead73022022-07-26 22:50:14459
Nikolas Klausercd916102023-06-09 20:45:34460 template<class ExecutionPolicy, class ForwardIterator, class Generator>
461 void generate(ExecutionPolicy&& exec,
462 ForwardIterator first, ForwardIterator last,
463 Generator gen); // since C++17
464
Konstantin Varlamovead73022022-07-26 22:50:14465 template<class R, copy_constructible F>
466 requires invocable<F&> && output_range<R, invoke_result_t<F&>>
Mark de Weverde6827b2023-02-24 20:35:41467 constexpr borrowed_iterator_t<R> generate(R&& r, F gen); // since C++20
Konstantin Varlamovead73022022-07-26 22:50:14468
469 template<input_or_output_iterator O, copy_constructible F>
470 requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>>
Mark de Weverde6827b2023-02-24 20:35:41471 constexpr O generate_n(O first, iter_difference_t<O> n, F gen); // since C++20
Konstantin Varlamovead73022022-07-26 22:50:14472
Nikolas Klausercd916102023-06-09 20:45:34473 template<class ExecutionPolicy, class ForwardIterator, class Size, class Generator>
474 ForwardIterator generate_n(ExecutionPolicy&& exec,
475 ForwardIterator first, Size n, Generator gen); // since C++17
476
Nikolas Klauser569d6632022-05-25 09:09:43477 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
478 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
479 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
480 constexpr bool ranges::equal(I1 first1, S1 last1, I2 first2, S2 last2,
481 Pred pred = {},
482 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
483
484 template<input_range R1, input_range R2, class Pred = ranges::equal_to,
485 class Proj1 = identity, class Proj2 = identity>
486 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
487 constexpr bool ranges::equal(R1&& r1, R2&& r2, Pred pred = {},
488 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
489
Nikolas Klauser0e3dc1a2022-05-26 14:42:46490 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
491 indirect_unary_predicate<projected<I, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:41492 constexpr bool ranges::all_of(I first, S last, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser0e3dc1a2022-05-26 14:42:46493
494 template<input_range R, class Proj = identity,
495 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:41496 constexpr bool ranges::all_of(R&& r, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser0e3dc1a2022-05-26 14:42:46497
498 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
499 indirect_unary_predicate<projected<I, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:41500 constexpr bool ranges::any_of(I first, S last, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser0e3dc1a2022-05-26 14:42:46501
502 template<input_range R, class Proj = identity,
503 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:41504 constexpr bool ranges::any_of(R&& r, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser0e3dc1a2022-05-26 14:42:46505
Zijun Zhao0218ea42023-09-18 18:28:11506 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
507 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
508 requires (forward_iterator<I1> || sized_sentinel_for<S1, I1>) &&
509 (forward_iterator<I2> || sized_sentinel_for<S2, I2>) &&
510 indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
511 constexpr bool ranges::ends_with(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
512 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23
513
514 template<input_range R1, input_range R2, class Pred = ranges::equal_to, class Proj1 = identity,
515 class Proj2 = identity>
516 requires (forward_range<R1> || sized_range<R1>) &&
517 (forward_range<R2> || sized_range<R2>) &&
518 indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
519 constexpr bool ranges::ends_with(R1&& r1, R2&& r2, Pred pred = {},
520 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23
521
Nikolas Klauser0e3dc1a2022-05-26 14:42:46522 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
523 indirect_unary_predicate<projected<I, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:41524 constexpr bool ranges::none_of(I first, S last, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser0e3dc1a2022-05-26 14:42:46525
526 template<input_range R, class Proj = identity,
527 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:41528 constexpr bool ranges::none_of(R&& r, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser0e3dc1a2022-05-26 14:42:46529
zijunzhao20517552023-05-08 22:04:00530 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
531 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
532 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
533 constexpr bool ranges::starts_with(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
534 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23
535
536 template<input_range R1, input_range R2, class Pred = ranges::equal_to, class Proj1 = identity,
537 class Proj2 = identity>
538 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
539 constexpr bool ranges::starts_with(R1&& r1, R2&& r2, Pred pred = {},
540 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23
541
Konstantin Varlamovdb7d7952022-07-30 09:42:05542 template<input_iterator I1, sentinel_for<I1> S1,
543 random_access_iterator I2, sentinel_for<I2> S2,
544 class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
545 requires indirectly_copyable<I1, I2> && sortable<I2, Comp, Proj2> &&
546 indirect_strict_weak_order<Comp, projected<I1, Proj1>, projected<I2, Proj2>>
547 constexpr partial_sort_copy_result<I1, I2>
548 partial_sort_copy(I1 first, S1 last, I2 result_first, S2 result_last,
Mark de Weverde6827b2023-02-24 20:35:41549 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Konstantin Varlamovdb7d7952022-07-30 09:42:05550
551 template<input_range R1, random_access_range R2, class Comp = ranges::less,
552 class Proj1 = identity, class Proj2 = identity>
553 requires indirectly_copyable<iterator_t<R1>, iterator_t<R2>> &&
554 sortable<iterator_t<R2>, Comp, Proj2> &&
555 indirect_strict_weak_order<Comp, projected<iterator_t<R1>, Proj1>,
556 projected<iterator_t<R2>, Proj2>>
557 constexpr partial_sort_copy_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
558 partial_sort_copy(R1&& r, R2&& result_r, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:41559 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Konstantin Varlamovdb7d7952022-07-30 09:42:05560
Nikolas Klauser11e3ad22022-05-26 14:08:55561 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
562 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
563 constexpr bool ranges::is_sorted(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
564
565 template<forward_range R, class Proj = identity,
566 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
567 constexpr bool ranges::is_sorted(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
568
569 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
570 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
571 constexpr I ranges::is_sorted_until(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
572
573 template<forward_range R, class Proj = identity,
574 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
575 constexpr borrowed_iterator_t<R>
576 ranges::is_sorted_until(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser81715862022-06-05 19:15:16577
Konstantin Varlamov23c73282022-07-08 03:35:51578 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
579 class Proj = identity>
580 requires sortable<I, Comp, Proj>
581 constexpr I
Mark de Weverde6827b2023-02-24 20:35:41582 ranges::nth_element(I first, I nth, S last, Comp comp = {}, Proj proj = {}); // since C++20
Konstantin Varlamov23c73282022-07-08 03:35:51583
584 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
585 requires sortable<iterator_t<R>, Comp, Proj>
586 constexpr borrowed_iterator_t<R>
Mark de Weverde6827b2023-02-24 20:35:41587 ranges::nth_element(R&& r, iterator_t<R> nth, Comp comp = {}, Proj proj = {}); // since C++20
Konstantin Varlamov23c73282022-07-08 03:35:51588
Nikolas Klauser81715862022-06-05 19:15:16589 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
Mark de Weverde6827b2023-02-24 20:35:41590 indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less> // since C++20
591 constexpr I upper_bound(I first, S last, const T& value, Comp comp = {}, Proj proj = {});
Nikolas Klauser81715862022-06-05 19:15:16592
593 template<forward_range R, class T, class Proj = identity,
594 indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
595 ranges::less>
596 constexpr borrowed_iterator_t<R>
Mark de Weverde6827b2023-02-24 20:35:41597 upper_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser81715862022-06-05 19:15:16598
599 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
600 indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
601 constexpr I lower_bound(I first, S last, const T& value, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:41602 Proj proj = {}); // since C++20
Nikolas Klauser81715862022-06-05 19:15:16603 template<forward_range R, class T, class Proj = identity,
604 indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
605 ranges::less>
606 constexpr borrowed_iterator_t<R>
Mark de Weverde6827b2023-02-24 20:35:41607 lower_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser81715862022-06-05 19:15:16608
609 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
610 indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
611 constexpr bool binary_search(I first, S last, const T& value, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:41612 Proj proj = {}); // since C++20
Nikolas Klauserb79b2b62022-06-06 11:57:34613
Nikolas Klauser81715862022-06-05 19:15:16614 template<forward_range R, class T, class Proj = identity,
615 indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
616 ranges::less>
617 constexpr bool binary_search(R&& r, const T& value, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:41618 Proj proj = {}); // since C++20
Konstantin Varlamov8ed702b2022-07-19 04:05:51619
620 template<permutable I, sentinel_for<I> S, class Proj = identity,
621 indirect_unary_predicate<projected<I, Proj>> Pred>
622 constexpr subrange<I>
Mark de Weverde6827b2023-02-24 20:35:41623 partition(I first, S last, Pred pred, Proj proj = {}); // since C++20
Konstantin Varlamov8ed702b2022-07-19 04:05:51624
625 template<forward_range R, class Proj = identity,
626 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
627 requires permutable<iterator_t<R>>
628 constexpr borrowed_subrange_t<R>
Mark de Weverde6827b2023-02-24 20:35:41629 partition(R&& r, Pred pred, Proj proj = {}); // since C++20
Konstantin Varlamov8ed702b2022-07-19 04:05:51630
631 template<bidirectional_iterator I, sentinel_for<I> S, class Proj = identity,
632 indirect_unary_predicate<projected<I, Proj>> Pred>
633 requires permutable<I>
A. Jiangc28c5082025-03-06 01:23:55634 constexpr subrange<I> // constexpr since C++26
635 stable_partition(I first, S last, Pred pred, Proj proj = {}); // since C++20
Konstantin Varlamov8ed702b2022-07-19 04:05:51636
637 template<bidirectional_range R, class Proj = identity,
638 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
639 requires permutable<iterator_t<R>>
A. Jiangc28c5082025-03-06 01:23:55640 constexpr borrowed_subrange_t<R> // constexpr since C++26
641 stable_partition(R&& r, Pred pred, Proj proj = {}); // since C++20
Konstantin Varlamov8ed702b2022-07-19 04:05:51642
Nikolas Klauserb79b2b62022-06-06 11:57:34643 template<input_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2,
644 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
645 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
646 constexpr I1 ranges::find_first_of(I1 first1, S1 last1, I2 first2, S2 last2,
647 Pred pred = {},
648 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
649
650 template<input_range R1, forward_range R2,
651 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
652 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
653 constexpr borrowed_iterator_t<R1>
654 ranges::find_first_of(R1&& r1, R2&& r2,
655 Pred pred = {},
656 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauser81715862022-06-05 19:15:16657
Nikolas Klauser916e9052022-06-08 10:14:12658 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
659 indirect_binary_predicate<projected<I, Proj>,
660 projected<I, Proj>> Pred = ranges::equal_to>
Mark de Weverde6827b2023-02-24 20:35:41661 constexpr I ranges::adjacent_find(I first, S last, Pred pred = {}, Proj proj = {}); // since C++20
Nikolas Klauser916e9052022-06-08 10:14:12662
663 template<forward_range R, class Proj = identity,
664 indirect_binary_predicate<projected<iterator_t<R>, Proj>,
665 projected<iterator_t<R>, Proj>> Pred = ranges::equal_to>
666 constexpr borrowed_iterator_t<R> ranges::adjacent_find(R&& r, Pred pred = {}, Proj proj = {}); // since C++20
667
Nikolas Klauserff6d5de2022-06-07 07:42:10668 template<input_iterator I, sentinel_for<I> S, class T1, class T2, class Proj = identity>
669 requires indirectly_writable<I, const T2&> &&
670 indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*>
671 constexpr I
672 ranges::replace(I first, S last, const T1& old_value, const T2& new_value, Proj proj = {}); // since C++20
673
674 template<input_range R, class T1, class T2, class Proj = identity>
675 requires indirectly_writable<iterator_t<R>, const T2&> &&
676 indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T1*>
677 constexpr borrowed_iterator_t<R>
678 ranges::replace(R&& r, const T1& old_value, const T2& new_value, Proj proj = {}); // since C++20
679
680 template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity,
681 indirect_unary_predicate<projected<I, Proj>> Pred>
682 requires indirectly_writable<I, const T&>
683 constexpr I ranges::replace_if(I first, S last, Pred pred, const T& new_value, Proj proj = {}); // since C++20
684
685 template<input_range R, class T, class Proj = identity,
686 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
687 requires indirectly_writable<iterator_t<R>, const T&>
688 constexpr borrowed_iterator_t<R>
689 ranges::replace_if(R&& r, Pred pred, const T& new_value, Proj proj = {}); // since C++20
690
Nikolas Klausera203acb2022-08-03 23:30:50691 template<class T, class Proj = identity,
692 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
693 constexpr const T&
694 ranges::clamp(const T& v, const T& lo, const T& hi, Comp comp = {}, Proj proj = {}); // since C++20
695
Nikolas Klauserafd5a4f2022-06-15 14:24:43696 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
697 class Proj1 = identity, class Proj2 = identity,
698 indirect_strict_weak_order<projected<I1, Proj1>,
699 projected<I2, Proj2>> Comp = ranges::less>
700 constexpr bool
701 ranges::lexicographical_compare(I1 first1, S1 last1, I2 first2, S2 last2,
Mark de Weverde6827b2023-02-24 20:35:41702 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauserafd5a4f2022-06-15 14:24:43703
704 template<input_range R1, input_range R2, class Proj1 = identity,
705 class Proj2 = identity,
706 indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>,
707 projected<iterator_t<R2>, Proj2>> Comp = ranges::less>
708 constexpr bool
709 ranges::lexicographical_compare(R1&& r1, R2&& r2, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:41710 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauserafd5a4f2022-06-15 14:24:43711
Louis Dionne09e3a362024-09-16 19:06:20712 template<class I, class O>
713 using move_result = in_out_result<I, O>; // since C++20
714
715 template<class I, class O>
716 using move_backward_result = in_out_result<I, O>; // since C++20
717
Nikolas Klauser2c3bbac2022-06-23 10:23:41718 template<bidirectional_iterator I1, sentinel_for<I1> S1, bidirectional_iterator I2>
719 requires indirectly_movable<I1, I2>
720 constexpr ranges::move_backward_result<I1, I2>
721 ranges::move_backward(I1 first, S1 last, I2 result); // since C++20
722
723 template<bidirectional_range R, bidirectional_iterator I>
724 requires indirectly_movable<iterator_t<R>, I>
725 constexpr ranges::move_backward_result<borrowed_iterator_t<R>, I>
726 ranges::move_backward(R&& r, I result); // since C++20
727
728 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O>
729 requires indirectly_movable<I, O>
730 constexpr ranges::move_result<I, O>
731 ranges::move(I first, S last, O result); // since C++20
732
733 template<input_range R, weakly_incrementable O>
734 requires indirectly_movable<iterator_t<R>, O>
735 constexpr ranges::move_result<borrowed_iterator_t<R>, O>
736 ranges::move(R&& r, O result); // since C++20
737
Konstantin Varlamov065202f2022-07-20 08:57:13738 template<class I, class O1, class O2>
739 using partition_copy_result = in_out_out_result<I, O1, O2>; // since C++20
740
741 template<input_iterator I, sentinel_for<I> S,
742 weakly_incrementable O1, weakly_incrementable O2,
743 class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
744 requires indirectly_copyable<I, O1> && indirectly_copyable<I, O2>
745 constexpr partition_copy_result<I, O1, O2>
746 partition_copy(I first, S last, O1 out_true, O2 out_false, Pred pred,
Mark de Weverde6827b2023-02-24 20:35:41747 Proj proj = {}); // since C++20
Konstantin Varlamov065202f2022-07-20 08:57:13748
749 template<input_range R, weakly_incrementable O1, weakly_incrementable O2,
750 class Proj = identity,
751 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
752 requires indirectly_copyable<iterator_t<R>, O1> &&
753 indirectly_copyable<iterator_t<R>, O2>
754 constexpr partition_copy_result<borrowed_iterator_t<R>, O1, O2>
Mark de Weverde6827b2023-02-24 20:35:41755 partition_copy(R&& r, O1 out_true, O2 out_false, Pred pred, Proj proj = {}); // since C++20
Konstantin Varlamov065202f2022-07-20 08:57:13756
757 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
758 indirect_unary_predicate<projected<I, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:41759 constexpr I partition_point(I first, S last, Pred pred, Proj proj = {}); // since C++20
Konstantin Varlamov065202f2022-07-20 08:57:13760
761 template<forward_range R, class Proj = identity,
762 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
763 constexpr borrowed_iterator_t<R>
Mark de Weverde6827b2023-02-24 20:35:41764 partition_point(R&& r, Pred pred, Proj proj = {}); // since C++20
Konstantin Varlamov065202f2022-07-20 08:57:13765
Hui Xie25607d12022-06-26 15:13:43766 template<class I1, class I2, class O>
767 using merge_result = in_in_out_result<I1, I2, O>; // since C++20
768
769 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
770 weakly_incrementable O, class Comp = ranges::less, class Proj1 = identity,
771 class Proj2 = identity>
772 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
773 constexpr merge_result<I1, I2, O>
774 merge(I1 first1, S1 last1, I2 first2, S2 last2, O result,
775 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
776
777 template<input_range R1, input_range R2, weakly_incrementable O, class Comp = ranges::less,
778 class Proj1 = identity, class Proj2 = identity>
779 requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
780 constexpr merge_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
781 merge(R1&& r1, R2&& r2, O result,
782 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauser2c3bbac2022-06-23 10:23:41783
Nikolas Klauserf8cbe3cdf2022-07-06 12:03:00784 template<permutable I, sentinel_for<I> S, class T, class Proj = identity>
785 requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
786 constexpr subrange<I> ranges::remove(I first, S last, const T& value, Proj proj = {}); // since C++20
787
788 template<forward_range R, class T, class Proj = identity>
789 requires permutable<iterator_t<R>> &&
790 indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
791 constexpr borrowed_subrange_t<R>
792 ranges::remove(R&& r, const T& value, Proj proj = {}); // since C++20
793
794 template<permutable I, sentinel_for<I> S, class Proj = identity,
795 indirect_unary_predicate<projected<I, Proj>> Pred>
796 constexpr subrange<I> ranges::remove_if(I first, S last, Pred pred, Proj proj = {}); // since C++20
797
798 template<forward_range R, class Proj = identity,
799 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
800 requires permutable<iterator_t<R>>
801 constexpr borrowed_subrange_t<R>
802 ranges::remove_if(R&& r, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser7d426a32022-07-11 15:07:35803
Hui Xie1cdec6c2022-06-26 15:13:43804 template<class I, class O>
Nikolas Klauser7d426a32022-07-11 15:07:35805 using set_difference_result = in_out_result<I, O>; // since C++20
Hui Xie1cdec6c2022-06-26 15:13:43806
807 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
808 weakly_incrementable O, class Comp = ranges::less,
809 class Proj1 = identity, class Proj2 = identity>
810 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
811 constexpr set_difference_result<I1, O>
812 set_difference(I1 first1, S1 last1, I2 first2, S2 last2, O result,
813 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
814
815 template<input_range R1, input_range R2, weakly_incrementable O,
816 class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
817 requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
818 constexpr set_difference_result<borrowed_iterator_t<R1>, O>
819 set_difference(R1&& r1, R2&& r2, O result,
820 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauserf8cbe3cdf2022-07-06 12:03:00821
Hui Xie96b674f2022-07-08 14:21:40822 template<class I1, class I2, class O>
823 using set_intersection_result = in_in_out_result<I1, I2, O>; // since C++20
824
825 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
826 weakly_incrementable O, class Comp = ranges::less,
827 class Proj1 = identity, class Proj2 = identity>
828 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
829 constexpr set_intersection_result<I1, I2, O>
830 set_intersection(I1 first1, S1 last1, I2 first2, S2 last2, O result,
831 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
832
833 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
834 weakly_incrementable O, class Comp = ranges::less,
835 class Proj1 = identity, class Proj2 = identity>
836 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
837 constexpr set_intersection_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
838 set_intersection(R1&& r1, R2&& r2, O result,
839 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
840
Nikolas Klauser7d426a32022-07-11 15:07:35841 template <class _InIter, class _OutIter>
842 using reverse_copy_result = in_out_result<_InIter, _OutIter>; // since C++20
843
844 template<bidirectional_iterator I, sentinel_for<I> S, weakly_incrementable O>
845 requires indirectly_copyable<I, O>
846 constexpr ranges::reverse_copy_result<I, O>
847 ranges::reverse_copy(I first, S last, O result); // since C++20
848
849 template<bidirectional_range R, weakly_incrementable O>
850 requires indirectly_copyable<iterator_t<R>, O>
851 constexpr ranges::reverse_copy_result<borrowed_iterator_t<R>, O>
852 ranges::reverse_copy(R&& r, O result); // since C++20
853
Konstantin Varlamov36c746c2022-08-03 23:04:14854 template<permutable I, sentinel_for<I> S>
855 constexpr subrange<I> rotate(I first, I middle, S last); // since C++20
856
857 template<forward_range R>
858 requires permutable<iterator_t<R>>
Mark de Weverde6827b2023-02-24 20:35:41859 constexpr borrowed_subrange_t<R> rotate(R&& r, iterator_t<R> middle); // since C++20
Konstantin Varlamov36c746c2022-08-03 23:04:14860
Nikolas Klauser7d426a32022-07-11 15:07:35861 template <class _InIter, class _OutIter>
862 using rotate_copy_result = in_out_result<_InIter, _OutIter>; // since C++20
863
864 template<forward_iterator I, sentinel_for<I> S, weakly_incrementable O>
865 requires indirectly_copyable<I, O>
866 constexpr ranges::rotate_copy_result<I, O>
867 ranges::rotate_copy(I first, I middle, S last, O result); // since C++20
868
869 template<forward_range R, weakly_incrementable O>
870 requires indirectly_copyable<iterator_t<R>, O>
871 constexpr ranges::rotate_copy_result<borrowed_iterator_t<R>, O>
872 ranges::rotate_copy(R&& r, iterator_t<R> middle, O result); // since C++20
873
Konstantin Varlamov6bdb6422022-08-03 05:33:12874 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Gen>
875 requires (forward_iterator<I> || random_access_iterator<O>) &&
876 indirectly_copyable<I, O> &&
877 uniform_random_bit_generator<remove_reference_t<Gen>>
Mark de Weverde6827b2023-02-24 20:35:41878 O sample(I first, S last, O out, iter_difference_t<I> n, Gen&& g); // since C++20
Konstantin Varlamov6bdb6422022-08-03 05:33:12879
880 template<input_range R, weakly_incrementable O, class Gen>
881 requires (forward_range<R> || random_access_iterator<O>) &&
882 indirectly_copyable<iterator_t<R>, O> &&
883 uniform_random_bit_generator<remove_reference_t<Gen>>
Mark de Weverde6827b2023-02-24 20:35:41884 O sample(R&& r, O out, range_difference_t<R> n, Gen&& g); // since C++20
Konstantin Varlamov6bdb6422022-08-03 05:33:12885
Konstantin Varlamov14cf74d2022-07-22 16:58:56886 template<random_access_iterator I, sentinel_for<I> S, class Gen>
887 requires permutable<I> &&
888 uniform_random_bit_generator<remove_reference_t<Gen>>
Mark de Weverde6827b2023-02-24 20:35:41889 I shuffle(I first, S last, Gen&& g); // since C++20
Konstantin Varlamov14cf74d2022-07-22 16:58:56890
891 template<random_access_range R, class Gen>
892 requires permutable<iterator_t<R>> &&
893 uniform_random_bit_generator<remove_reference_t<Gen>>
Mark de Weverde6827b2023-02-24 20:35:41894 borrowed_iterator_t<R> shuffle(R&& r, Gen&& g); // since C++20
Konstantin Varlamov14cf74d2022-07-22 16:58:56895
Nikolas Klauser101d1e92022-07-13 16:07:26896 template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2,
Nikolas Klauser4038c852022-08-04 17:54:13897 sentinel_for<I2> S2, class Proj1 = identity, class Proj2 = identity,
898 indirect_equivalence_relation<projected<I1, Proj1>,
899 projected<I2, Proj2>> Pred = ranges::equal_to>
900 constexpr bool ranges::is_permutation(I1 first1, S1 last1, I2 first2, S2 last2,
901 Pred pred = {},
Mark de Weverde6827b2023-02-24 20:35:41902 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauser4038c852022-08-04 17:54:13903
904 template<forward_range R1, forward_range R2,
905 class Proj1 = identity, class Proj2 = identity,
906 indirect_equivalence_relation<projected<iterator_t<R1>, Proj1>,
907 projected<iterator_t<R2>, Proj2>> Pred = ranges::equal_to>
908 constexpr bool ranges::is_permutation(R1&& r1, R2&& r2, Pred pred = {},
Mark de Weverde6827b2023-02-24 20:35:41909 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauser4038c852022-08-04 17:54:13910
911 template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2,
Nikolas Klauser101d1e92022-07-13 16:07:26912 sentinel_for<I2> S2, class Pred = ranges::equal_to,
913 class Proj1 = identity, class Proj2 = identity>
914 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
915 constexpr subrange<I1>
916 ranges::search(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
917 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
918
919 template<forward_range R1, forward_range R2, class Pred = ranges::equal_to,
920 class Proj1 = identity, class Proj2 = identity>
921 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
922 constexpr borrowed_subrange_t<R1>
923 ranges::search(R1&& r1, R2&& r2, Pred pred = {},
924 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
925
926 template<forward_iterator I, sentinel_for<I> S, class T,
927 class Pred = ranges::equal_to, class Proj = identity>
928 requires indirectly_comparable<I, const T*, Pred, Proj>
929 constexpr subrange<I>
930 ranges::search_n(I first, S last, iter_difference_t<I> count,
931 const T& value, Pred pred = {}, Proj proj = {}); // since C++20
932
933 template<forward_range R, class T, class Pred = ranges::equal_to,
934 class Proj = identity>
935 requires indirectly_comparable<iterator_t<R>, const T*, Pred, Proj>
936 constexpr borrowed_subrange_t<R>
937 ranges::search_n(R&& r, range_difference_t<R> count,
938 const T& value, Pred pred = {}, Proj proj = {}); // since C++20
939
Christopher Di Bella39034382023-12-20 05:57:50940 template<input_iterator I, sentinel_for<I> S, class T,
941 indirectly-binary-left-foldable<T, I> F>
942 constexpr auto ranges::fold_left(I first, S last, T init, F f); // since C++23
943
944 template<input_range R, class T, indirectly-binary-left-foldable<T, iterator_t<R>> F>
945 constexpr auto fold_left(R&& r, T init, F f); // since C++23
946
947 template<class I, class T>
948 using fold_left_with_iter_result = in_value_result<I, T>; // since C++23
949
950 template<input_iterator I, sentinel_for<I> S, class T,
951 indirectly-binary-left-foldable<T, I> F>
952 constexpr see below fold_left_with_iter(I first, S last, T init, F f); // since C++23
953
954 template<input_range R, class T, indirectly-binary-left-foldable<T, iterator_t<R>> F>
955 constexpr see below fold_left_with_iter(R&& r, T init, F f); // since C++23
956
Nikolas Klauser101d1e92022-07-13 16:07:26957 template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2,
958 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
959 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
960 constexpr subrange<I1>
961 ranges::find_end(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
962 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
963
964 template<forward_range R1, forward_range R2,
965 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
966 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
967 constexpr borrowed_subrange_t<R1>
968 ranges::find_end(R1&& r1, R2&& r2, Pred pred = {},
969 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
970
Hui Xiea5c06382022-07-11 22:39:59971 template<class I1, class I2, class O>
972 using set_symmetric_difference_result = in_in_out_result<I1, I2, O>; // since C++20
973
974 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
975 weakly_incrementable O, class Comp = ranges::less,
976 class Proj1 = identity, class Proj2 = identity>
977 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
978 constexpr set_symmetric_difference_result<I1, I2, O>
979 set_symmetric_difference(I1 first1, S1 last1, I2 first2, S2 last2, O result,
980 Comp comp = {}, Proj1 proj1 = {},
981 Proj2 proj2 = {}); // since C++20
Hui Xie8a617492022-07-27 12:20:16982
Hui Xiea5c06382022-07-11 22:39:59983 template<input_range R1, input_range R2, weakly_incrementable O,
984 class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
985 requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
986 constexpr set_symmetric_difference_result<borrowed_iterator_t<R1>,
987 borrowed_iterator_t<R2>, O>
988 set_symmetric_difference(R1&& r1, R2&& r2, O result, Comp comp = {},
989 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Hui Xie0f6364b82022-07-14 19:35:15990
991 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
992 indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
993 constexpr subrange<I>
994 equal_range(I first, S last, const T& value, Comp comp = {}, Proj proj = {}); // since C++20
Hui Xie8a617492022-07-27 12:20:16995
Hui Xie0f6364b82022-07-14 19:35:15996 template<forward_range R, class T, class Proj = identity,
997 indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
998 ranges::less>
999 constexpr borrowed_subrange_t<R>
1000 equal_range(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20
Hui Xie8a617492022-07-27 12:20:161001
Hui Xie3151b952022-07-13 16:20:221002 template<class I1, class I2, class O>
1003 using set_union_result = in_in_out_result<I1, I2, O>; // since C++20
1004
1005 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
1006 weakly_incrementable O, class Comp = ranges::less,
1007 class Proj1 = identity, class Proj2 = identity>
1008 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
1009 constexpr set_union_result<I1, I2, O>
1010 set_union(I1 first1, S1 last1, I2 first2, S2 last2, O result, Comp comp = {},
1011 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
1012
1013 template<input_range R1, input_range R2, weakly_incrementable O,
1014 class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
1015 requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
1016 constexpr set_union_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
1017 set_union(R1&& r1, R2&& r2, O result, Comp comp = {},
1018 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Hui Xiec5599642022-07-19 19:54:351019
1020 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
1021 class Proj1 = identity, class Proj2 = identity,
1022 indirect_strict_weak_order<projected<I1, Proj1>, projected<I2, Proj2>> Comp =
1023 ranges::less>
1024 constexpr bool includes(I1 first1, S1 last1, I2 first2, S2 last2, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:411025 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Hui Xie8a617492022-07-27 12:20:161026
Hui Xiec5599642022-07-19 19:54:351027 template<input_range R1, input_range R2, class Proj1 = identity,
1028 class Proj2 = identity,
1029 indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>,
1030 projected<iterator_t<R2>, Proj2>> Comp = ranges::less>
1031 constexpr bool includes(R1&& r1, R2&& r2, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:411032 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Hui Xie8a617492022-07-27 12:20:161033
1034 template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
1035 class Proj = identity>
1036 requires sortable<I, Comp, Proj>
A. Jiang053a7142025-03-19 17:59:321037 constexpr I // constexpr since C++26
1038 inplace_merge(I first, I middle, S last, Comp comp = {}, Proj proj = {}); // since C++20
Hui Xie8a617492022-07-27 12:20:161039
1040 template<bidirectional_range R, class Comp = ranges::less, class Proj = identity>
1041 requires sortable<iterator_t<R>, Comp, Proj>
A. Jiang053a7142025-03-19 17:59:321042 constexpr borrowed_iterator_t<R> // constexpr since C++26
Hui Xie8a617492022-07-27 12:20:161043 inplace_merge(R&& r, iterator_t<R> middle, Comp comp = {},
A. Jiang053a7142025-03-19 17:59:321044 Proj proj = {}); // since C++20
Hui Xie72f57e32022-07-23 00:44:251045
1046 template<permutable I, sentinel_for<I> S, class Proj = identity,
1047 indirect_equivalence_relation<projected<I, Proj>> C = ranges::equal_to>
Mark de Weverde6827b2023-02-24 20:35:411048 constexpr subrange<I> unique(I first, S last, C comp = {}, Proj proj = {}); // since C++20
Hui Xie72f57e32022-07-23 00:44:251049
1050 template<forward_range R, class Proj = identity,
1051 indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to>
1052 requires permutable<iterator_t<R>>
1053 constexpr borrowed_subrange_t<R>
Mark de Weverde6827b2023-02-24 20:35:411054 unique(R&& r, C comp = {}, Proj proj = {}); // since C++20
Hui Xie72f57e32022-07-23 00:44:251055
1056 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Proj = identity,
1057 indirect_equivalence_relation<projected<I, Proj>> C = ranges::equal_to>
1058 requires indirectly_copyable<I, O> &&
1059 (forward_iterator<I> ||
1060 (input_iterator<O> && same_as<iter_value_t<I>, iter_value_t<O>>) ||
1061 indirectly_copyable_storable<I, O>)
1062 constexpr unique_copy_result<I, O>
Mark de Weverde6827b2023-02-24 20:35:411063 unique_copy(I first, S last, O result, C comp = {}, Proj proj = {}); // since C++20
Hui Xie72f57e32022-07-23 00:44:251064
1065 template<input_range R, weakly_incrementable O, class Proj = identity,
1066 indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to>
1067 requires indirectly_copyable<iterator_t<R>, O> &&
1068 (forward_iterator<iterator_t<R>> ||
1069 (input_iterator<O> && same_as<range_value_t<R>, iter_value_t<O>>) ||
1070 indirectly_copyable_storable<iterator_t<R>, O>)
1071 constexpr unique_copy_result<borrowed_iterator_t<R>, O>
Mark de Weverde6827b2023-02-24 20:35:411072 unique_copy(R&& r, O result, C comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591073
1074 template<class I, class O>
Mark de Weverde6827b2023-02-24 20:35:411075 using remove_copy_result = in_out_result<I, O>; // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591076
1077 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class T,
1078 class Proj = identity>
1079 indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
1080 constexpr remove_copy_result<I, O>
Mark de Weverde6827b2023-02-24 20:35:411081 remove_copy(I first, S last, O result, const T& value, Proj proj = {}); // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591082
1083 template<input_range R, weakly_incrementable O, class T, class Proj = identity>
1084 requires indirectly_copyable<iterator_t<R>, O> &&
1085 indirect_binary_predicate<ranges::equal_to,
1086 projected<iterator_t<R>, Proj>, const T*>
1087 constexpr remove_copy_result<borrowed_iterator_t<R>, O>
Mark de Weverde6827b2023-02-24 20:35:411088 remove_copy(R&& r, O result, const T& value, Proj proj = {}); // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591089
1090 template<class I, class O>
Mark de Weverde6827b2023-02-24 20:35:411091 using remove_copy_if_result = in_out_result<I, O>; // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591092
1093 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O,
1094 class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
1095 requires indirectly_copyable<I, O>
1096 constexpr remove_copy_if_result<I, O>
Mark de Weverde6827b2023-02-24 20:35:411097 remove_copy_if(I first, S last, O result, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591098
1099 template<input_range R, weakly_incrementable O, class Proj = identity,
1100 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
1101 requires indirectly_copyable<iterator_t<R>, O>
1102 constexpr remove_copy_if_result<borrowed_iterator_t<R>, O>
Mark de Weverde6827b2023-02-24 20:35:411103 remove_copy_if(R&& r, O result, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591104
Nikolas Klauser93172c12022-08-03 05:25:001105 template<class I, class O>
Mark de Weverde6827b2023-02-24 20:35:411106 using replace_copy_result = in_out_result<I, O>; // since C++20
Nikolas Klauser93172c12022-08-03 05:25:001107
1108 template<input_iterator I, sentinel_for<I> S, class T1, class T2,
1109 output_iterator<const T2&> O, class Proj = identity>
1110 requires indirectly_copyable<I, O> &&
1111 indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*>
1112 constexpr replace_copy_result<I, O>
1113 replace_copy(I first, S last, O result, const T1& old_value, const T2& new_value,
Mark de Weverde6827b2023-02-24 20:35:411114 Proj proj = {}); // since C++20
Nikolas Klauser93172c12022-08-03 05:25:001115
1116 template<input_range R, class T1, class T2, output_iterator<const T2&> O,
1117 class Proj = identity>
1118 requires indirectly_copyable<iterator_t<R>, O> &&
1119 indirect_binary_predicate<ranges::equal_to,
1120 projected<iterator_t<R>, Proj>, const T1*>
1121 constexpr replace_copy_result<borrowed_iterator_t<R>, O>
1122 replace_copy(R&& r, O result, const T1& old_value, const T2& new_value,
Mark de Weverde6827b2023-02-24 20:35:411123 Proj proj = {}); // since C++20
Nikolas Klauser93172c12022-08-03 05:25:001124
1125 template<class I, class O>
Mark de Weverde6827b2023-02-24 20:35:411126 using replace_copy_if_result = in_out_result<I, O>; // since C++20
Nikolas Klauser93172c12022-08-03 05:25:001127
1128 template<input_iterator I, sentinel_for<I> S, class T, output_iterator<const T&> O,
1129 class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
1130 requires indirectly_copyable<I, O>
1131 constexpr replace_copy_if_result<I, O>
1132 replace_copy_if(I first, S last, O result, Pred pred, const T& new_value,
Mark de Weverde6827b2023-02-24 20:35:411133 Proj proj = {}); // since C++20
Nikolas Klauser93172c12022-08-03 05:25:001134
1135 template<input_range R, class T, output_iterator<const T&> O, class Proj = identity,
1136 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
1137 requires indirectly_copyable<iterator_t<R>, O>
1138 constexpr replace_copy_if_result<borrowed_iterator_t<R>, O>
1139 replace_copy_if(R&& r, O result, Pred pred, const T& new_value,
Mark de Weverde6827b2023-02-24 20:35:411140 Proj proj = {}); // since C++20
Nikolas Klauser93172c12022-08-03 05:25:001141
Nikolas Klauser68264b62022-08-03 05:40:131142 template<class I>
Mark de Weverde6827b2023-02-24 20:35:411143 using prev_permutation_result = in_found_result<I>; // since C++20
Nikolas Klauser68264b62022-08-03 05:40:131144
1145 template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
1146 class Proj = identity>
1147 requires sortable<I, Comp, Proj>
1148 constexpr ranges::prev_permutation_result<I>
Mark de Weverde6827b2023-02-24 20:35:411149 ranges::prev_permutation(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser68264b62022-08-03 05:40:131150
1151 template<bidirectional_range R, class Comp = ranges::less,
1152 class Proj = identity>
1153 requires sortable<iterator_t<R>, Comp, Proj>
1154 constexpr ranges::prev_permutation_result<borrowed_iterator_t<R>>
Mark de Weverde6827b2023-02-24 20:35:411155 ranges::prev_permutation(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser68264b62022-08-03 05:40:131156
1157 template<class I>
Mark de Weverde6827b2023-02-24 20:35:411158 using next_permutation_result = in_found_result<I>; // since C++20
Nikolas Klauser68264b62022-08-03 05:40:131159
1160 template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
1161 class Proj = identity>
1162 requires sortable<I, Comp, Proj>
1163 constexpr ranges::next_permutation_result<I>
Mark de Weverde6827b2023-02-24 20:35:411164 ranges::next_permutation(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser68264b62022-08-03 05:40:131165
1166 template<bidirectional_range R, class Comp = ranges::less,
1167 class Proj = identity>
1168 requires sortable<iterator_t<R>, Comp, Proj>
1169 constexpr ranges::next_permutation_result<borrowed_iterator_t<R>>
Mark de Weverde6827b2023-02-24 20:35:411170 ranges::next_permutation(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser68264b62022-08-03 05:40:131171
Nikolas Klauserd3729bb2022-01-14 01:55:511172}
1173
Nikolas Klauser68264b62022-08-03 05:40:131174template <class InputIterator, class Predicate>
A. Jiangba9aeed2025-03-06 17:27:481175 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161176 all_of(InputIterator first, InputIterator last, Predicate pred);
1177
1178template <class InputIterator, class Predicate>
A. Jiangba9aeed2025-03-06 17:27:481179 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161180 any_of(InputIterator first, InputIterator last, Predicate pred);
1181
1182template <class InputIterator, class Predicate>
A. Jiangba9aeed2025-03-06 17:27:481183 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161184 none_of(InputIterator first, InputIterator last, Predicate pred);
1185
1186template <class InputIterator, class Function>
A. Jiangba9aeed2025-03-06 17:27:481187 constexpr Function // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161188 for_each(InputIterator first, InputIterator last, Function f);
1189
Marshall Clowd5c65ff2017-05-25 02:29:541190template<class InputIterator, class Size, class Function>
A. Jiangba9aeed2025-03-06 17:27:481191 constexpr InputIterator // constexpr since C++20
Marshall Clow1b9a4ff2018-01-22 20:44:331192 for_each_n(InputIterator first, Size n, Function f); // C++17
Marshall Clowd5c65ff2017-05-25 02:29:541193
Howard Hinnant3e519522010-05-11 19:42:161194template <class InputIterator, class T>
A. Jiangba9aeed2025-03-06 17:27:481195 constexpr InputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161196 find(InputIterator first, InputIterator last, const T& value);
1197
1198template <class InputIterator, class Predicate>
A. Jiangba9aeed2025-03-06 17:27:481199 constexpr InputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161200 find_if(InputIterator first, InputIterator last, Predicate pred);
1201
1202template<class InputIterator, class Predicate>
A. Jiangba9aeed2025-03-06 17:27:481203 constexpr InputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161204 find_if_not(InputIterator first, InputIterator last, Predicate pred);
1205
1206template <class ForwardIterator1, class ForwardIterator2>
A. Jiangba9aeed2025-03-06 17:27:481207 constexpr ForwardIterator1 // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161208 find_end(ForwardIterator1 first1, ForwardIterator1 last1,
1209 ForwardIterator2 first2, ForwardIterator2 last2);
1210
1211template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
A. Jiangba9aeed2025-03-06 17:27:481212 constexpr ForwardIterator1 // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161213 find_end(ForwardIterator1 first1, ForwardIterator1 last1,
1214 ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
1215
1216template <class ForwardIterator1, class ForwardIterator2>
A. Jiangba9aeed2025-03-06 17:27:481217 constexpr ForwardIterator1 // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161218 find_first_of(ForwardIterator1 first1, ForwardIterator1 last1,
1219 ForwardIterator2 first2, ForwardIterator2 last2);
1220
1221template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
A. Jiangba9aeed2025-03-06 17:27:481222 constexpr ForwardIterator1 // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161223 find_first_of(ForwardIterator1 first1, ForwardIterator1 last1,
1224 ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
1225
1226template <class ForwardIterator>
A. Jiangba9aeed2025-03-06 17:27:481227 constexpr ForwardIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161228 adjacent_find(ForwardIterator first, ForwardIterator last);
1229
1230template <class ForwardIterator, class BinaryPredicate>
A. Jiangba9aeed2025-03-06 17:27:481231 constexpr ForwardIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161232 adjacent_find(ForwardIterator first, ForwardIterator last, BinaryPredicate pred);
1233
1234template <class InputIterator, class T>
A. Jiangba9aeed2025-03-06 17:27:481235 constexpr typename iterator_traits<InputIterator>::difference_type // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161236 count(InputIterator first, InputIterator last, const T& value);
1237
1238template <class InputIterator, class Predicate>
A. Jiangba9aeed2025-03-06 17:27:481239 constexpr typename iterator_traits<InputIterator>::difference_type // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161240 count_if(InputIterator first, InputIterator last, Predicate pred);
1241
1242template <class InputIterator1, class InputIterator2>
A. Jiangba9aeed2025-03-06 17:27:481243 constexpr pair<InputIterator1, InputIterator2> // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161244 mismatch(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2);
1245
Marshall Clow0b0bbd22013-05-09 21:14:231246template <class InputIterator1, class InputIterator2>
Louis Dionne5366bf52024-10-01 16:59:361247 constexpr pair<InputIterator1, InputIterator2>
Aditya Kumar331fb802016-08-25 11:52:381248 mismatch(InputIterator1 first1, InputIterator1 last1,
A. Jiangba9aeed2025-03-06 17:27:481249 InputIterator2 first2, InputIterator2 last2); // since C++14, constexpr since C++20
Marshall Clow0b0bbd22013-05-09 21:14:231250
Howard Hinnant3e519522010-05-11 19:42:161251template <class InputIterator1, class InputIterator2, class BinaryPredicate>
A. Jiangba9aeed2025-03-06 17:27:481252 constexpr pair<InputIterator1, InputIterator2> // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161253 mismatch(InputIterator1 first1, InputIterator1 last1,
1254 InputIterator2 first2, BinaryPredicate pred);
1255
Marshall Clow0b0bbd22013-05-09 21:14:231256template <class InputIterator1, class InputIterator2, class BinaryPredicate>
Louis Dionne5366bf52024-10-01 16:59:361257 constexpr pair<InputIterator1, InputIterator2>
Marshall Clow0b0bbd22013-05-09 21:14:231258 mismatch(InputIterator1 first1, InputIterator1 last1,
1259 InputIterator2 first2, InputIterator2 last2,
A. Jiangba9aeed2025-03-06 17:27:481260 BinaryPredicate pred); // since C++14, constexpr since C++20
Marshall Clow0b0bbd22013-05-09 21:14:231261
Howard Hinnant3e519522010-05-11 19:42:161262template <class InputIterator1, class InputIterator2>
A. Jiangba9aeed2025-03-06 17:27:481263 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161264 equal(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2);
1265
Marshall Clow0b0bbd22013-05-09 21:14:231266template <class InputIterator1, class InputIterator2>
Louis Dionne5366bf52024-10-01 16:59:361267 constexpr bool
Aditya Kumar331fb802016-08-25 11:52:381268 equal(InputIterator1 first1, InputIterator1 last1,
A. Jiangba9aeed2025-03-06 17:27:481269 InputIterator2 first2, InputIterator2 last2); // since C++14, constexpr since C++20
Marshall Clow0b0bbd22013-05-09 21:14:231270
Howard Hinnant3e519522010-05-11 19:42:161271template <class InputIterator1, class InputIterator2, class BinaryPredicate>
A. Jiangba9aeed2025-03-06 17:27:481272 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161273 equal(InputIterator1 first1, InputIterator1 last1,
1274 InputIterator2 first2, BinaryPredicate pred);
1275
Marshall Clow0b0bbd22013-05-09 21:14:231276template <class InputIterator1, class InputIterator2, class BinaryPredicate>
Louis Dionne5366bf52024-10-01 16:59:361277 constexpr bool
Marshall Clow0b0bbd22013-05-09 21:14:231278 equal(InputIterator1 first1, InputIterator1 last1,
1279 InputIterator2 first2, InputIterator2 last2,
A. Jiangba9aeed2025-03-06 17:27:481280 BinaryPredicate pred); // since C++14, constexpr since C++20
Marshall Clow0b0bbd22013-05-09 21:14:231281
Howard Hinnant3e519522010-05-11 19:42:161282template<class ForwardIterator1, class ForwardIterator2>
A. Jiangba9aeed2025-03-06 17:27:481283 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161284 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
1285 ForwardIterator2 first2);
1286
Marshall Clow0b0bbd22013-05-09 21:14:231287template<class ForwardIterator1, class ForwardIterator2>
Louis Dionne5366bf52024-10-01 16:59:361288 constexpr bool
Marshall Clow0b0bbd22013-05-09 21:14:231289 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
A. Jiangba9aeed2025-03-06 17:27:481290 ForwardIterator2 first2, ForwardIterator2 last2); // since C++14, constexpr since C++20
Marshall Clow0b0bbd22013-05-09 21:14:231291
Howard Hinnant3e519522010-05-11 19:42:161292template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
A. Jiangba9aeed2025-03-06 17:27:481293 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161294 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
1295 ForwardIterator2 first2, BinaryPredicate pred);
1296
Marshall Clow0b0bbd22013-05-09 21:14:231297template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
Louis Dionne5366bf52024-10-01 16:59:361298 constexpr bool
Marshall Clow0b0bbd22013-05-09 21:14:231299 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
1300 ForwardIterator2 first2, ForwardIterator2 last2,
A. Jiangba9aeed2025-03-06 17:27:481301 BinaryPredicate pred); // since C++14, constexpr since C++20
Marshall Clow0b0bbd22013-05-09 21:14:231302
Howard Hinnant3e519522010-05-11 19:42:161303template <class ForwardIterator1, class ForwardIterator2>
A. Jiangba9aeed2025-03-06 17:27:481304 constexpr ForwardIterator1 // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161305 search(ForwardIterator1 first1, ForwardIterator1 last1,
1306 ForwardIterator2 first2, ForwardIterator2 last2);
1307
1308template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
A. Jiangba9aeed2025-03-06 17:27:481309 constexpr ForwardIterator1 // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161310 search(ForwardIterator1 first1, ForwardIterator1 last1,
1311 ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
1312
1313template <class ForwardIterator, class Size, class T>
A. Jiangba9aeed2025-03-06 17:27:481314 constexpr ForwardIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161315 search_n(ForwardIterator first, ForwardIterator last, Size count, const T& value);
1316
1317template <class ForwardIterator, class Size, class T, class BinaryPredicate>
A. Jiangba9aeed2025-03-06 17:27:481318 constexpr ForwardIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161319 search_n(ForwardIterator first, ForwardIterator last,
1320 Size count, const T& value, BinaryPredicate pred);
1321
1322template <class InputIterator, class OutputIterator>
A. Jiangba9aeed2025-03-06 17:27:481323 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161324 copy(InputIterator first, InputIterator last, OutputIterator result);
1325
1326template<class InputIterator, class OutputIterator, class Predicate>
A. Jiangba9aeed2025-03-06 17:27:481327 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161328 copy_if(InputIterator first, InputIterator last,
1329 OutputIterator result, Predicate pred);
1330
1331template<class InputIterator, class Size, class OutputIterator>
A. Jiangba9aeed2025-03-06 17:27:481332 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161333 copy_n(InputIterator first, Size n, OutputIterator result);
1334
1335template <class BidirectionalIterator1, class BidirectionalIterator2>
A. Jiangba9aeed2025-03-06 17:27:481336 constexpr BidirectionalIterator2 // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161337 copy_backward(BidirectionalIterator1 first, BidirectionalIterator1 last,
1338 BidirectionalIterator2 result);
1339
Konstantin Varlamov79a2b4b2022-06-28 18:59:591340// [alg.move], move
1341template<class InputIterator, class OutputIterator>
1342 constexpr OutputIterator move(InputIterator first, InputIterator last,
1343 OutputIterator result);
1344
1345template<class BidirectionalIterator1, class BidirectionalIterator2>
1346 constexpr BidirectionalIterator2
1347 move_backward(BidirectionalIterator1 first, BidirectionalIterator1 last,
1348 BidirectionalIterator2 result);
1349
Howard Hinnant3e519522010-05-11 19:42:161350template <class ForwardIterator1, class ForwardIterator2>
A. Jiangba9aeed2025-03-06 17:27:481351 constexpr ForwardIterator2 // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161352 swap_ranges(ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2);
1353
Konstantin Varlamov79a2b4b2022-06-28 18:59:591354namespace ranges {
1355 template<class I1, class I2>
1356 using swap_ranges_result = in_in_result<I1, I2>;
1357
Nikolas Klauser9d905312022-02-10 12:33:031358template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2>
1359 requires indirectly_swappable<I1, I2>
1360 constexpr ranges::swap_ranges_result<I1, I2>
Konstantin Varlamov79a2b4b2022-06-28 18:59:591361 swap_ranges(I1 first1, S1 last1, I2 first2, S2 last2);
Nikolas Klauser9d905312022-02-10 12:33:031362
1363template<input_range R1, input_range R2>
1364 requires indirectly_swappable<iterator_t<R1>, iterator_t<R2>>
1365 constexpr ranges::swap_ranges_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
Konstantin Varlamov79a2b4b2022-06-28 18:59:591366 swap_ranges(R1&& r1, R2&& r2);
1367}
Nikolas Klauser9d905312022-02-10 12:33:031368
Howard Hinnant3e519522010-05-11 19:42:161369template <class ForwardIterator1, class ForwardIterator2>
A. Jiangba9aeed2025-03-06 17:27:481370 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161371 iter_swap(ForwardIterator1 a, ForwardIterator2 b);
1372
1373template <class InputIterator, class OutputIterator, class UnaryOperation>
A. Jiangba9aeed2025-03-06 17:27:481374 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161375 transform(InputIterator first, InputIterator last, OutputIterator result, UnaryOperation op);
1376
1377template <class InputIterator1, class InputIterator2, class OutputIterator, class BinaryOperation>
A. Jiangba9aeed2025-03-06 17:27:481378 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161379 transform(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2,
1380 OutputIterator result, BinaryOperation binary_op);
1381
1382template <class ForwardIterator, class T>
A. Jiangba9aeed2025-03-06 17:27:481383 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161384 replace(ForwardIterator first, ForwardIterator last, const T& old_value, const T& new_value);
1385
1386template <class ForwardIterator, class Predicate, class T>
A. Jiangba9aeed2025-03-06 17:27:481387 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161388 replace_if(ForwardIterator first, ForwardIterator last, Predicate pred, const T& new_value);
1389
1390template <class InputIterator, class OutputIterator, class T>
A. Jiangba9aeed2025-03-06 17:27:481391 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161392 replace_copy(InputIterator first, InputIterator last, OutputIterator result,
1393 const T& old_value, const T& new_value);
1394
1395template <class InputIterator, class OutputIterator, class Predicate, class T>
A. Jiangba9aeed2025-03-06 17:27:481396 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161397 replace_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred, const T& new_value);
1398
1399template <class ForwardIterator, class T>
A. Jiangba9aeed2025-03-06 17:27:481400 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161401 fill(ForwardIterator first, ForwardIterator last, const T& value);
1402
1403template <class OutputIterator, class Size, class T>
A. Jiangba9aeed2025-03-06 17:27:481404 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161405 fill_n(OutputIterator first, Size n, const T& value);
1406
1407template <class ForwardIterator, class Generator>
A. Jiangba9aeed2025-03-06 17:27:481408 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161409 generate(ForwardIterator first, ForwardIterator last, Generator gen);
1410
1411template <class OutputIterator, class Size, class Generator>
A. Jiangba9aeed2025-03-06 17:27:481412 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161413 generate_n(OutputIterator first, Size n, Generator gen);
1414
1415template <class ForwardIterator, class T>
A. Jiangba9aeed2025-03-06 17:27:481416 constexpr ForwardIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161417 remove(ForwardIterator first, ForwardIterator last, const T& value);
1418
1419template <class ForwardIterator, class Predicate>
A. Jiangba9aeed2025-03-06 17:27:481420 constexpr ForwardIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161421 remove_if(ForwardIterator first, ForwardIterator last, Predicate pred);
1422
1423template <class InputIterator, class OutputIterator, class T>
A. Jiangba9aeed2025-03-06 17:27:481424 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161425 remove_copy(InputIterator first, InputIterator last, OutputIterator result, const T& value);
1426
1427template <class InputIterator, class OutputIterator, class Predicate>
A. Jiangba9aeed2025-03-06 17:27:481428 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161429 remove_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred);
1430
1431template <class ForwardIterator>
A. Jiangba9aeed2025-03-06 17:27:481432 constexpr ForwardIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161433 unique(ForwardIterator first, ForwardIterator last);
1434
1435template <class ForwardIterator, class BinaryPredicate>
A. Jiangba9aeed2025-03-06 17:27:481436 constexpr ForwardIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161437 unique(ForwardIterator first, ForwardIterator last, BinaryPredicate pred);
1438
1439template <class InputIterator, class OutputIterator>
A. Jiangba9aeed2025-03-06 17:27:481440 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161441 unique_copy(InputIterator first, InputIterator last, OutputIterator result);
1442
1443template <class InputIterator, class OutputIterator, class BinaryPredicate>
A. Jiangba9aeed2025-03-06 17:27:481444 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161445 unique_copy(InputIterator first, InputIterator last, OutputIterator result, BinaryPredicate pred);
1446
1447template <class BidirectionalIterator>
A. Jiangba9aeed2025-03-06 17:27:481448 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161449 reverse(BidirectionalIterator first, BidirectionalIterator last);
1450
1451template <class BidirectionalIterator, class OutputIterator>
A. Jiangba9aeed2025-03-06 17:27:481452 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161453 reverse_copy(BidirectionalIterator first, BidirectionalIterator last, OutputIterator result);
1454
1455template <class ForwardIterator>
A. Jiangba9aeed2025-03-06 17:27:481456 constexpr ForwardIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161457 rotate(ForwardIterator first, ForwardIterator middle, ForwardIterator last);
1458
1459template <class ForwardIterator, class OutputIterator>
A. Jiangba9aeed2025-03-06 17:27:481460 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161461 rotate_copy(ForwardIterator first, ForwardIterator middle, ForwardIterator last, OutputIterator result);
1462
1463template <class RandomAccessIterator>
1464 void
Marshall Clow0f37a412017-03-23 13:43:371465 random_shuffle(RandomAccessIterator first, RandomAccessIterator last); // deprecated in C++14, removed in C++17
Howard Hinnant3e519522010-05-11 19:42:161466
1467template <class RandomAccessIterator, class RandomNumberGenerator>
1468 void
Marshall Clow06965c12014-03-03 06:14:191469 random_shuffle(RandomAccessIterator first, RandomAccessIterator last,
Marshall Clow0f37a412017-03-23 13:43:371470 RandomNumberGenerator& rand); // deprecated in C++14, removed in C++17
Howard Hinnant3e519522010-05-11 19:42:161471
Eric Fiseliere7154702016-08-28 22:14:371472template<class PopulationIterator, class SampleIterator,
1473 class Distance, class UniformRandomBitGenerator>
1474 SampleIterator sample(PopulationIterator first, PopulationIterator last,
1475 SampleIterator out, Distance n,
1476 UniformRandomBitGenerator&& g); // C++17
1477
Howard Hinnantf9d540b2010-05-26 17:49:341478template<class RandomAccessIterator, class UniformRandomNumberGenerator>
1479 void shuffle(RandomAccessIterator first, RandomAccessIterator last,
Howard Hinnantfb340102010-11-18 01:47:021480 UniformRandomNumberGenerator&& g);
Howard Hinnantf9d540b2010-05-26 17:49:341481
Arthur O'Dwyer3fbd3ea2020-12-26 06:39:031482template<class ForwardIterator>
1483 constexpr ForwardIterator
1484 shift_left(ForwardIterator first, ForwardIterator last,
1485 typename iterator_traits<ForwardIterator>::difference_type n); // C++20
1486
1487template<class ForwardIterator>
1488 constexpr ForwardIterator
1489 shift_right(ForwardIterator first, ForwardIterator last,
1490 typename iterator_traits<ForwardIterator>::difference_type n); // C++20
1491
Howard Hinnant3e519522010-05-11 19:42:161492template <class InputIterator, class Predicate>
A. Jiangba9aeed2025-03-06 17:27:481493 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161494 is_partitioned(InputIterator first, InputIterator last, Predicate pred);
1495
1496template <class ForwardIterator, class Predicate>
A. Jiangba9aeed2025-03-06 17:27:481497 constexpr ForwardIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161498 partition(ForwardIterator first, ForwardIterator last, Predicate pred);
1499
1500template <class InputIterator, class OutputIterator1,
1501 class OutputIterator2, class Predicate>
A. Jiangba9aeed2025-03-06 17:27:481502 constexpr pair<OutputIterator1, OutputIterator2> // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161503 partition_copy(InputIterator first, InputIterator last,
1504 OutputIterator1 out_true, OutputIterator2 out_false,
1505 Predicate pred);
1506
1507template <class ForwardIterator, class Predicate>
A. Jiangba9aeed2025-03-06 17:27:481508 constexpr ForwardIterator // constexpr since C++26
Howard Hinnant3e519522010-05-11 19:42:161509 stable_partition(ForwardIterator first, ForwardIterator last, Predicate pred);
1510
1511template<class ForwardIterator, class Predicate>
A. Jiangba9aeed2025-03-06 17:27:481512 constexpr ForwardIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161513 partition_point(ForwardIterator first, ForwardIterator last, Predicate pred);
1514
1515template <class ForwardIterator>
A. Jiangba9aeed2025-03-06 17:27:481516 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161517 is_sorted(ForwardIterator first, ForwardIterator last);
1518
1519template <class ForwardIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481520 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161521 is_sorted(ForwardIterator first, ForwardIterator last, Compare comp);
1522
1523template<class ForwardIterator>
A. Jiangba9aeed2025-03-06 17:27:481524 constexpr ForwardIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161525 is_sorted_until(ForwardIterator first, ForwardIterator last);
1526
1527template <class ForwardIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481528 constexpr ForwardIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161529 is_sorted_until(ForwardIterator first, ForwardIterator last, Compare comp);
1530
1531template <class RandomAccessIterator>
A. Jiangba9aeed2025-03-06 17:27:481532 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161533 sort(RandomAccessIterator first, RandomAccessIterator last);
1534
1535template <class RandomAccessIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481536 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161537 sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1538
1539template <class RandomAccessIterator>
A. Jiangba9aeed2025-03-06 17:27:481540 constexpr void // constexpr since C++26
Howard Hinnant3e519522010-05-11 19:42:161541 stable_sort(RandomAccessIterator first, RandomAccessIterator last);
1542
1543template <class RandomAccessIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481544 constexpr void // constexpr since C++26
Howard Hinnant3e519522010-05-11 19:42:161545 stable_sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1546
1547template <class RandomAccessIterator>
A. Jiangba9aeed2025-03-06 17:27:481548 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161549 partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last);
1550
1551template <class RandomAccessIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481552 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161553 partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last, Compare comp);
1554
1555template <class InputIterator, class RandomAccessIterator>
A. Jiangba9aeed2025-03-06 17:27:481556 constexpr RandomAccessIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161557 partial_sort_copy(InputIterator first, InputIterator last,
1558 RandomAccessIterator result_first, RandomAccessIterator result_last);
1559
1560template <class InputIterator, class RandomAccessIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481561 constexpr RandomAccessIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161562 partial_sort_copy(InputIterator first, InputIterator last,
1563 RandomAccessIterator result_first, RandomAccessIterator result_last, Compare comp);
1564
1565template <class RandomAccessIterator>
A. Jiangba9aeed2025-03-06 17:27:481566 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161567 nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last);
1568
1569template <class RandomAccessIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481570 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161571 nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last, Compare comp);
1572
1573template <class ForwardIterator, class T>
A. Jiangba9aeed2025-03-06 17:27:481574 constexpr ForwardIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161575 lower_bound(ForwardIterator first, ForwardIterator last, const T& value);
1576
1577template <class ForwardIterator, class T, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481578 constexpr ForwardIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161579 lower_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
1580
1581template <class ForwardIterator, class T>
A. Jiangba9aeed2025-03-06 17:27:481582 constexpr ForwardIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161583 upper_bound(ForwardIterator first, ForwardIterator last, const T& value);
1584
1585template <class ForwardIterator, class T, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481586 constexpr ForwardIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161587 upper_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
1588
1589template <class ForwardIterator, class T>
A. Jiangba9aeed2025-03-06 17:27:481590 constexpr pair<ForwardIterator, ForwardIterator> // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161591 equal_range(ForwardIterator first, ForwardIterator last, const T& value);
1592
1593template <class ForwardIterator, class T, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481594 constexpr pair<ForwardIterator, ForwardIterator> // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161595 equal_range(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
1596
1597template <class ForwardIterator, class T>
A. Jiangba9aeed2025-03-06 17:27:481598 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161599 binary_search(ForwardIterator first, ForwardIterator last, const T& value);
1600
1601template <class ForwardIterator, class T, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481602 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161603 binary_search(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
1604
1605template <class InputIterator1, class InputIterator2, class OutputIterator>
A. Jiangba9aeed2025-03-06 17:27:481606 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161607 merge(InputIterator1 first1, InputIterator1 last1,
1608 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1609
1610template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481611 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161612 merge(InputIterator1 first1, InputIterator1 last1,
1613 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1614
1615template <class BidirectionalIterator>
A. Jiang854a4f22025-03-18 23:42:231616 constexpr void // constexpr since C++26
Howard Hinnant3e519522010-05-11 19:42:161617 inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last);
1618
1619template <class BidirectionalIterator, class Compare>
A. Jiang854a4f22025-03-18 23:42:231620 constexpr void // constexpr since C++26
Howard Hinnant3e519522010-05-11 19:42:161621 inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last, Compare comp);
1622
1623template <class InputIterator1, class InputIterator2>
A. Jiangba9aeed2025-03-06 17:27:481624 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161625 includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2);
1626
1627template <class InputIterator1, class InputIterator2, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481628 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161629 includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, Compare comp);
1630
1631template <class InputIterator1, class InputIterator2, class OutputIterator>
A. Jiangba9aeed2025-03-06 17:27:481632 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161633 set_union(InputIterator1 first1, InputIterator1 last1,
1634 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1635
1636template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481637 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161638 set_union(InputIterator1 first1, InputIterator1 last1,
1639 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1640
1641template <class InputIterator1, class InputIterator2, class OutputIterator>
A. Jiangba9aeed2025-03-06 17:27:481642 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161643 set_intersection(InputIterator1 first1, InputIterator1 last1,
1644 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1645
1646template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481647 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161648 set_intersection(InputIterator1 first1, InputIterator1 last1,
1649 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1650
1651template <class InputIterator1, class InputIterator2, class OutputIterator>
A. Jiangba9aeed2025-03-06 17:27:481652 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161653 set_difference(InputIterator1 first1, InputIterator1 last1,
1654 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1655
1656template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481657 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161658 set_difference(InputIterator1 first1, InputIterator1 last1,
1659 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1660
1661template <class InputIterator1, class InputIterator2, class OutputIterator>
A. Jiangba9aeed2025-03-06 17:27:481662 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161663 set_symmetric_difference(InputIterator1 first1, InputIterator1 last1,
1664 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1665
1666template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481667 constexpr OutputIterator // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161668 set_symmetric_difference(InputIterator1 first1, InputIterator1 last1,
1669 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1670
1671template <class RandomAccessIterator>
A. Jiangba9aeed2025-03-06 17:27:481672 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161673 push_heap(RandomAccessIterator first, RandomAccessIterator last);
1674
1675template <class RandomAccessIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481676 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161677 push_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1678
1679template <class RandomAccessIterator>
A. Jiangba9aeed2025-03-06 17:27:481680 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161681 pop_heap(RandomAccessIterator first, RandomAccessIterator last);
1682
1683template <class RandomAccessIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481684 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161685 pop_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1686
1687template <class RandomAccessIterator>
A. Jiangba9aeed2025-03-06 17:27:481688 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161689 make_heap(RandomAccessIterator first, RandomAccessIterator last);
1690
1691template <class RandomAccessIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481692 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161693 make_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1694
1695template <class RandomAccessIterator>
A. Jiangba9aeed2025-03-06 17:27:481696 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161697 sort_heap(RandomAccessIterator first, RandomAccessIterator last);
1698
1699template <class RandomAccessIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481700 constexpr void // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161701 sort_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1702
Howard Hinnantb3371f62010-08-22 00:02:431703template <class RandomAccessIterator>
A. Jiangba9aeed2025-03-06 17:27:481704 constexpr bool // constexpr since C++20
Howard Hinnantb3371f62010-08-22 00:02:431705 is_heap(RandomAccessIterator first, RandomAccessiterator last);
Howard Hinnant3e519522010-05-11 19:42:161706
Howard Hinnantb3371f62010-08-22 00:02:431707template <class RandomAccessIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481708 constexpr bool // constexpr since C++20
Howard Hinnantb3371f62010-08-22 00:02:431709 is_heap(RandomAccessIterator first, RandomAccessiterator last, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161710
Howard Hinnantb3371f62010-08-22 00:02:431711template <class RandomAccessIterator>
A. Jiangba9aeed2025-03-06 17:27:481712 constexpr RandomAccessIterator // constexpr since C++20
Howard Hinnantb3371f62010-08-22 00:02:431713 is_heap_until(RandomAccessIterator first, RandomAccessiterator last);
Howard Hinnant3e519522010-05-11 19:42:161714
Howard Hinnantb3371f62010-08-22 00:02:431715template <class RandomAccessIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481716 constexpr RandomAccessIterator // constexpr since C++20
Howard Hinnantb3371f62010-08-22 00:02:431717 is_heap_until(RandomAccessIterator first, RandomAccessiterator last, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161718
Howard Hinnant4eb27b72010-08-21 20:10:011719template <class ForwardIterator>
A. Jiangba9aeed2025-03-06 17:27:481720 constexpr ForwardIterator // constexpr since C++14
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181721 min_element(ForwardIterator first, ForwardIterator last);
Howard Hinnant4eb27b72010-08-21 20:10:011722
1723template <class ForwardIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481724 constexpr ForwardIterator // constexpr since C++14
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181725 min_element(ForwardIterator first, ForwardIterator last, Compare comp);
Howard Hinnant4eb27b72010-08-21 20:10:011726
Howard Hinnant3e519522010-05-11 19:42:161727template <class T>
A. Jiangba9aeed2025-03-06 17:27:481728 constexpr const T& // constexpr since C++14
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181729 min(const T& a, const T& b);
Howard Hinnant3e519522010-05-11 19:42:161730
1731template <class T, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481732 constexpr const T& // constexpr since C++14
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181733 min(const T& a, const T& b, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161734
Howard Hinnant4eb27b72010-08-21 20:10:011735template<class T>
A. Jiangba9aeed2025-03-06 17:27:481736 constexpr T // constexpr since C++14
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181737 min(initializer_list<T> t);
Howard Hinnant4eb27b72010-08-21 20:10:011738
1739template<class T, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481740 constexpr T // constexpr since C++14
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181741 min(initializer_list<T> t, Compare comp);
Howard Hinnant4eb27b72010-08-21 20:10:011742
Marshall Clow146c14a2016-03-07 22:43:491743template<class T>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181744 constexpr const T& clamp(const T& v, const T& lo, const T& hi); // C++17
Marshall Clow146c14a2016-03-07 22:43:491745
1746template<class T, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181747 constexpr const T& clamp(const T& v, const T& lo, const T& hi, Compare comp); // C++17
Marshall Clow146c14a2016-03-07 22:43:491748
Howard Hinnant4eb27b72010-08-21 20:10:011749template <class ForwardIterator>
A. Jiangba9aeed2025-03-06 17:27:481750 constexpr ForwardIterator // constexpr since C++14
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181751 max_element(ForwardIterator first, ForwardIterator last);
Howard Hinnant4eb27b72010-08-21 20:10:011752
1753template <class ForwardIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481754 constexpr ForwardIterator // constexpr since C++14
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181755 max_element(ForwardIterator first, ForwardIterator last, Compare comp);
Howard Hinnant4eb27b72010-08-21 20:10:011756
Howard Hinnant3e519522010-05-11 19:42:161757template <class T>
A. Jiangba9aeed2025-03-06 17:27:481758 constexpr const T& // constexpr since C++14
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181759 max(const T& a, const T& b);
Howard Hinnant3e519522010-05-11 19:42:161760
1761template <class T, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481762 constexpr const T& // constexpr since C++14
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181763 max(const T& a, const T& b, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161764
Howard Hinnant4eb27b72010-08-21 20:10:011765template<class T>
A. Jiangba9aeed2025-03-06 17:27:481766 constexpr T // constexpr since C++14
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181767 max(initializer_list<T> t);
Howard Hinnant3e519522010-05-11 19:42:161768
Howard Hinnant4eb27b72010-08-21 20:10:011769template<class T, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481770 constexpr T // constexpr since C++14
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181771 max(initializer_list<T> t, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161772
Howard Hinnant4eb27b72010-08-21 20:10:011773template<class ForwardIterator>
A. Jiangba9aeed2025-03-06 17:27:481774 constexpr pair<ForwardIterator, ForwardIterator> // constexpr since C++14
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181775 minmax_element(ForwardIterator first, ForwardIterator last);
Howard Hinnant3e519522010-05-11 19:42:161776
Howard Hinnant4eb27b72010-08-21 20:10:011777template<class ForwardIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481778 constexpr pair<ForwardIterator, ForwardIterator> // constexpr since C++14
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181779 minmax_element(ForwardIterator first, ForwardIterator last, Compare comp);
Howard Hinnant4eb27b72010-08-21 20:10:011780
1781template<class T>
A. Jiangba9aeed2025-03-06 17:27:481782 constexpr pair<const T&, const T&> // constexpr since C++14
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181783 minmax(const T& a, const T& b);
Howard Hinnant4eb27b72010-08-21 20:10:011784
1785template<class T, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481786 constexpr pair<const T&, const T&> // constexpr since C++14
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181787 minmax(const T& a, const T& b, Compare comp);
Howard Hinnant4eb27b72010-08-21 20:10:011788
1789template<class T>
A. Jiangba9aeed2025-03-06 17:27:481790 constexpr pair<T, T> // constexpr since C++14
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181791 minmax(initializer_list<T> t);
Howard Hinnant4eb27b72010-08-21 20:10:011792
1793template<class T, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481794 constexpr pair<T, T> // constexpr since C++14
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181795 minmax(initializer_list<T> t, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161796
1797template <class InputIterator1, class InputIterator2>
A. Jiangba9aeed2025-03-06 17:27:481798 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161799 lexicographical_compare(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2);
1800
1801template <class InputIterator1, class InputIterator2, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481802 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161803 lexicographical_compare(InputIterator1 first1, InputIterator1 last1,
1804 InputIterator2 first2, InputIterator2 last2, Compare comp);
1805
Adrian Vogelsgesang2a067572022-08-04 22:21:271806template<class InputIterator1, class InputIterator2, class Cmp>
1807 constexpr auto
1808 lexicographical_compare_three_way(InputIterator1 first1, InputIterator1 last1,
1809 InputIterator2 first2, InputIterator2 last2,
1810 Cmp comp)
1811 -> decltype(comp(*b1, *b2)); // since C++20
1812
1813template<class InputIterator1, class InputIterator2>
1814 constexpr auto
1815 lexicographical_compare_three_way(InputIterator1 first1, InputIterator1 last1,
1816 InputIterator2 first2, InputIterator2 last2); // since C++20
1817
Howard Hinnant3e519522010-05-11 19:42:161818template <class BidirectionalIterator>
A. Jiangba9aeed2025-03-06 17:27:481819 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161820 next_permutation(BidirectionalIterator first, BidirectionalIterator last);
1821
1822template <class BidirectionalIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481823 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161824 next_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp);
1825
1826template <class BidirectionalIterator>
A. Jiangba9aeed2025-03-06 17:27:481827 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161828 prev_permutation(BidirectionalIterator first, BidirectionalIterator last);
1829
1830template <class BidirectionalIterator, class Compare>
A. Jiangba9aeed2025-03-06 17:27:481831 constexpr bool // constexpr since C++20
Howard Hinnant3e519522010-05-11 19:42:161832 prev_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161833} // std
1834
1835*/
1836
Nikolas Klauserb9a26582024-12-21 12:01:481837#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
1838# include <__cxx03/algorithm>
1839#else
Nikolas Klauserc166a9c2024-12-10 15:02:121840# include <__config>
Howard Hinnant5d1a7012013-08-14 18:00:201841
Nikolas Klauserc166a9c2024-12-10 15:02:121842# include <__algorithm/adjacent_find.h>
1843# include <__algorithm/all_of.h>
1844# include <__algorithm/any_of.h>
1845# include <__algorithm/binary_search.h>
1846# include <__algorithm/copy.h>
1847# include <__algorithm/copy_backward.h>
1848# include <__algorithm/copy_if.h>
1849# include <__algorithm/copy_n.h>
1850# include <__algorithm/count.h>
1851# include <__algorithm/count_if.h>
1852# include <__algorithm/equal.h>
1853# include <__algorithm/equal_range.h>
1854# include <__algorithm/fill.h>
1855# include <__algorithm/fill_n.h>
1856# include <__algorithm/find.h>
1857# include <__algorithm/find_end.h>
1858# include <__algorithm/find_first_of.h>
1859# include <__algorithm/find_if.h>
1860# include <__algorithm/find_if_not.h>
1861# include <__algorithm/for_each.h>
1862# include <__algorithm/generate.h>
1863# include <__algorithm/generate_n.h>
1864# include <__algorithm/includes.h>
1865# include <__algorithm/inplace_merge.h>
1866# include <__algorithm/is_heap.h>
1867# include <__algorithm/is_heap_until.h>
1868# include <__algorithm/is_partitioned.h>
1869# include <__algorithm/is_permutation.h>
1870# include <__algorithm/is_sorted.h>
1871# include <__algorithm/is_sorted_until.h>
1872# include <__algorithm/iter_swap.h>
1873# include <__algorithm/lexicographical_compare.h>
1874# include <__algorithm/lower_bound.h>
1875# include <__algorithm/make_heap.h>
1876# include <__algorithm/max.h>
1877# include <__algorithm/max_element.h>
1878# include <__algorithm/merge.h>
1879# include <__algorithm/min.h>
1880# include <__algorithm/min_element.h>
1881# include <__algorithm/minmax.h>
1882# include <__algorithm/minmax_element.h>
1883# include <__algorithm/mismatch.h>
1884# include <__algorithm/move.h>
1885# include <__algorithm/move_backward.h>
1886# include <__algorithm/next_permutation.h>
1887# include <__algorithm/none_of.h>
1888# include <__algorithm/nth_element.h>
1889# include <__algorithm/partial_sort.h>
1890# include <__algorithm/partial_sort_copy.h>
1891# include <__algorithm/partition.h>
1892# include <__algorithm/partition_copy.h>
1893# include <__algorithm/partition_point.h>
1894# include <__algorithm/pop_heap.h>
1895# include <__algorithm/prev_permutation.h>
1896# include <__algorithm/push_heap.h>
1897# include <__algorithm/remove.h>
1898# include <__algorithm/remove_copy.h>
1899# include <__algorithm/remove_copy_if.h>
1900# include <__algorithm/remove_if.h>
1901# include <__algorithm/replace.h>
1902# include <__algorithm/replace_copy.h>
1903# include <__algorithm/replace_copy_if.h>
1904# include <__algorithm/replace_if.h>
1905# include <__algorithm/reverse.h>
1906# include <__algorithm/reverse_copy.h>
1907# include <__algorithm/rotate.h>
1908# include <__algorithm/rotate_copy.h>
1909# include <__algorithm/search.h>
1910# include <__algorithm/search_n.h>
1911# include <__algorithm/set_difference.h>
1912# include <__algorithm/set_intersection.h>
1913# include <__algorithm/set_symmetric_difference.h>
1914# include <__algorithm/set_union.h>
1915# include <__algorithm/shuffle.h>
1916# include <__algorithm/sort.h>
1917# include <__algorithm/sort_heap.h>
1918# include <__algorithm/stable_partition.h>
1919# include <__algorithm/stable_sort.h>
1920# include <__algorithm/swap_ranges.h>
1921# include <__algorithm/transform.h>
1922# include <__algorithm/unique.h>
1923# include <__algorithm/unique_copy.h>
1924# include <__algorithm/upper_bound.h>
Eric Fiselierc1bd9192014-08-10 23:53:081925
Nikolas Klauserc166a9c2024-12-10 15:02:121926# if _LIBCPP_STD_VER >= 17
1927# include <__algorithm/clamp.h>
1928# include <__algorithm/for_each_n.h>
1929# include <__algorithm/pstl.h>
1930# include <__algorithm/sample.h>
1931# endif // _LIBCPP_STD_VER >= 17
Nikolas Klauserd5c654b2024-04-14 13:52:561932
Nikolas Klauserc166a9c2024-12-10 15:02:121933# if _LIBCPP_STD_VER >= 20
1934# include <__algorithm/in_found_result.h>
1935# include <__algorithm/in_fun_result.h>
1936# include <__algorithm/in_in_out_result.h>
1937# include <__algorithm/in_in_result.h>
1938# include <__algorithm/in_out_out_result.h>
1939# include <__algorithm/in_out_result.h>
1940# include <__algorithm/lexicographical_compare_three_way.h>
1941# include <__algorithm/min_max_result.h>
James E T Smith475cbf02025-04-05 11:46:111942# include <__algorithm/out_value_result.h>
Nikolas Klauserc166a9c2024-12-10 15:02:121943# include <__algorithm/ranges_adjacent_find.h>
1944# include <__algorithm/ranges_all_of.h>
1945# include <__algorithm/ranges_any_of.h>
1946# include <__algorithm/ranges_binary_search.h>
1947# include <__algorithm/ranges_clamp.h>
1948# include <__algorithm/ranges_contains.h>
1949# include <__algorithm/ranges_copy.h>
1950# include <__algorithm/ranges_copy_backward.h>
1951# include <__algorithm/ranges_copy_if.h>
1952# include <__algorithm/ranges_copy_n.h>
1953# include <__algorithm/ranges_count.h>
1954# include <__algorithm/ranges_count_if.h>
1955# include <__algorithm/ranges_equal.h>
1956# include <__algorithm/ranges_equal_range.h>
1957# include <__algorithm/ranges_fill.h>
1958# include <__algorithm/ranges_fill_n.h>
1959# include <__algorithm/ranges_find.h>
1960# include <__algorithm/ranges_find_end.h>
1961# include <__algorithm/ranges_find_first_of.h>
1962# include <__algorithm/ranges_find_if.h>
1963# include <__algorithm/ranges_find_if_not.h>
1964# include <__algorithm/ranges_for_each.h>
1965# include <__algorithm/ranges_for_each_n.h>
1966# include <__algorithm/ranges_generate.h>
1967# include <__algorithm/ranges_generate_n.h>
1968# include <__algorithm/ranges_includes.h>
1969# include <__algorithm/ranges_inplace_merge.h>
1970# include <__algorithm/ranges_is_heap.h>
1971# include <__algorithm/ranges_is_heap_until.h>
1972# include <__algorithm/ranges_is_partitioned.h>
1973# include <__algorithm/ranges_is_permutation.h>
1974# include <__algorithm/ranges_is_sorted.h>
1975# include <__algorithm/ranges_is_sorted_until.h>
1976# include <__algorithm/ranges_lexicographical_compare.h>
1977# include <__algorithm/ranges_lower_bound.h>
1978# include <__algorithm/ranges_make_heap.h>
1979# include <__algorithm/ranges_max.h>
1980# include <__algorithm/ranges_max_element.h>
1981# include <__algorithm/ranges_merge.h>
1982# include <__algorithm/ranges_min.h>
1983# include <__algorithm/ranges_min_element.h>
1984# include <__algorithm/ranges_minmax.h>
1985# include <__algorithm/ranges_minmax_element.h>
1986# include <__algorithm/ranges_mismatch.h>
1987# include <__algorithm/ranges_move.h>
1988# include <__algorithm/ranges_move_backward.h>
1989# include <__algorithm/ranges_next_permutation.h>
1990# include <__algorithm/ranges_none_of.h>
1991# include <__algorithm/ranges_nth_element.h>
1992# include <__algorithm/ranges_partial_sort.h>
1993# include <__algorithm/ranges_partial_sort_copy.h>
1994# include <__algorithm/ranges_partition.h>
1995# include <__algorithm/ranges_partition_copy.h>
1996# include <__algorithm/ranges_partition_point.h>
1997# include <__algorithm/ranges_pop_heap.h>
1998# include <__algorithm/ranges_prev_permutation.h>
1999# include <__algorithm/ranges_push_heap.h>
2000# include <__algorithm/ranges_remove.h>
2001# include <__algorithm/ranges_remove_copy.h>
2002# include <__algorithm/ranges_remove_copy_if.h>
2003# include <__algorithm/ranges_remove_if.h>
2004# include <__algorithm/ranges_replace.h>
2005# include <__algorithm/ranges_replace_copy.h>
2006# include <__algorithm/ranges_replace_copy_if.h>
2007# include <__algorithm/ranges_replace_if.h>
2008# include <__algorithm/ranges_reverse.h>
2009# include <__algorithm/ranges_reverse_copy.h>
2010# include <__algorithm/ranges_rotate.h>
2011# include <__algorithm/ranges_rotate_copy.h>
2012# include <__algorithm/ranges_sample.h>
2013# include <__algorithm/ranges_search.h>
2014# include <__algorithm/ranges_search_n.h>
2015# include <__algorithm/ranges_set_difference.h>
2016# include <__algorithm/ranges_set_intersection.h>
2017# include <__algorithm/ranges_set_symmetric_difference.h>
2018# include <__algorithm/ranges_set_union.h>
2019# include <__algorithm/ranges_shuffle.h>
2020# include <__algorithm/ranges_sort.h>
2021# include <__algorithm/ranges_sort_heap.h>
2022# include <__algorithm/ranges_stable_partition.h>
2023# include <__algorithm/ranges_stable_sort.h>
2024# include <__algorithm/ranges_swap_ranges.h>
2025# include <__algorithm/ranges_transform.h>
2026# include <__algorithm/ranges_unique.h>
2027# include <__algorithm/ranges_unique_copy.h>
2028# include <__algorithm/ranges_upper_bound.h>
2029# include <__algorithm/shift_left.h>
2030# include <__algorithm/shift_right.h>
2031# endif
Nikolas Klauserd5c654b2024-04-14 13:52:562032
Nikolas Klauserc166a9c2024-12-10 15:02:122033# if _LIBCPP_STD_VER >= 23
2034# include <__algorithm/ranges_contains_subrange.h>
2035# include <__algorithm/ranges_ends_with.h>
2036# include <__algorithm/ranges_find_last.h>
2037# include <__algorithm/ranges_fold.h>
2038# include <__algorithm/ranges_starts_with.h>
2039# endif // _LIBCPP_STD_VER >= 23
Nikolas Klauserd5c654b2024-04-14 13:52:562040
Nikolas Klauserc166a9c2024-12-10 15:02:122041# include <version>
Nikolas Klauserd5c654b2024-04-14 13:52:562042
Nikolas Klauserdb1978b2022-06-16 20:43:462043// standard-mandated includes
Nikolas Klauser473a1602022-09-22 16:05:082044
2045// [algorithm.syn]
Nikolas Klauserc166a9c2024-12-10 15:02:122046# include <initializer_list>
Nikolas Klauserdb1978b2022-06-16 20:43:462047
Nikolas Klauserc166a9c2024-12-10 15:02:122048# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2049# pragma GCC system_header
2050# endif
Howard Hinnant3e519522010-05-11 19:42:162051
Nikolas Klauserc166a9c2024-12-10 15:02:122052# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER == 14
2053# include <execution>
2054# endif
Nikolas Klauserd5c654b2024-04-14 13:52:562055
Nikolas Klauserc166a9c2024-12-10 15:02:122056# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
2057# include <atomic>
2058# include <bit>
2059# include <concepts>
2060# include <cstdlib>
2061# include <cstring>
2062# include <iterator>
2063# include <memory>
Peng Liue9280a12025-04-19 11:12:432064# include <optional>
Nikolas Klauserc166a9c2024-12-10 15:02:122065# include <stdexcept>
2066# include <type_traits>
2067# include <utility>
2068# endif
Nikolas Klauserb9a26582024-12-21 12:01:482069#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
Mark de Wevere31c2a12022-09-02 15:53:282070
Louis Dionne4cd6ca12021-04-20 16:03:322071#endif // _LIBCPP_ALGORITHM