blob: 36fd035b7e51b3bdb727666da34bed3a724d80c6 [file] [log] [blame]
Howard Hinnant3e519522010-05-11 19:42:161// -*- C++ -*-
Louis Dionneeb8650a2021-11-17 21:25:012//===----------------------------------------------------------------------===//
Howard Hinnant3e519522010-05-11 19:42:163//
Chandler Carruth57b08b02019-01-19 10:56:404// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Howard Hinnant3e519522010-05-11 19:42:167//
8//===----------------------------------------------------------------------===//
9
10#ifndef _LIBCPP_ALGORITHM
11#define _LIBCPP_ALGORITHM
12
13/*
14 algorithm synopsis
15
16#include <initializer_list>
17
18namespace std
19{
20
Nikolas Klauserd3729bb2022-01-14 01:55:5121namespace ranges {
Konstantin Varlamov79a2b4b2022-06-28 18:59:5922
23 // [algorithms.results], algorithm result types
Nikolas Klauser1e77b392022-02-11 16:01:5824 template <class I, class F>
Mark de Weverde6827b2023-02-24 20:35:4125 struct in_fun_result; // since C++20
Nikolas Klauser1e77b392022-02-11 16:01:5826
Nikolas Klauserd3729bb2022-01-14 01:55:5127 template <class I1, class I2>
Mark de Weverde6827b2023-02-24 20:35:4128 struct in_in_result; // since C++20
Nikolas Klauserf3514af2022-01-25 10:21:4729
Konstantin Varlamov79a2b4b2022-06-28 18:59:5930 template <class I, class O>
Mark de Weverde6827b2023-02-24 20:35:4131 struct in_out_result; // since C++20
Konstantin Varlamov79a2b4b2022-06-28 18:59:5932
Nikolas Klauserf3514af2022-01-25 10:21:4733 template <class I1, class I2, class O>
Mark de Weverde6827b2023-02-24 20:35:4134 struct in_in_out_result; // since C++20
Nikolas Klauser610979b2022-02-03 01:17:0335
36 template <class I, class O1, class O2>
Mark de Weverde6827b2023-02-24 20:35:4137 struct in_out_out_result; // since C++20
Nikolas Klauser1e77b392022-02-11 16:01:5838
Nikolas Klauser807766b2022-02-21 21:48:3639 template <class I1, class I2>
Mark de Weverde6827b2023-02-24 20:35:4140 struct min_max_result; // since C++20
Nikolas Klauser807766b2022-02-21 21:48:3641
Nikolas Klauser68f41312022-02-21 22:07:0242 template <class I>
Mark de Weverde6827b2023-02-24 20:35:4143 struct in_found_result; // since C++20
Nikolas Klauser68f41312022-02-21 22:07:0244
Christopher Di Bella39034382023-12-20 05:57:5045 template <class I, class T>
46 struct in_value_result; // since C++23
47
Nikolas Klauser3b470d12022-02-11 12:11:5748 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
Mark de Weverde6827b2023-02-24 20:35:4149 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> // since C++20
Nikolas Klauser3b470d12022-02-11 12:11:5750 constexpr I min_element(I first, S last, Comp comp = {}, Proj proj = {});
51
52 template<forward_range R, class Proj = identity,
Mark de Weverde6827b2023-02-24 20:35:4153 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> // since C++20
Nikolas Klauser3b470d12022-02-11 12:11:5754 constexpr borrowed_iterator_t<R> min_element(R&& r, Comp comp = {}, Proj proj = {});
Nikolas Klauserc2cd15a2022-03-08 22:12:3555
Nikolas Klauser40f7fca32022-05-22 11:43:3756 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
57 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
Mark de Weverde6827b2023-02-24 20:35:4158 constexpr I ranges::max_element(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser40f7fca32022-05-22 11:43:3759
60 template<forward_range R, class Proj = identity,
61 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
Mark de Weverde6827b2023-02-24 20:35:4162 constexpr borrowed_iterator_t<R> ranges::max_element(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser40f7fca32022-05-22 11:43:3763
Konstantin Varlamov79a2b4b2022-06-28 18:59:5964 template<class I1, class I2>
65 using mismatch_result = in_in_result<I1, I2>;
66
Nikolas Klauserc2cd15a2022-03-08 22:12:3567 template <input_iterator I1, sentinel_for<_I1> S1, input_iterator I2, sentinel_for<_I2> S2,
68 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
69 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
Mark de Weverde6827b2023-02-24 20:35:4170 constexpr mismatch_result<_I1, _I2> // since C++20
71 mismatch()(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {})
Nikolas Klauserc2cd15a2022-03-08 22:12:3572
73 template <input_range R1, input_range R2,
74 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
75 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
76 constexpr mismatch_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
Mark de Weverde6827b2023-02-24 20:35:4177 mismatch(R1&& r1, R2&& r2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}) // since C++20
Nikolas Klauseree0f8c42022-03-12 00:45:3578
Nikolas Klauseree0f8c42022-03-12 00:45:3579 requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
Mark de Weverde6827b2023-02-24 20:35:4180 constexpr I find(I first, S last, const T& value, Proj proj = {}); // since C++20
Nikolas Klauseree0f8c42022-03-12 00:45:3581
82 template<input_range R, class T, class Proj = identity>
83 requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
84 constexpr borrowed_iterator_t<R>
Mark de Weverde6827b2023-02-24 20:35:4185 find(R&& r, const T& value, Proj proj = {}); // since C++20
Nikolas Klauseree0f8c42022-03-12 00:45:3586
87 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
88 indirect_unary_predicate<projected<I, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:4189 constexpr I find_if(I first, S last, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauseree0f8c42022-03-12 00:45:3590
91 template<input_range R, class Proj = identity,
92 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
93 constexpr borrowed_iterator_t<R>
Mark de Weverde6827b2023-02-24 20:35:4194 find_if(R&& r, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauseree0f8c42022-03-12 00:45:3595
96 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
97 indirect_unary_predicate<projected<I, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:4198 constexpr I find_if_not(I first, S last, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauseree0f8c42022-03-12 00:45:3599
100 template<input_range R, class Proj = identity,
101 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
102 constexpr borrowed_iterator_t<R>
Mark de Weverde6827b2023-02-24 20:35:41103 find_if_not(R&& r, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauserf83d8332022-03-18 01:57:08104
nicole mazzuca04760bf2024-07-19 16:42:16105 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity>
106 requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
107 constexpr subrange<I> find_last(I first, S last, const T& value, Proj proj = {}); // since C++23
108
109 template<forward_range R, class T, class Proj = identity>
110 requires
111 indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
112 constexpr borrowed_subrange_t<R> find_last(R&& r, const T& value, Proj proj = {}); // since C++23
113
114 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
115 indirect_unary_predicate<projected<I, Proj>> Pred>
116 constexpr subrange<I> find_last_if(I first, S last, Pred pred, Proj proj = {}); // since C++23
117
118 template<forward_range R, class Proj = identity,
119 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
120 constexpr borrowed_subrange_t<R> find_last_if(R&& r, Pred pred, Proj proj = {}); // since C++23
121
122 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
123 indirect_unary_predicate<projected<I, Proj>> Pred>
124 constexpr subrange<I> find_last_if_not(I first, S last, Pred pred, Proj proj = {}); // since C++23
125
126 template<forward_range R, class Proj = identity,
127 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
128 constexpr borrowed_subrange_t<R> find_last_if_not(R&& r, Pred pred, Proj proj = {}); // since C++23
129
Nikolas Klausere476df52022-04-03 07:17:01130 template<class T, class Proj = identity,
131 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
Mark de Weverde6827b2023-02-24 20:35:41132 constexpr const T& min(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauserf83d8332022-03-18 01:57:08133
Nikolas Klausere476df52022-04-03 07:17:01134 template<copyable T, class Proj = identity,
135 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
Mark de Weverde6827b2023-02-24 20:35:41136 constexpr T min(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauserf83d8332022-03-18 01:57:08137
138 template<input_range R, class Proj = identity,
139 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
140 requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
141 constexpr range_value_t<R>
Mark de Weverde6827b2023-02-24 20:35:41142 min(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klausere476df52022-04-03 07:17:01143
144 template<class T, class Proj = identity,
145 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
Mark de Weverde6827b2023-02-24 20:35:41146 constexpr const T& max(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klausere476df52022-04-03 07:17:01147
148 template<copyable T, class Proj = identity,
149 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
Mark de Weverde6827b2023-02-24 20:35:41150 constexpr T max(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klausere476df52022-04-03 07:17:01151
152 template<input_range R, class Proj = identity,
153 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
154 requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
155 constexpr range_value_t<R>
Mark de Weverde6827b2023-02-24 20:35:41156 max(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser3ba85482022-04-05 09:05:36157
158 template<class I, class O>
Mark de Weverde6827b2023-02-24 20:35:41159 using unary_transform_result = in_out_result<I, O>; // since C++20
Nikolas Klauser3ba85482022-04-05 09:05:36160
161 template<class I1, class I2, class O>
Mark de Weverde6827b2023-02-24 20:35:41162 using binary_transform_result = in_in_out_result<I1, I2, O>; // since C++20
Nikolas Klauser3ba85482022-04-05 09:05:36163
164 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O,
165 copy_constructible F, class Proj = identity>
166 requires indirectly_writable<O, indirect_result_t<F&, projected<I, Proj>>>
167 constexpr ranges::unary_transform_result<I, O>
Mark de Weverde6827b2023-02-24 20:35:41168 transform(I first1, S last1, O result, F op, Proj proj = {}); // since C++20
Nikolas Klauser3ba85482022-04-05 09:05:36169
170 template<input_range R, weakly_incrementable O, copy_constructible F,
171 class Proj = identity>
172 requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R>, Proj>>>
173 constexpr ranges::unary_transform_result<borrowed_iterator_t<R>, O>
Mark de Weverde6827b2023-02-24 20:35:41174 transform(R&& r, O result, F op, Proj proj = {}); // since C++20
Nikolas Klauser3ba85482022-04-05 09:05:36175
176 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
177 weakly_incrementable O, copy_constructible F, class Proj1 = identity,
178 class Proj2 = identity>
179 requires indirectly_writable<O, indirect_result_t<F&, projected<I1, Proj1>,
180 projected<I2, Proj2>>>
181 constexpr ranges::binary_transform_result<I1, I2, O>
182 transform(I1 first1, S1 last1, I2 first2, S2 last2, O result,
Mark de Weverde6827b2023-02-24 20:35:41183 F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauser3ba85482022-04-05 09:05:36184
185 template<input_range R1, input_range R2, weakly_incrementable O,
186 copy_constructible F, class Proj1 = identity, class Proj2 = identity>
187 requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R1>, Proj1>,
188 projected<iterator_t<R2>, Proj2>>>
189 constexpr ranges::binary_transform_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
190 transform(R1&& r1, R2&& r2, O result,
Mark de Weverde6827b2023-02-24 20:35:41191 F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauser1306b102022-04-07 11:02:02192
193 template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity>
194 requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
195 constexpr iter_difference_t<I>
Mark de Weverde6827b2023-02-24 20:35:41196 count(I first, S last, const T& value, Proj proj = {}); // since C++20
Nikolas Klauser1306b102022-04-07 11:02:02197
198 template<input_range R, class T, class Proj = identity>
199 requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
200 constexpr range_difference_t<R>
Mark de Weverde6827b2023-02-24 20:35:41201 count(R&& r, const T& value, Proj proj = {}); // since C++20
Nikolas Klauser1306b102022-04-07 11:02:02202
203 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
204 indirect_unary_predicate<projected<I, Proj>> Pred>
205 constexpr iter_difference_t<I>
Mark de Weverde6827b2023-02-24 20:35:41206 count_if(I first, S last, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser1306b102022-04-07 11:02:02207
208 template<input_range R, class Proj = identity,
209 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
210 constexpr range_difference_t<R>
Mark de Weverde6827b2023-02-24 20:35:41211 count_if(R&& r, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser58d9ab72022-04-13 20:59:09212
Konstantin Varlamov79a2b4b2022-06-28 18:59:59213 template<class T>
214 using minmax_result = min_max_result<T>;
215
Nikolas Klauser58d9ab72022-04-13 20:59:09216 template<class T, class Proj = identity,
217 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
218 constexpr ranges::minmax_result<const T&>
Mark de Weverde6827b2023-02-24 20:35:41219 minmax(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser58d9ab72022-04-13 20:59:09220
221 template<copyable T, class Proj = identity,
222 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
223 constexpr ranges::minmax_result<T>
Mark de Weverde6827b2023-02-24 20:35:41224 minmax(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser58d9ab72022-04-13 20:59:09225
226 template<input_range R, class Proj = identity,
227 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
228 requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
229 constexpr ranges::minmax_result<range_value_t<R>>
Mark de Weverde6827b2023-02-24 20:35:41230 minmax(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser58d9ab72022-04-13 20:59:09231
Konstantin Varlamov79a2b4b2022-06-28 18:59:59232 template<class I>
233 using minmax_element_result = min_max_result<I>;
234
Nikolas Klauser58d9ab72022-04-13 20:59:09235 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
236 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
237 constexpr ranges::minmax_element_result<I>
Mark de Weverde6827b2023-02-24 20:35:41238 minmax_element(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser58d9ab72022-04-13 20:59:09239
240 template<forward_range R, class Proj = identity,
241 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
242 constexpr ranges::minmax_element_result<borrowed_iterator_t<R>>
Mark de Weverde6827b2023-02-24 20:35:41243 minmax_element(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser1d837502022-04-15 11:43:40244
ZijunZhaoCCKa6b846a2024-02-13 23:42:37245 template<forward_iterator I1, sentinel_for<I1> S1,
246 forward_iterator I2, sentinel_for<I2> S2,
247 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
248 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
249 constexpr bool contains_subrange(I1 first1, S1 last1, I2 first2, S2 last2,
250 Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23
251
252 template<forward_range R1, forward_range R2,
253 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
254 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
255 constexpr bool contains_subrange(R1&& r1, R2&& r2, Pred pred = {},
256 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23
257
Nikolas Klauser1d837502022-04-15 11:43:40258 template<class I, class O>
Mark de Weverde6827b2023-02-24 20:35:41259 using copy_result = in_out_result<I, O>; // since C++20
Nikolas Klauser1d837502022-04-15 11:43:40260
Konstantin Varlamov79a2b4b2022-06-28 18:59:59261 template<class I, class O>
Mark de Weverde6827b2023-02-24 20:35:41262 using copy_n_result = in_out_result<I, O>; // since C++20
Nikolas Klauser1d837502022-04-15 11:43:40263
264 template<class I, class O>
265 using copy_if_result = in_out_result<I, O>; // since C++20
266
267 template<class I1, class I2>
268 using copy_backward_result = in_out_result<I1, I2>; // since C++20
269
ZijunZhaoCCKfdd089b2023-12-20 00:34:19270 template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity>
271 requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
272 constexpr bool ranges::contains(I first, S last, const T& value, Proj proj = {}); // since C++23
273
274 template<input_range R, class T, class Proj = identity>
275 requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
276 constexpr bool ranges::contains(R&& r, const T& value, Proj proj = {}); // since C++23
277
Nikolas Klauser1d837502022-04-15 11:43:40278 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O>
279 requires indirectly_copyable<I, O>
280 constexpr ranges::copy_result<I, O> ranges::copy(I first, S last, O result); // since C++20
281
282 template<input_range R, weakly_incrementable O>
283 requires indirectly_copyable<iterator_t<R>, O>
284 constexpr ranges::copy_result<borrowed_iterator_t<R>, O> ranges::copy(R&& r, O result); // since C++20
285
286 template<input_iterator I, weakly_incrementable O>
287 requires indirectly_copyable<I, O>
288 constexpr ranges::copy_n_result<I, O>
289 ranges::copy_n(I first, iter_difference_t<I> n, O result); // since C++20
290
291 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Proj = identity,
292 indirect_unary_predicate<projected<I, Proj>> Pred>
293 requires indirectly_copyable<I, O>
294 constexpr ranges::copy_if_result<I, O>
295 ranges::copy_if(I first, S last, O result, Pred pred, Proj proj = {}); // since C++20
296
297 template<input_range R, weakly_incrementable O, class Proj = identity,
298 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
299 requires indirectly_copyable<iterator_t<R>, O>
300 constexpr ranges::copy_if_result<borrowed_iterator_t<R>, O>
301 ranges::copy_if(R&& r, O result, Pred pred, Proj proj = {}); // since C++20
302
303 template<bidirectional_iterator I1, sentinel_for<I1> S1, bidirectional_iterator I2>
304 requires indirectly_copyable<I1, I2>
305 constexpr ranges::copy_backward_result<I1, I2>
306 ranges::copy_backward(I1 first, S1 last, I2 result); // since C++20
307
308 template<bidirectional_range R, bidirectional_iterator I>
309 requires indirectly_copyable<iterator_t<R>, I>
310 constexpr ranges::copy_backward_result<borrowed_iterator_t<R>, I>
311 ranges::copy_backward(R&& r, I result); // since C++20
Nikolas Klauser80045e92022-05-04 18:27:07312
313 template<class I, class F>
314 using for_each_result = in_fun_result<I, F>; // since C++20
315
Louis Dionne09e3a362024-09-16 19:06:20316 template<class I, class F>
317 using for_each_n_result = in_fun_result<I, F>; // since C++20
318
Nikolas Klauser80045e92022-05-04 18:27:07319 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
320 indirectly_unary_invocable<projected<I, Proj>> Fun>
321 constexpr ranges::for_each_result<I, Fun>
322 ranges::for_each(I first, S last, Fun f, Proj proj = {}); // since C++20
323
324 template<input_range R, class Proj = identity,
325 indirectly_unary_invocable<projected<iterator_t<R>, Proj>> Fun>
326 constexpr ranges::for_each_result<borrowed_iterator_t<R>, Fun>
327 ranges::for_each(R&& r, Fun f, Proj proj = {}); // since C++20
328
329 template<input_iterator I, class Proj = identity,
330 indirectly_unary_invocable<projected<I, Proj>> Fun>
331 constexpr ranges::for_each_n_result<I, Fun>
332 ranges::for_each_n(I first, iter_difference_t<I> n, Fun f, Proj proj = {}); // since C++20
Nikolas Klauser37ba1b92022-05-04 12:19:09333
334 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
335 indirect_unary_predicate<projected<I, Proj>> Pred>
336 constexpr bool ranges::is_partitioned(I first, S last, Pred pred, Proj proj = {}); // since C++20
337
338 template<input_range R, class Proj = identity,
339 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
340 constexpr bool ranges::is_partitioned(R&& r, Pred pred, Proj proj = {}); // since C++20
341
Konstantin Varlamovc945bd02022-07-08 20:46:27342 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
343 class Proj = identity>
344 requires sortable<I, Comp, Proj>
345 constexpr I
346 ranges::push_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
347
348 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
349 requires sortable<iterator_t<R>, Comp, Proj>
350 constexpr borrowed_iterator_t<R>
351 ranges::push_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
352
353 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
354 class Proj = identity>
355 requires sortable<I, Comp, Proj>
356 constexpr I
357 ranges::pop_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
358
359 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
360 requires sortable<iterator_t<R>, Comp, Proj>
361 constexpr borrowed_iterator_t<R>
362 ranges::pop_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
363
364 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
365 class Proj = identity>
366 requires sortable<I, Comp, Proj>
367 constexpr I
368 ranges::make_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
369
370 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
371 requires sortable<iterator_t<R>, Comp, Proj>
372 constexpr borrowed_iterator_t<R>
373 ranges::make_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
374
375 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
376 class Proj = identity>
377 requires sortable<I, Comp, Proj>
378 constexpr I
379 ranges::sort_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
380
381 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
382 requires sortable<iterator_t<R>, Comp, Proj>
383 constexpr borrowed_iterator_t<R>
384 ranges::sort_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
385
Konstantin Varlamovd406c642022-07-26 23:11:09386 template<random_access_iterator I, sentinel_for<I> S, class Proj = identity,
387 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
Mark de Weverde6827b2023-02-24 20:35:41388 constexpr bool is_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
Konstantin Varlamovd406c642022-07-26 23:11:09389
390 template<random_access_range R, class Proj = identity,
391 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
Mark de Weverde6827b2023-02-24 20:35:41392 constexpr bool is_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Konstantin Varlamovd406c642022-07-26 23:11:09393
394 template<random_access_iterator I, sentinel_for<I> S, class Proj = identity,
395 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
Mark de Weverde6827b2023-02-24 20:35:41396 constexpr I is_heap_until(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
Konstantin Varlamovd406c642022-07-26 23:11:09397
398 template<random_access_range R, class Proj = identity,
399 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
400 constexpr borrowed_iterator_t<R>
Mark de Weverde6827b2023-02-24 20:35:41401 is_heap_until(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Konstantin Varlamovd406c642022-07-26 23:11:09402
Nikolas Klauser1d1a1912022-05-24 08:32:50403 template<bidirectional_iterator I, sentinel_for<I> S>
404 requires permutable<I>
405 constexpr I ranges::reverse(I first, S last); // since C++20
406
407 template<bidirectional_range R>
408 requires permutable<iterator_t<R>>
409 constexpr borrowed_iterator_t<R> ranges::reverse(R&& r); // since C++20
410
Konstantin Varlamovff3989e2022-06-16 22:20:53411 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
412 class Proj = identity>
413 requires sortable<I, Comp, Proj>
414 constexpr I
Konstantin Varlamov94c7b892022-07-01 23:34:08415 ranges::sort(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
Konstantin Varlamovff3989e2022-06-16 22:20:53416
417 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
418 requires sortable<iterator_t<R>, Comp, Proj>
419 constexpr borrowed_iterator_t<R>
Konstantin Varlamov94c7b892022-07-01 23:34:08420 ranges::sort(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
421
422 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
423 class Proj = identity>
424 requires sortable<I, Comp, Proj>
425 I ranges::stable_sort(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
426
427 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
428 requires sortable<iterator_t<R>, Comp, Proj>
429 borrowed_iterator_t<R>
430 ranges::stable_sort(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Konstantin Varlamovff3989e2022-06-16 22:20:53431
varconst5dd19ad2022-07-20 03:10:02432 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
433 class Proj = identity>
434 requires sortable<I, Comp, Proj>
435 constexpr I
436 ranges::partial_sort(I first, I middle, S last, Comp comp = {}, Proj proj = {}); // since C++20
437
438 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
439 requires sortable<iterator_t<R>, Comp, Proj>
440 constexpr borrowed_iterator_t<R>
441 ranges::partial_sort(R&& r, iterator_t<R> middle, Comp comp = {}, Proj proj = {}); // since C++20
442
Nikolas Klauser7af89a32022-05-21 16:26:29443 template<class T, output_iterator<const T&> O, sentinel_for<O> S>
444 constexpr O ranges::fill(O first, S last, const T& value); // since C++20
445
446 template<class T, output_range<const T&> R>
447 constexpr borrowed_iterator_t<R> ranges::fill(R&& r, const T& value); // since C++20
448
449 template<class T, output_iterator<const T&> O>
450 constexpr O ranges::fill_n(O first, iter_difference_t<O> n, const T& value); // since C++20
Nikolas Klauser569d6632022-05-25 09:09:43451
Konstantin Varlamovead73022022-07-26 22:50:14452 template<input_or_output_iterator O, sentinel_for<O> S, copy_constructible F>
453 requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>>
Mark de Weverde6827b2023-02-24 20:35:41454 constexpr O generate(O first, S last, F gen); // since C++20
Konstantin Varlamovead73022022-07-26 22:50:14455
Nikolas Klausercd916102023-06-09 20:45:34456 template<class ExecutionPolicy, class ForwardIterator, class Generator>
457 void generate(ExecutionPolicy&& exec,
458 ForwardIterator first, ForwardIterator last,
459 Generator gen); // since C++17
460
Konstantin Varlamovead73022022-07-26 22:50:14461 template<class R, copy_constructible F>
462 requires invocable<F&> && output_range<R, invoke_result_t<F&>>
Mark de Weverde6827b2023-02-24 20:35:41463 constexpr borrowed_iterator_t<R> generate(R&& r, F gen); // since C++20
Konstantin Varlamovead73022022-07-26 22:50:14464
465 template<input_or_output_iterator O, copy_constructible F>
466 requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>>
Mark de Weverde6827b2023-02-24 20:35:41467 constexpr O generate_n(O first, iter_difference_t<O> n, F gen); // since C++20
Konstantin Varlamovead73022022-07-26 22:50:14468
Nikolas Klausercd916102023-06-09 20:45:34469 template<class ExecutionPolicy, class ForwardIterator, class Size, class Generator>
470 ForwardIterator generate_n(ExecutionPolicy&& exec,
471 ForwardIterator first, Size n, Generator gen); // since C++17
472
Nikolas Klauser569d6632022-05-25 09:09:43473 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
474 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
475 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
476 constexpr bool ranges::equal(I1 first1, S1 last1, I2 first2, S2 last2,
477 Pred pred = {},
478 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
479
480 template<input_range R1, input_range R2, class Pred = ranges::equal_to,
481 class Proj1 = identity, class Proj2 = identity>
482 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
483 constexpr bool ranges::equal(R1&& r1, R2&& r2, Pred pred = {},
484 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
485
Nikolas Klauser0e3dc1a2022-05-26 14:42:46486 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
487 indirect_unary_predicate<projected<I, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:41488 constexpr bool ranges::all_of(I first, S last, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser0e3dc1a2022-05-26 14:42:46489
490 template<input_range R, class Proj = identity,
491 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:41492 constexpr bool ranges::all_of(R&& r, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser0e3dc1a2022-05-26 14:42:46493
494 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
495 indirect_unary_predicate<projected<I, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:41496 constexpr bool ranges::any_of(I first, S last, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser0e3dc1a2022-05-26 14:42:46497
498 template<input_range R, class Proj = identity,
499 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:41500 constexpr bool ranges::any_of(R&& r, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser0e3dc1a2022-05-26 14:42:46501
Zijun Zhao0218ea42023-09-18 18:28:11502 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
503 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
504 requires (forward_iterator<I1> || sized_sentinel_for<S1, I1>) &&
505 (forward_iterator<I2> || sized_sentinel_for<S2, I2>) &&
506 indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
507 constexpr bool ranges::ends_with(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
508 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23
509
510 template<input_range R1, input_range R2, class Pred = ranges::equal_to, class Proj1 = identity,
511 class Proj2 = identity>
512 requires (forward_range<R1> || sized_range<R1>) &&
513 (forward_range<R2> || sized_range<R2>) &&
514 indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
515 constexpr bool ranges::ends_with(R1&& r1, R2&& r2, Pred pred = {},
516 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23
517
Nikolas Klauser0e3dc1a2022-05-26 14:42:46518 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
519 indirect_unary_predicate<projected<I, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:41520 constexpr bool ranges::none_of(I first, S last, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser0e3dc1a2022-05-26 14:42:46521
522 template<input_range R, class Proj = identity,
523 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:41524 constexpr bool ranges::none_of(R&& r, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser0e3dc1a2022-05-26 14:42:46525
zijunzhao20517552023-05-08 22:04:00526 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
527 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
528 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
529 constexpr bool ranges::starts_with(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
530 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23
531
532 template<input_range R1, input_range R2, class Pred = ranges::equal_to, class Proj1 = identity,
533 class Proj2 = identity>
534 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
535 constexpr bool ranges::starts_with(R1&& r1, R2&& r2, Pred pred = {},
536 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23
537
Konstantin Varlamovdb7d7952022-07-30 09:42:05538 template<input_iterator I1, sentinel_for<I1> S1,
539 random_access_iterator I2, sentinel_for<I2> S2,
540 class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
541 requires indirectly_copyable<I1, I2> && sortable<I2, Comp, Proj2> &&
542 indirect_strict_weak_order<Comp, projected<I1, Proj1>, projected<I2, Proj2>>
543 constexpr partial_sort_copy_result<I1, I2>
544 partial_sort_copy(I1 first, S1 last, I2 result_first, S2 result_last,
Mark de Weverde6827b2023-02-24 20:35:41545 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Konstantin Varlamovdb7d7952022-07-30 09:42:05546
547 template<input_range R1, random_access_range R2, class Comp = ranges::less,
548 class Proj1 = identity, class Proj2 = identity>
549 requires indirectly_copyable<iterator_t<R1>, iterator_t<R2>> &&
550 sortable<iterator_t<R2>, Comp, Proj2> &&
551 indirect_strict_weak_order<Comp, projected<iterator_t<R1>, Proj1>,
552 projected<iterator_t<R2>, Proj2>>
553 constexpr partial_sort_copy_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
554 partial_sort_copy(R1&& r, R2&& result_r, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:41555 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Konstantin Varlamovdb7d7952022-07-30 09:42:05556
Nikolas Klauser11e3ad22022-05-26 14:08:55557 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
558 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
559 constexpr bool ranges::is_sorted(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
560
561 template<forward_range R, class Proj = identity,
562 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
563 constexpr bool ranges::is_sorted(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
564
565 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
566 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
567 constexpr I ranges::is_sorted_until(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
568
569 template<forward_range R, class Proj = identity,
570 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
571 constexpr borrowed_iterator_t<R>
572 ranges::is_sorted_until(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser81715862022-06-05 19:15:16573
Konstantin Varlamov23c73282022-07-08 03:35:51574 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
575 class Proj = identity>
576 requires sortable<I, Comp, Proj>
577 constexpr I
Mark de Weverde6827b2023-02-24 20:35:41578 ranges::nth_element(I first, I nth, S last, Comp comp = {}, Proj proj = {}); // since C++20
Konstantin Varlamov23c73282022-07-08 03:35:51579
580 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
581 requires sortable<iterator_t<R>, Comp, Proj>
582 constexpr borrowed_iterator_t<R>
Mark de Weverde6827b2023-02-24 20:35:41583 ranges::nth_element(R&& r, iterator_t<R> nth, Comp comp = {}, Proj proj = {}); // since C++20
Konstantin Varlamov23c73282022-07-08 03:35:51584
Nikolas Klauser81715862022-06-05 19:15:16585 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
Mark de Weverde6827b2023-02-24 20:35:41586 indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less> // since C++20
587 constexpr I upper_bound(I first, S last, const T& value, Comp comp = {}, Proj proj = {});
Nikolas Klauser81715862022-06-05 19:15:16588
589 template<forward_range R, class T, class Proj = identity,
590 indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
591 ranges::less>
592 constexpr borrowed_iterator_t<R>
Mark de Weverde6827b2023-02-24 20:35:41593 upper_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser81715862022-06-05 19:15:16594
595 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
596 indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
597 constexpr I lower_bound(I first, S last, const T& value, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:41598 Proj proj = {}); // since C++20
Nikolas Klauser81715862022-06-05 19:15:16599 template<forward_range R, class T, class Proj = identity,
600 indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
601 ranges::less>
602 constexpr borrowed_iterator_t<R>
Mark de Weverde6827b2023-02-24 20:35:41603 lower_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser81715862022-06-05 19:15:16604
605 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
606 indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
607 constexpr bool binary_search(I first, S last, const T& value, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:41608 Proj proj = {}); // since C++20
Nikolas Klauserb79b2b62022-06-06 11:57:34609
Nikolas Klauser81715862022-06-05 19:15:16610 template<forward_range R, class T, class Proj = identity,
611 indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
612 ranges::less>
613 constexpr bool binary_search(R&& r, const T& value, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:41614 Proj proj = {}); // since C++20
Konstantin Varlamov8ed702b2022-07-19 04:05:51615
616 template<permutable I, sentinel_for<I> S, class Proj = identity,
617 indirect_unary_predicate<projected<I, Proj>> Pred>
618 constexpr subrange<I>
Mark de Weverde6827b2023-02-24 20:35:41619 partition(I first, S last, Pred pred, Proj proj = {}); // since C++20
Konstantin Varlamov8ed702b2022-07-19 04:05:51620
621 template<forward_range R, class Proj = identity,
622 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
623 requires permutable<iterator_t<R>>
624 constexpr borrowed_subrange_t<R>
Mark de Weverde6827b2023-02-24 20:35:41625 partition(R&& r, Pred pred, Proj proj = {}); // since C++20
Konstantin Varlamov8ed702b2022-07-19 04:05:51626
627 template<bidirectional_iterator I, sentinel_for<I> S, class Proj = identity,
628 indirect_unary_predicate<projected<I, Proj>> Pred>
629 requires permutable<I>
Mark de Weverde6827b2023-02-24 20:35:41630 subrange<I> stable_partition(I first, S last, Pred pred, Proj proj = {}); // since C++20
Konstantin Varlamov8ed702b2022-07-19 04:05:51631
632 template<bidirectional_range R, class Proj = identity,
633 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
634 requires permutable<iterator_t<R>>
Mark de Weverde6827b2023-02-24 20:35:41635 borrowed_subrange_t<R> stable_partition(R&& r, Pred pred, Proj proj = {}); // since C++20
Konstantin Varlamov8ed702b2022-07-19 04:05:51636
Nikolas Klauserb79b2b62022-06-06 11:57:34637 template<input_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2,
638 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
639 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
640 constexpr I1 ranges::find_first_of(I1 first1, S1 last1, I2 first2, S2 last2,
641 Pred pred = {},
642 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
643
644 template<input_range R1, forward_range R2,
645 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
646 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
647 constexpr borrowed_iterator_t<R1>
648 ranges::find_first_of(R1&& r1, R2&& r2,
649 Pred pred = {},
650 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauser81715862022-06-05 19:15:16651
Nikolas Klauser916e9052022-06-08 10:14:12652 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
653 indirect_binary_predicate<projected<I, Proj>,
654 projected<I, Proj>> Pred = ranges::equal_to>
Mark de Weverde6827b2023-02-24 20:35:41655 constexpr I ranges::adjacent_find(I first, S last, Pred pred = {}, Proj proj = {}); // since C++20
Nikolas Klauser916e9052022-06-08 10:14:12656
657 template<forward_range R, class Proj = identity,
658 indirect_binary_predicate<projected<iterator_t<R>, Proj>,
659 projected<iterator_t<R>, Proj>> Pred = ranges::equal_to>
660 constexpr borrowed_iterator_t<R> ranges::adjacent_find(R&& r, Pred pred = {}, Proj proj = {}); // since C++20
661
Nikolas Klauserff6d5de2022-06-07 07:42:10662 template<input_iterator I, sentinel_for<I> S, class T1, class T2, class Proj = identity>
663 requires indirectly_writable<I, const T2&> &&
664 indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*>
665 constexpr I
666 ranges::replace(I first, S last, const T1& old_value, const T2& new_value, Proj proj = {}); // since C++20
667
668 template<input_range R, class T1, class T2, class Proj = identity>
669 requires indirectly_writable<iterator_t<R>, const T2&> &&
670 indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T1*>
671 constexpr borrowed_iterator_t<R>
672 ranges::replace(R&& r, const T1& old_value, const T2& new_value, Proj proj = {}); // since C++20
673
674 template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity,
675 indirect_unary_predicate<projected<I, Proj>> Pred>
676 requires indirectly_writable<I, const T&>
677 constexpr I ranges::replace_if(I first, S last, Pred pred, const T& new_value, Proj proj = {}); // since C++20
678
679 template<input_range R, class T, class Proj = identity,
680 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
681 requires indirectly_writable<iterator_t<R>, const T&>
682 constexpr borrowed_iterator_t<R>
683 ranges::replace_if(R&& r, Pred pred, const T& new_value, Proj proj = {}); // since C++20
684
Nikolas Klausera203acb2022-08-03 23:30:50685 template<class T, class Proj = identity,
686 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
687 constexpr const T&
688 ranges::clamp(const T& v, const T& lo, const T& hi, Comp comp = {}, Proj proj = {}); // since C++20
689
Nikolas Klauserafd5a4f2022-06-15 14:24:43690 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
691 class Proj1 = identity, class Proj2 = identity,
692 indirect_strict_weak_order<projected<I1, Proj1>,
693 projected<I2, Proj2>> Comp = ranges::less>
694 constexpr bool
695 ranges::lexicographical_compare(I1 first1, S1 last1, I2 first2, S2 last2,
Mark de Weverde6827b2023-02-24 20:35:41696 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauserafd5a4f2022-06-15 14:24:43697
698 template<input_range R1, input_range R2, class Proj1 = identity,
699 class Proj2 = identity,
700 indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>,
701 projected<iterator_t<R2>, Proj2>> Comp = ranges::less>
702 constexpr bool
703 ranges::lexicographical_compare(R1&& r1, R2&& r2, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:41704 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauserafd5a4f2022-06-15 14:24:43705
Louis Dionne09e3a362024-09-16 19:06:20706 template<class I, class O>
707 using move_result = in_out_result<I, O>; // since C++20
708
709 template<class I, class O>
710 using move_backward_result = in_out_result<I, O>; // since C++20
711
Nikolas Klauser2c3bbac2022-06-23 10:23:41712 template<bidirectional_iterator I1, sentinel_for<I1> S1, bidirectional_iterator I2>
713 requires indirectly_movable<I1, I2>
714 constexpr ranges::move_backward_result<I1, I2>
715 ranges::move_backward(I1 first, S1 last, I2 result); // since C++20
716
717 template<bidirectional_range R, bidirectional_iterator I>
718 requires indirectly_movable<iterator_t<R>, I>
719 constexpr ranges::move_backward_result<borrowed_iterator_t<R>, I>
720 ranges::move_backward(R&& r, I result); // since C++20
721
722 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O>
723 requires indirectly_movable<I, O>
724 constexpr ranges::move_result<I, O>
725 ranges::move(I first, S last, O result); // since C++20
726
727 template<input_range R, weakly_incrementable O>
728 requires indirectly_movable<iterator_t<R>, O>
729 constexpr ranges::move_result<borrowed_iterator_t<R>, O>
730 ranges::move(R&& r, O result); // since C++20
731
Konstantin Varlamov065202f2022-07-20 08:57:13732 template<class I, class O1, class O2>
733 using partition_copy_result = in_out_out_result<I, O1, O2>; // since C++20
734
735 template<input_iterator I, sentinel_for<I> S,
736 weakly_incrementable O1, weakly_incrementable O2,
737 class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
738 requires indirectly_copyable<I, O1> && indirectly_copyable<I, O2>
739 constexpr partition_copy_result<I, O1, O2>
740 partition_copy(I first, S last, O1 out_true, O2 out_false, Pred pred,
Mark de Weverde6827b2023-02-24 20:35:41741 Proj proj = {}); // since C++20
Konstantin Varlamov065202f2022-07-20 08:57:13742
743 template<input_range R, weakly_incrementable O1, weakly_incrementable O2,
744 class Proj = identity,
745 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
746 requires indirectly_copyable<iterator_t<R>, O1> &&
747 indirectly_copyable<iterator_t<R>, O2>
748 constexpr partition_copy_result<borrowed_iterator_t<R>, O1, O2>
Mark de Weverde6827b2023-02-24 20:35:41749 partition_copy(R&& r, O1 out_true, O2 out_false, Pred pred, Proj proj = {}); // since C++20
Konstantin Varlamov065202f2022-07-20 08:57:13750
751 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
752 indirect_unary_predicate<projected<I, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:41753 constexpr I partition_point(I first, S last, Pred pred, Proj proj = {}); // since C++20
Konstantin Varlamov065202f2022-07-20 08:57:13754
755 template<forward_range R, class Proj = identity,
756 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
757 constexpr borrowed_iterator_t<R>
Mark de Weverde6827b2023-02-24 20:35:41758 partition_point(R&& r, Pred pred, Proj proj = {}); // since C++20
Konstantin Varlamov065202f2022-07-20 08:57:13759
Hui Xie25607d12022-06-26 15:13:43760 template<class I1, class I2, class O>
761 using merge_result = in_in_out_result<I1, I2, O>; // since C++20
762
763 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
764 weakly_incrementable O, class Comp = ranges::less, class Proj1 = identity,
765 class Proj2 = identity>
766 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
767 constexpr merge_result<I1, I2, O>
768 merge(I1 first1, S1 last1, I2 first2, S2 last2, O result,
769 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
770
771 template<input_range R1, input_range R2, weakly_incrementable O, class Comp = ranges::less,
772 class Proj1 = identity, class Proj2 = identity>
773 requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
774 constexpr merge_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
775 merge(R1&& r1, R2&& r2, O result,
776 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauser2c3bbac2022-06-23 10:23:41777
Nikolas Klauserf8cbe3cdf2022-07-06 12:03:00778 template<permutable I, sentinel_for<I> S, class T, class Proj = identity>
779 requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
780 constexpr subrange<I> ranges::remove(I first, S last, const T& value, Proj proj = {}); // since C++20
781
782 template<forward_range R, class T, class Proj = identity>
783 requires permutable<iterator_t<R>> &&
784 indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
785 constexpr borrowed_subrange_t<R>
786 ranges::remove(R&& r, const T& value, Proj proj = {}); // since C++20
787
788 template<permutable I, sentinel_for<I> S, class Proj = identity,
789 indirect_unary_predicate<projected<I, Proj>> Pred>
790 constexpr subrange<I> ranges::remove_if(I first, S last, Pred pred, Proj proj = {}); // since C++20
791
792 template<forward_range R, class Proj = identity,
793 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
794 requires permutable<iterator_t<R>>
795 constexpr borrowed_subrange_t<R>
796 ranges::remove_if(R&& r, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser7d426a32022-07-11 15:07:35797
Hui Xie1cdec6c2022-06-26 15:13:43798 template<class I, class O>
Nikolas Klauser7d426a32022-07-11 15:07:35799 using set_difference_result = in_out_result<I, O>; // since C++20
Hui Xie1cdec6c2022-06-26 15:13:43800
801 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
802 weakly_incrementable O, class Comp = ranges::less,
803 class Proj1 = identity, class Proj2 = identity>
804 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
805 constexpr set_difference_result<I1, O>
806 set_difference(I1 first1, S1 last1, I2 first2, S2 last2, O result,
807 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
808
809 template<input_range R1, input_range R2, weakly_incrementable O,
810 class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
811 requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
812 constexpr set_difference_result<borrowed_iterator_t<R1>, O>
813 set_difference(R1&& r1, R2&& r2, O result,
814 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauserf8cbe3cdf2022-07-06 12:03:00815
Hui Xie96b674f2022-07-08 14:21:40816 template<class I1, class I2, class O>
817 using set_intersection_result = in_in_out_result<I1, I2, O>; // since C++20
818
819 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
820 weakly_incrementable O, class Comp = ranges::less,
821 class Proj1 = identity, class Proj2 = identity>
822 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
823 constexpr set_intersection_result<I1, I2, O>
824 set_intersection(I1 first1, S1 last1, I2 first2, S2 last2, O result,
825 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
826
827 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
828 weakly_incrementable O, class Comp = ranges::less,
829 class Proj1 = identity, class Proj2 = identity>
830 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
831 constexpr set_intersection_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
832 set_intersection(R1&& r1, R2&& r2, O result,
833 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
834
Nikolas Klauser7d426a32022-07-11 15:07:35835 template <class _InIter, class _OutIter>
836 using reverse_copy_result = in_out_result<_InIter, _OutIter>; // since C++20
837
838 template<bidirectional_iterator I, sentinel_for<I> S, weakly_incrementable O>
839 requires indirectly_copyable<I, O>
840 constexpr ranges::reverse_copy_result<I, O>
841 ranges::reverse_copy(I first, S last, O result); // since C++20
842
843 template<bidirectional_range R, weakly_incrementable O>
844 requires indirectly_copyable<iterator_t<R>, O>
845 constexpr ranges::reverse_copy_result<borrowed_iterator_t<R>, O>
846 ranges::reverse_copy(R&& r, O result); // since C++20
847
Konstantin Varlamov36c746c2022-08-03 23:04:14848 template<permutable I, sentinel_for<I> S>
849 constexpr subrange<I> rotate(I first, I middle, S last); // since C++20
850
851 template<forward_range R>
852 requires permutable<iterator_t<R>>
Mark de Weverde6827b2023-02-24 20:35:41853 constexpr borrowed_subrange_t<R> rotate(R&& r, iterator_t<R> middle); // since C++20
Konstantin Varlamov36c746c2022-08-03 23:04:14854
Nikolas Klauser7d426a32022-07-11 15:07:35855 template <class _InIter, class _OutIter>
856 using rotate_copy_result = in_out_result<_InIter, _OutIter>; // since C++20
857
858 template<forward_iterator I, sentinel_for<I> S, weakly_incrementable O>
859 requires indirectly_copyable<I, O>
860 constexpr ranges::rotate_copy_result<I, O>
861 ranges::rotate_copy(I first, I middle, S last, O result); // since C++20
862
863 template<forward_range R, weakly_incrementable O>
864 requires indirectly_copyable<iterator_t<R>, O>
865 constexpr ranges::rotate_copy_result<borrowed_iterator_t<R>, O>
866 ranges::rotate_copy(R&& r, iterator_t<R> middle, O result); // since C++20
867
Konstantin Varlamov6bdb6422022-08-03 05:33:12868 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Gen>
869 requires (forward_iterator<I> || random_access_iterator<O>) &&
870 indirectly_copyable<I, O> &&
871 uniform_random_bit_generator<remove_reference_t<Gen>>
Mark de Weverde6827b2023-02-24 20:35:41872 O sample(I first, S last, O out, iter_difference_t<I> n, Gen&& g); // since C++20
Konstantin Varlamov6bdb6422022-08-03 05:33:12873
874 template<input_range R, weakly_incrementable O, class Gen>
875 requires (forward_range<R> || random_access_iterator<O>) &&
876 indirectly_copyable<iterator_t<R>, O> &&
877 uniform_random_bit_generator<remove_reference_t<Gen>>
Mark de Weverde6827b2023-02-24 20:35:41878 O sample(R&& r, O out, range_difference_t<R> n, Gen&& g); // since C++20
Konstantin Varlamov6bdb6422022-08-03 05:33:12879
Konstantin Varlamov14cf74d2022-07-22 16:58:56880 template<random_access_iterator I, sentinel_for<I> S, class Gen>
881 requires permutable<I> &&
882 uniform_random_bit_generator<remove_reference_t<Gen>>
Mark de Weverde6827b2023-02-24 20:35:41883 I shuffle(I first, S last, Gen&& g); // since C++20
Konstantin Varlamov14cf74d2022-07-22 16:58:56884
885 template<random_access_range R, class Gen>
886 requires permutable<iterator_t<R>> &&
887 uniform_random_bit_generator<remove_reference_t<Gen>>
Mark de Weverde6827b2023-02-24 20:35:41888 borrowed_iterator_t<R> shuffle(R&& r, Gen&& g); // since C++20
Konstantin Varlamov14cf74d2022-07-22 16:58:56889
Nikolas Klauser101d1e92022-07-13 16:07:26890 template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2,
Nikolas Klauser4038c852022-08-04 17:54:13891 sentinel_for<I2> S2, class Proj1 = identity, class Proj2 = identity,
892 indirect_equivalence_relation<projected<I1, Proj1>,
893 projected<I2, Proj2>> Pred = ranges::equal_to>
894 constexpr bool ranges::is_permutation(I1 first1, S1 last1, I2 first2, S2 last2,
895 Pred pred = {},
Mark de Weverde6827b2023-02-24 20:35:41896 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauser4038c852022-08-04 17:54:13897
898 template<forward_range R1, forward_range R2,
899 class Proj1 = identity, class Proj2 = identity,
900 indirect_equivalence_relation<projected<iterator_t<R1>, Proj1>,
901 projected<iterator_t<R2>, Proj2>> Pred = ranges::equal_to>
902 constexpr bool ranges::is_permutation(R1&& r1, R2&& r2, Pred pred = {},
Mark de Weverde6827b2023-02-24 20:35:41903 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauser4038c852022-08-04 17:54:13904
905 template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2,
Nikolas Klauser101d1e92022-07-13 16:07:26906 sentinel_for<I2> S2, class Pred = ranges::equal_to,
907 class Proj1 = identity, class Proj2 = identity>
908 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
909 constexpr subrange<I1>
910 ranges::search(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
911 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
912
913 template<forward_range R1, forward_range R2, class Pred = ranges::equal_to,
914 class Proj1 = identity, class Proj2 = identity>
915 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
916 constexpr borrowed_subrange_t<R1>
917 ranges::search(R1&& r1, R2&& r2, Pred pred = {},
918 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
919
920 template<forward_iterator I, sentinel_for<I> S, class T,
921 class Pred = ranges::equal_to, class Proj = identity>
922 requires indirectly_comparable<I, const T*, Pred, Proj>
923 constexpr subrange<I>
924 ranges::search_n(I first, S last, iter_difference_t<I> count,
925 const T& value, Pred pred = {}, Proj proj = {}); // since C++20
926
927 template<forward_range R, class T, class Pred = ranges::equal_to,
928 class Proj = identity>
929 requires indirectly_comparable<iterator_t<R>, const T*, Pred, Proj>
930 constexpr borrowed_subrange_t<R>
931 ranges::search_n(R&& r, range_difference_t<R> count,
932 const T& value, Pred pred = {}, Proj proj = {}); // since C++20
933
Christopher Di Bella39034382023-12-20 05:57:50934 template<input_iterator I, sentinel_for<I> S, class T,
935 indirectly-binary-left-foldable<T, I> F>
936 constexpr auto ranges::fold_left(I first, S last, T init, F f); // since C++23
937
938 template<input_range R, class T, indirectly-binary-left-foldable<T, iterator_t<R>> F>
939 constexpr auto fold_left(R&& r, T init, F f); // since C++23
940
941 template<class I, class T>
942 using fold_left_with_iter_result = in_value_result<I, T>; // since C++23
943
944 template<input_iterator I, sentinel_for<I> S, class T,
945 indirectly-binary-left-foldable<T, I> F>
946 constexpr see below fold_left_with_iter(I first, S last, T init, F f); // since C++23
947
948 template<input_range R, class T, indirectly-binary-left-foldable<T, iterator_t<R>> F>
949 constexpr see below fold_left_with_iter(R&& r, T init, F f); // since C++23
950
Nikolas Klauser101d1e92022-07-13 16:07:26951 template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2,
952 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
953 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
954 constexpr subrange<I1>
955 ranges::find_end(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
956 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
957
958 template<forward_range R1, forward_range R2,
959 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
960 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
961 constexpr borrowed_subrange_t<R1>
962 ranges::find_end(R1&& r1, R2&& r2, Pred pred = {},
963 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
964
Hui Xiea5c06382022-07-11 22:39:59965 template<class I1, class I2, class O>
966 using set_symmetric_difference_result = in_in_out_result<I1, I2, O>; // since C++20
967
968 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
969 weakly_incrementable O, class Comp = ranges::less,
970 class Proj1 = identity, class Proj2 = identity>
971 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
972 constexpr set_symmetric_difference_result<I1, I2, O>
973 set_symmetric_difference(I1 first1, S1 last1, I2 first2, S2 last2, O result,
974 Comp comp = {}, Proj1 proj1 = {},
975 Proj2 proj2 = {}); // since C++20
Hui Xie8a617492022-07-27 12:20:16976
Hui Xiea5c06382022-07-11 22:39:59977 template<input_range R1, input_range R2, weakly_incrementable O,
978 class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
979 requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
980 constexpr set_symmetric_difference_result<borrowed_iterator_t<R1>,
981 borrowed_iterator_t<R2>, O>
982 set_symmetric_difference(R1&& r1, R2&& r2, O result, Comp comp = {},
983 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Hui Xie0f6364b82022-07-14 19:35:15984
985 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
986 indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
987 constexpr subrange<I>
988 equal_range(I first, S last, const T& value, Comp comp = {}, Proj proj = {}); // since C++20
Hui Xie8a617492022-07-27 12:20:16989
Hui Xie0f6364b82022-07-14 19:35:15990 template<forward_range R, class T, class Proj = identity,
991 indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
992 ranges::less>
993 constexpr borrowed_subrange_t<R>
994 equal_range(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20
Hui Xie8a617492022-07-27 12:20:16995
Hui Xie3151b952022-07-13 16:20:22996 template<class I1, class I2, class O>
997 using set_union_result = in_in_out_result<I1, I2, O>; // since C++20
998
999 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
1000 weakly_incrementable O, class Comp = ranges::less,
1001 class Proj1 = identity, class Proj2 = identity>
1002 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
1003 constexpr set_union_result<I1, I2, O>
1004 set_union(I1 first1, S1 last1, I2 first2, S2 last2, O result, Comp comp = {},
1005 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
1006
1007 template<input_range R1, input_range R2, weakly_incrementable O,
1008 class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
1009 requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
1010 constexpr set_union_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
1011 set_union(R1&& r1, R2&& r2, O result, Comp comp = {},
1012 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Hui Xiec5599642022-07-19 19:54:351013
1014 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
1015 class Proj1 = identity, class Proj2 = identity,
1016 indirect_strict_weak_order<projected<I1, Proj1>, projected<I2, Proj2>> Comp =
1017 ranges::less>
1018 constexpr bool includes(I1 first1, S1 last1, I2 first2, S2 last2, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:411019 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Hui Xie8a617492022-07-27 12:20:161020
Hui Xiec5599642022-07-19 19:54:351021 template<input_range R1, input_range R2, class Proj1 = identity,
1022 class Proj2 = identity,
1023 indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>,
1024 projected<iterator_t<R2>, Proj2>> Comp = ranges::less>
1025 constexpr bool includes(R1&& r1, R2&& r2, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:411026 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Hui Xie8a617492022-07-27 12:20:161027
1028 template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
1029 class Proj = identity>
1030 requires sortable<I, Comp, Proj>
Mark de Weverde6827b2023-02-24 20:35:411031 I inplace_merge(I first, I middle, S last, Comp comp = {}, Proj proj = {}); // since C++20
Hui Xie8a617492022-07-27 12:20:161032
1033 template<bidirectional_range R, class Comp = ranges::less, class Proj = identity>
1034 requires sortable<iterator_t<R>, Comp, Proj>
1035 borrowed_iterator_t<R>
1036 inplace_merge(R&& r, iterator_t<R> middle, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:411037 Proj proj = {}); // since C++20
Hui Xie72f57e32022-07-23 00:44:251038
1039 template<permutable I, sentinel_for<I> S, class Proj = identity,
1040 indirect_equivalence_relation<projected<I, Proj>> C = ranges::equal_to>
Mark de Weverde6827b2023-02-24 20:35:411041 constexpr subrange<I> unique(I first, S last, C comp = {}, Proj proj = {}); // since C++20
Hui Xie72f57e32022-07-23 00:44:251042
1043 template<forward_range R, class Proj = identity,
1044 indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to>
1045 requires permutable<iterator_t<R>>
1046 constexpr borrowed_subrange_t<R>
Mark de Weverde6827b2023-02-24 20:35:411047 unique(R&& r, C comp = {}, Proj proj = {}); // since C++20
Hui Xie72f57e32022-07-23 00:44:251048
1049 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Proj = identity,
1050 indirect_equivalence_relation<projected<I, Proj>> C = ranges::equal_to>
1051 requires indirectly_copyable<I, O> &&
1052 (forward_iterator<I> ||
1053 (input_iterator<O> && same_as<iter_value_t<I>, iter_value_t<O>>) ||
1054 indirectly_copyable_storable<I, O>)
1055 constexpr unique_copy_result<I, O>
Mark de Weverde6827b2023-02-24 20:35:411056 unique_copy(I first, S last, O result, C comp = {}, Proj proj = {}); // since C++20
Hui Xie72f57e32022-07-23 00:44:251057
1058 template<input_range R, weakly_incrementable O, class Proj = identity,
1059 indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to>
1060 requires indirectly_copyable<iterator_t<R>, O> &&
1061 (forward_iterator<iterator_t<R>> ||
1062 (input_iterator<O> && same_as<range_value_t<R>, iter_value_t<O>>) ||
1063 indirectly_copyable_storable<iterator_t<R>, O>)
1064 constexpr unique_copy_result<borrowed_iterator_t<R>, O>
Mark de Weverde6827b2023-02-24 20:35:411065 unique_copy(R&& r, O result, C comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591066
1067 template<class I, class O>
Mark de Weverde6827b2023-02-24 20:35:411068 using remove_copy_result = in_out_result<I, O>; // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591069
1070 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class T,
1071 class Proj = identity>
1072 indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
1073 constexpr remove_copy_result<I, O>
Mark de Weverde6827b2023-02-24 20:35:411074 remove_copy(I first, S last, O result, const T& value, Proj proj = {}); // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591075
1076 template<input_range R, weakly_incrementable O, class T, class Proj = identity>
1077 requires indirectly_copyable<iterator_t<R>, O> &&
1078 indirect_binary_predicate<ranges::equal_to,
1079 projected<iterator_t<R>, Proj>, const T*>
1080 constexpr remove_copy_result<borrowed_iterator_t<R>, O>
Mark de Weverde6827b2023-02-24 20:35:411081 remove_copy(R&& r, O result, const T& value, Proj proj = {}); // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591082
1083 template<class I, class O>
Mark de Weverde6827b2023-02-24 20:35:411084 using remove_copy_if_result = in_out_result<I, O>; // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591085
1086 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O,
1087 class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
1088 requires indirectly_copyable<I, O>
1089 constexpr remove_copy_if_result<I, O>
Mark de Weverde6827b2023-02-24 20:35:411090 remove_copy_if(I first, S last, O result, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591091
1092 template<input_range R, weakly_incrementable O, class Proj = identity,
1093 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
1094 requires indirectly_copyable<iterator_t<R>, O>
1095 constexpr remove_copy_if_result<borrowed_iterator_t<R>, O>
Mark de Weverde6827b2023-02-24 20:35:411096 remove_copy_if(R&& r, O result, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591097
Nikolas Klauser93172c12022-08-03 05:25:001098 template<class I, class O>
Mark de Weverde6827b2023-02-24 20:35:411099 using replace_copy_result = in_out_result<I, O>; // since C++20
Nikolas Klauser93172c12022-08-03 05:25:001100
1101 template<input_iterator I, sentinel_for<I> S, class T1, class T2,
1102 output_iterator<const T2&> O, class Proj = identity>
1103 requires indirectly_copyable<I, O> &&
1104 indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*>
1105 constexpr replace_copy_result<I, O>
1106 replace_copy(I first, S last, O result, const T1& old_value, const T2& new_value,
Mark de Weverde6827b2023-02-24 20:35:411107 Proj proj = {}); // since C++20
Nikolas Klauser93172c12022-08-03 05:25:001108
1109 template<input_range R, class T1, class T2, output_iterator<const T2&> O,
1110 class Proj = identity>
1111 requires indirectly_copyable<iterator_t<R>, O> &&
1112 indirect_binary_predicate<ranges::equal_to,
1113 projected<iterator_t<R>, Proj>, const T1*>
1114 constexpr replace_copy_result<borrowed_iterator_t<R>, O>
1115 replace_copy(R&& r, O result, const T1& old_value, const T2& new_value,
Mark de Weverde6827b2023-02-24 20:35:411116 Proj proj = {}); // since C++20
Nikolas Klauser93172c12022-08-03 05:25:001117
1118 template<class I, class O>
Mark de Weverde6827b2023-02-24 20:35:411119 using replace_copy_if_result = in_out_result<I, O>; // since C++20
Nikolas Klauser93172c12022-08-03 05:25:001120
1121 template<input_iterator I, sentinel_for<I> S, class T, output_iterator<const T&> O,
1122 class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
1123 requires indirectly_copyable<I, O>
1124 constexpr replace_copy_if_result<I, O>
1125 replace_copy_if(I first, S last, O result, Pred pred, const T& new_value,
Mark de Weverde6827b2023-02-24 20:35:411126 Proj proj = {}); // since C++20
Nikolas Klauser93172c12022-08-03 05:25:001127
1128 template<input_range R, class T, output_iterator<const T&> O, class Proj = identity,
1129 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
1130 requires indirectly_copyable<iterator_t<R>, O>
1131 constexpr replace_copy_if_result<borrowed_iterator_t<R>, O>
1132 replace_copy_if(R&& r, 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
Nikolas Klauser68264b62022-08-03 05:40:131135 template<class I>
Mark de Weverde6827b2023-02-24 20:35:411136 using prev_permutation_result = in_found_result<I>; // since C++20
Nikolas Klauser68264b62022-08-03 05:40:131137
1138 template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
1139 class Proj = identity>
1140 requires sortable<I, Comp, Proj>
1141 constexpr ranges::prev_permutation_result<I>
Mark de Weverde6827b2023-02-24 20:35:411142 ranges::prev_permutation(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser68264b62022-08-03 05:40:131143
1144 template<bidirectional_range R, class Comp = ranges::less,
1145 class Proj = identity>
1146 requires sortable<iterator_t<R>, Comp, Proj>
1147 constexpr ranges::prev_permutation_result<borrowed_iterator_t<R>>
Mark de Weverde6827b2023-02-24 20:35:411148 ranges::prev_permutation(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser68264b62022-08-03 05:40:131149
1150 template<class I>
Mark de Weverde6827b2023-02-24 20:35:411151 using next_permutation_result = in_found_result<I>; // since C++20
Nikolas Klauser68264b62022-08-03 05:40:131152
1153 template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
1154 class Proj = identity>
1155 requires sortable<I, Comp, Proj>
1156 constexpr ranges::next_permutation_result<I>
Mark de Weverde6827b2023-02-24 20:35:411157 ranges::next_permutation(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser68264b62022-08-03 05:40:131158
1159 template<bidirectional_range R, class Comp = ranges::less,
1160 class Proj = identity>
1161 requires sortable<iterator_t<R>, Comp, Proj>
1162 constexpr ranges::next_permutation_result<borrowed_iterator_t<R>>
Mark de Weverde6827b2023-02-24 20:35:411163 ranges::next_permutation(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser68264b62022-08-03 05:40:131164
Nikolas Klauserd3729bb2022-01-14 01:55:511165}
1166
Nikolas Klauser68264b62022-08-03 05:40:131167template <class InputIterator, class Predicate>
Marshall Clow706ffef2018-01-15 17:20:361168 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161169 all_of(InputIterator first, InputIterator last, Predicate pred);
1170
1171template <class InputIterator, class Predicate>
Marshall Clow706ffef2018-01-15 17:20:361172 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161173 any_of(InputIterator first, InputIterator last, Predicate pred);
1174
1175template <class InputIterator, class Predicate>
Marshall Clow706ffef2018-01-15 17:20:361176 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161177 none_of(InputIterator first, InputIterator last, Predicate pred);
1178
1179template <class InputIterator, class Function>
Marshall Clow1b9a4ff2018-01-22 20:44:331180 constexpr Function // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161181 for_each(InputIterator first, InputIterator last, Function f);
1182
Marshall Clowd5c65ff2017-05-25 02:29:541183template<class InputIterator, class Size, class Function>
Marshall Clow1b9a4ff2018-01-22 20:44:331184 constexpr InputIterator // constexpr in C++20
1185 for_each_n(InputIterator first, Size n, Function f); // C++17
Marshall Clowd5c65ff2017-05-25 02:29:541186
Howard Hinnant3e519522010-05-11 19:42:161187template <class InputIterator, class T>
Marshall Clow86944282018-01-15 19:26:051188 constexpr InputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161189 find(InputIterator first, InputIterator last, const T& value);
1190
1191template <class InputIterator, class Predicate>
Marshall Clow86944282018-01-15 19:26:051192 constexpr InputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161193 find_if(InputIterator first, InputIterator last, Predicate pred);
1194
1195template<class InputIterator, class Predicate>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181196 constexpr InputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161197 find_if_not(InputIterator first, InputIterator last, Predicate pred);
1198
1199template <class ForwardIterator1, class ForwardIterator2>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181200 constexpr ForwardIterator1 // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161201 find_end(ForwardIterator1 first1, ForwardIterator1 last1,
1202 ForwardIterator2 first2, ForwardIterator2 last2);
1203
1204template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181205 constexpr ForwardIterator1 // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161206 find_end(ForwardIterator1 first1, ForwardIterator1 last1,
1207 ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
1208
1209template <class ForwardIterator1, class ForwardIterator2>
Marshall Clow86944282018-01-15 19:26:051210 constexpr ForwardIterator1 // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161211 find_first_of(ForwardIterator1 first1, ForwardIterator1 last1,
1212 ForwardIterator2 first2, ForwardIterator2 last2);
1213
1214template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
Marshall Clow86944282018-01-15 19:26:051215 constexpr ForwardIterator1 // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161216 find_first_of(ForwardIterator1 first1, ForwardIterator1 last1,
1217 ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
1218
1219template <class ForwardIterator>
Marshall Clow86944282018-01-15 19:26:051220 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161221 adjacent_find(ForwardIterator first, ForwardIterator last);
1222
1223template <class ForwardIterator, class BinaryPredicate>
Marshall Clow86944282018-01-15 19:26:051224 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161225 adjacent_find(ForwardIterator first, ForwardIterator last, BinaryPredicate pred);
1226
1227template <class InputIterator, class T>
Marshall Clow056f15e2018-01-15 19:40:341228 constexpr typename iterator_traits<InputIterator>::difference_type // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161229 count(InputIterator first, InputIterator last, const T& value);
1230
1231template <class InputIterator, class Predicate>
Marshall Clow056f15e2018-01-15 19:40:341232 constexpr typename iterator_traits<InputIterator>::difference_type // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161233 count_if(InputIterator first, InputIterator last, Predicate pred);
1234
1235template <class InputIterator1, class InputIterator2>
Marshall Clow6538e28d2018-01-16 02:04:101236 constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161237 mismatch(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2);
1238
Marshall Clow0b0bbd22013-05-09 21:14:231239template <class InputIterator1, class InputIterator2>
Marshall Clow6538e28d2018-01-16 02:04:101240 constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20
Aditya Kumar331fb802016-08-25 11:52:381241 mismatch(InputIterator1 first1, InputIterator1 last1,
Marshall Clow0b0bbd22013-05-09 21:14:231242 InputIterator2 first2, InputIterator2 last2); // **C++14**
1243
Howard Hinnant3e519522010-05-11 19:42:161244template <class InputIterator1, class InputIterator2, class BinaryPredicate>
Marshall Clow6538e28d2018-01-16 02:04:101245 constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161246 mismatch(InputIterator1 first1, InputIterator1 last1,
1247 InputIterator2 first2, BinaryPredicate pred);
1248
Marshall Clow0b0bbd22013-05-09 21:14:231249template <class InputIterator1, class InputIterator2, class BinaryPredicate>
Marshall Clow6538e28d2018-01-16 02:04:101250 constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20
Marshall Clow0b0bbd22013-05-09 21:14:231251 mismatch(InputIterator1 first1, InputIterator1 last1,
1252 InputIterator2 first2, InputIterator2 last2,
1253 BinaryPredicate pred); // **C++14**
1254
Howard Hinnant3e519522010-05-11 19:42:161255template <class InputIterator1, class InputIterator2>
Marshall Clow6538e28d2018-01-16 02:04:101256 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161257 equal(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2);
1258
Marshall Clow0b0bbd22013-05-09 21:14:231259template <class InputIterator1, class InputIterator2>
Marshall Clow6538e28d2018-01-16 02:04:101260 constexpr bool // constexpr in C++20
Aditya Kumar331fb802016-08-25 11:52:381261 equal(InputIterator1 first1, InputIterator1 last1,
Marshall Clow0b0bbd22013-05-09 21:14:231262 InputIterator2 first2, InputIterator2 last2); // **C++14**
1263
Howard Hinnant3e519522010-05-11 19:42:161264template <class InputIterator1, class InputIterator2, class BinaryPredicate>
Marshall Clow6538e28d2018-01-16 02:04:101265 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161266 equal(InputIterator1 first1, InputIterator1 last1,
1267 InputIterator2 first2, BinaryPredicate pred);
1268
Marshall Clow0b0bbd22013-05-09 21:14:231269template <class InputIterator1, class InputIterator2, class BinaryPredicate>
Marshall Clow6538e28d2018-01-16 02:04:101270 constexpr bool // constexpr in C++20
Marshall Clow0b0bbd22013-05-09 21:14:231271 equal(InputIterator1 first1, InputIterator1 last1,
1272 InputIterator2 first2, InputIterator2 last2,
1273 BinaryPredicate pred); // **C++14**
1274
Howard Hinnant3e519522010-05-11 19:42:161275template<class ForwardIterator1, class ForwardIterator2>
Marshall Clow49c76432018-01-15 16:16:321276 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161277 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
1278 ForwardIterator2 first2);
1279
Marshall Clow0b0bbd22013-05-09 21:14:231280template<class ForwardIterator1, class ForwardIterator2>
Marshall Clow49c76432018-01-15 16:16:321281 constexpr bool // constexpr in C++20
Marshall Clow0b0bbd22013-05-09 21:14:231282 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
1283 ForwardIterator2 first2, ForwardIterator2 last2); // **C++14**
1284
Howard Hinnant3e519522010-05-11 19:42:161285template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
Marshall Clow49c76432018-01-15 16:16:321286 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161287 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
1288 ForwardIterator2 first2, BinaryPredicate pred);
1289
Marshall Clow0b0bbd22013-05-09 21:14:231290template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
Marshall Clow49c76432018-01-15 16:16:321291 constexpr bool // constexpr in C++20
Marshall Clow0b0bbd22013-05-09 21:14:231292 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
1293 ForwardIterator2 first2, ForwardIterator2 last2,
1294 BinaryPredicate pred); // **C++14**
1295
Howard Hinnant3e519522010-05-11 19:42:161296template <class ForwardIterator1, class ForwardIterator2>
Marshall Clow12f0a772018-01-16 15:48:271297 constexpr ForwardIterator1 // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161298 search(ForwardIterator1 first1, ForwardIterator1 last1,
1299 ForwardIterator2 first2, ForwardIterator2 last2);
1300
1301template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
Marshall Clow12f0a772018-01-16 15:48:271302 constexpr ForwardIterator1 // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161303 search(ForwardIterator1 first1, ForwardIterator1 last1,
1304 ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
1305
1306template <class ForwardIterator, class Size, class T>
Marshall Clow12f0a772018-01-16 15:48:271307 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161308 search_n(ForwardIterator first, ForwardIterator last, Size count, const T& value);
1309
1310template <class ForwardIterator, class Size, class T, class BinaryPredicate>
Marshall Clow12f0a772018-01-16 15:48:271311 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161312 search_n(ForwardIterator first, ForwardIterator last,
1313 Size count, const T& value, BinaryPredicate pred);
1314
1315template <class InputIterator, class OutputIterator>
Louis Dionne13c90a52019-11-06 12:02:411316 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161317 copy(InputIterator first, InputIterator last, OutputIterator result);
1318
1319template<class InputIterator, class OutputIterator, class Predicate>
Louis Dionne13c90a52019-11-06 12:02:411320 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161321 copy_if(InputIterator first, InputIterator last,
1322 OutputIterator result, Predicate pred);
1323
1324template<class InputIterator, class Size, class OutputIterator>
Louis Dionne13c90a52019-11-06 12:02:411325 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161326 copy_n(InputIterator first, Size n, OutputIterator result);
1327
1328template <class BidirectionalIterator1, class BidirectionalIterator2>
Louis Dionne13c90a52019-11-06 12:02:411329 constexpr BidirectionalIterator2 // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161330 copy_backward(BidirectionalIterator1 first, BidirectionalIterator1 last,
1331 BidirectionalIterator2 result);
1332
Konstantin Varlamov79a2b4b2022-06-28 18:59:591333// [alg.move], move
1334template<class InputIterator, class OutputIterator>
1335 constexpr OutputIterator move(InputIterator first, InputIterator last,
1336 OutputIterator result);
1337
1338template<class BidirectionalIterator1, class BidirectionalIterator2>
1339 constexpr BidirectionalIterator2
1340 move_backward(BidirectionalIterator1 first, BidirectionalIterator1 last,
1341 BidirectionalIterator2 result);
1342
Howard Hinnant3e519522010-05-11 19:42:161343template <class ForwardIterator1, class ForwardIterator2>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181344 constexpr ForwardIterator2 // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161345 swap_ranges(ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2);
1346
Konstantin Varlamov79a2b4b2022-06-28 18:59:591347namespace ranges {
1348 template<class I1, class I2>
1349 using swap_ranges_result = in_in_result<I1, I2>;
1350
Nikolas Klauser9d905312022-02-10 12:33:031351template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2>
1352 requires indirectly_swappable<I1, I2>
1353 constexpr ranges::swap_ranges_result<I1, I2>
Konstantin Varlamov79a2b4b2022-06-28 18:59:591354 swap_ranges(I1 first1, S1 last1, I2 first2, S2 last2);
Nikolas Klauser9d905312022-02-10 12:33:031355
1356template<input_range R1, input_range R2>
1357 requires indirectly_swappable<iterator_t<R1>, iterator_t<R2>>
1358 constexpr ranges::swap_ranges_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
Konstantin Varlamov79a2b4b2022-06-28 18:59:591359 swap_ranges(R1&& r1, R2&& r2);
1360}
Nikolas Klauser9d905312022-02-10 12:33:031361
Howard Hinnant3e519522010-05-11 19:42:161362template <class ForwardIterator1, class ForwardIterator2>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181363 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161364 iter_swap(ForwardIterator1 a, ForwardIterator2 b);
1365
1366template <class InputIterator, class OutputIterator, class UnaryOperation>
Marshall Clow99894b62018-01-19 17:45:391367 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161368 transform(InputIterator first, InputIterator last, OutputIterator result, UnaryOperation op);
1369
1370template <class InputIterator1, class InputIterator2, class OutputIterator, class BinaryOperation>
Marshall Clow99894b62018-01-19 17:45:391371 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161372 transform(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2,
1373 OutputIterator result, BinaryOperation binary_op);
1374
1375template <class ForwardIterator, class T>
Marshall Clow12c74232018-01-19 18:07:291376 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161377 replace(ForwardIterator first, ForwardIterator last, const T& old_value, const T& new_value);
1378
1379template <class ForwardIterator, class Predicate, class T>
Marshall Clow12c74232018-01-19 18:07:291380 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161381 replace_if(ForwardIterator first, ForwardIterator last, Predicate pred, const T& new_value);
1382
1383template <class InputIterator, class OutputIterator, class T>
Marshall Clow12c74232018-01-19 18:07:291384 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161385 replace_copy(InputIterator first, InputIterator last, OutputIterator result,
1386 const T& old_value, const T& new_value);
1387
1388template <class InputIterator, class OutputIterator, class Predicate, class T>
Marshall Clow12c74232018-01-19 18:07:291389 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161390 replace_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred, const T& new_value);
1391
1392template <class ForwardIterator, class T>
Marshall Clow4bfb9312018-01-20 20:14:321393 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161394 fill(ForwardIterator first, ForwardIterator last, const T& value);
1395
1396template <class OutputIterator, class Size, class T>
Marshall Clow4bfb9312018-01-20 20:14:321397 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161398 fill_n(OutputIterator first, Size n, const T& value);
1399
1400template <class ForwardIterator, class Generator>
Marshall Clow4bfb9312018-01-20 20:14:321401 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161402 generate(ForwardIterator first, ForwardIterator last, Generator gen);
1403
1404template <class OutputIterator, class Size, class Generator>
Marshall Clow4bfb9312018-01-20 20:14:321405 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161406 generate_n(OutputIterator first, Size n, Generator gen);
1407
1408template <class ForwardIterator, class T>
Marshall Clowe8ea8292018-01-22 21:43:041409 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161410 remove(ForwardIterator first, ForwardIterator last, const T& value);
1411
1412template <class ForwardIterator, class Predicate>
Marshall Clowe8ea8292018-01-22 21:43:041413 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161414 remove_if(ForwardIterator first, ForwardIterator last, Predicate pred);
1415
1416template <class InputIterator, class OutputIterator, class T>
Marshall Clowe8ea8292018-01-22 21:43:041417 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161418 remove_copy(InputIterator first, InputIterator last, OutputIterator result, const T& value);
1419
1420template <class InputIterator, class OutputIterator, class Predicate>
Marshall Clowe8ea8292018-01-22 21:43:041421 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161422 remove_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred);
1423
1424template <class ForwardIterator>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181425 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161426 unique(ForwardIterator first, ForwardIterator last);
1427
1428template <class ForwardIterator, class BinaryPredicate>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181429 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161430 unique(ForwardIterator first, ForwardIterator last, BinaryPredicate pred);
1431
1432template <class InputIterator, class OutputIterator>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181433 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161434 unique_copy(InputIterator first, InputIterator last, OutputIterator result);
1435
1436template <class InputIterator, class OutputIterator, class BinaryPredicate>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181437 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161438 unique_copy(InputIterator first, InputIterator last, OutputIterator result, BinaryPredicate pred);
1439
1440template <class BidirectionalIterator>
Arthur O'Dwyerf851db32020-12-17 05:01:081441 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161442 reverse(BidirectionalIterator first, BidirectionalIterator last);
1443
1444template <class BidirectionalIterator, class OutputIterator>
Marshall Clowe8ea8292018-01-22 21:43:041445 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161446 reverse_copy(BidirectionalIterator first, BidirectionalIterator last, OutputIterator result);
1447
1448template <class ForwardIterator>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181449 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161450 rotate(ForwardIterator first, ForwardIterator middle, ForwardIterator last);
1451
1452template <class ForwardIterator, class OutputIterator>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181453 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161454 rotate_copy(ForwardIterator first, ForwardIterator middle, ForwardIterator last, OutputIterator result);
1455
1456template <class RandomAccessIterator>
1457 void
Marshall Clow0f37a412017-03-23 13:43:371458 random_shuffle(RandomAccessIterator first, RandomAccessIterator last); // deprecated in C++14, removed in C++17
Howard Hinnant3e519522010-05-11 19:42:161459
1460template <class RandomAccessIterator, class RandomNumberGenerator>
1461 void
Marshall Clow06965c12014-03-03 06:14:191462 random_shuffle(RandomAccessIterator first, RandomAccessIterator last,
Marshall Clow0f37a412017-03-23 13:43:371463 RandomNumberGenerator& rand); // deprecated in C++14, removed in C++17
Howard Hinnant3e519522010-05-11 19:42:161464
Eric Fiseliere7154702016-08-28 22:14:371465template<class PopulationIterator, class SampleIterator,
1466 class Distance, class UniformRandomBitGenerator>
1467 SampleIterator sample(PopulationIterator first, PopulationIterator last,
1468 SampleIterator out, Distance n,
1469 UniformRandomBitGenerator&& g); // C++17
1470
Howard Hinnantf9d540b2010-05-26 17:49:341471template<class RandomAccessIterator, class UniformRandomNumberGenerator>
1472 void shuffle(RandomAccessIterator first, RandomAccessIterator last,
Howard Hinnantfb340102010-11-18 01:47:021473 UniformRandomNumberGenerator&& g);
Howard Hinnantf9d540b2010-05-26 17:49:341474
Arthur O'Dwyer3fbd3ea2020-12-26 06:39:031475template<class ForwardIterator>
1476 constexpr ForwardIterator
1477 shift_left(ForwardIterator first, ForwardIterator last,
1478 typename iterator_traits<ForwardIterator>::difference_type n); // C++20
1479
1480template<class ForwardIterator>
1481 constexpr ForwardIterator
1482 shift_right(ForwardIterator first, ForwardIterator last,
1483 typename iterator_traits<ForwardIterator>::difference_type n); // C++20
1484
Howard Hinnant3e519522010-05-11 19:42:161485template <class InputIterator, class Predicate>
Marshall Clow49c76432018-01-15 16:16:321486 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161487 is_partitioned(InputIterator first, InputIterator last, Predicate pred);
1488
1489template <class ForwardIterator, class Predicate>
Arthur O'Dwyerf851db32020-12-17 05:01:081490 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161491 partition(ForwardIterator first, ForwardIterator last, Predicate pred);
1492
1493template <class InputIterator, class OutputIterator1,
1494 class OutputIterator2, class Predicate>
Marshall Clow1b9a4ff2018-01-22 20:44:331495 constexpr pair<OutputIterator1, OutputIterator2> // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161496 partition_copy(InputIterator first, InputIterator last,
1497 OutputIterator1 out_true, OutputIterator2 out_false,
1498 Predicate pred);
1499
1500template <class ForwardIterator, class Predicate>
1501 ForwardIterator
1502 stable_partition(ForwardIterator first, ForwardIterator last, Predicate pred);
1503
1504template<class ForwardIterator, class Predicate>
Marshall Clowd57c03d2018-01-16 02:34:411505 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161506 partition_point(ForwardIterator first, ForwardIterator last, Predicate pred);
1507
1508template <class ForwardIterator>
Marshall Clow49c76432018-01-15 16:16:321509 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161510 is_sorted(ForwardIterator first, ForwardIterator last);
1511
1512template <class ForwardIterator, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181513 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161514 is_sorted(ForwardIterator first, ForwardIterator last, Compare comp);
1515
1516template<class ForwardIterator>
Marshall Clow056f15e2018-01-15 19:40:341517 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161518 is_sorted_until(ForwardIterator first, ForwardIterator last);
1519
1520template <class ForwardIterator, class Compare>
Marshall Clow056f15e2018-01-15 19:40:341521 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161522 is_sorted_until(ForwardIterator first, ForwardIterator last, Compare comp);
1523
1524template <class RandomAccessIterator>
Arthur O'Dwyer493f1402020-12-20 20:21:421525 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161526 sort(RandomAccessIterator first, RandomAccessIterator last);
1527
1528template <class RandomAccessIterator, class Compare>
Arthur O'Dwyer493f1402020-12-20 20:21:421529 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161530 sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1531
1532template <class RandomAccessIterator>
1533 void
1534 stable_sort(RandomAccessIterator first, RandomAccessIterator last);
1535
1536template <class RandomAccessIterator, class Compare>
1537 void
1538 stable_sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1539
1540template <class RandomAccessIterator>
Arthur O'Dwyer5386aa22020-12-17 05:26:181541 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161542 partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last);
1543
1544template <class RandomAccessIterator, class Compare>
Arthur O'Dwyer5386aa22020-12-17 05:26:181545 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161546 partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last, Compare comp);
1547
1548template <class InputIterator, class RandomAccessIterator>
Arthur O'Dwyer5386aa22020-12-17 05:26:181549 constexpr RandomAccessIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161550 partial_sort_copy(InputIterator first, InputIterator last,
1551 RandomAccessIterator result_first, RandomAccessIterator result_last);
1552
1553template <class InputIterator, class RandomAccessIterator, class Compare>
Arthur O'Dwyer5386aa22020-12-17 05:26:181554 constexpr RandomAccessIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161555 partial_sort_copy(InputIterator first, InputIterator last,
1556 RandomAccessIterator result_first, RandomAccessIterator result_last, Compare comp);
1557
1558template <class RandomAccessIterator>
Arthur O'Dwyer5d956562021-02-04 23:12:521559 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161560 nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last);
1561
1562template <class RandomAccessIterator, class Compare>
Arthur O'Dwyer5d956562021-02-04 23:12:521563 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161564 nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last, Compare comp);
1565
1566template <class ForwardIterator, class T>
Marshall Clowd57c03d2018-01-16 02:34:411567 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161568 lower_bound(ForwardIterator first, ForwardIterator last, const T& value);
1569
1570template <class ForwardIterator, class T, class Compare>
Marshall Clowd57c03d2018-01-16 02:34:411571 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161572 lower_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
1573
1574template <class ForwardIterator, class T>
Marshall Clowd57c03d2018-01-16 02:34:411575 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161576 upper_bound(ForwardIterator first, ForwardIterator last, const T& value);
1577
1578template <class ForwardIterator, class T, class Compare>
Marshall Clowd57c03d2018-01-16 02:34:411579 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161580 upper_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
1581
1582template <class ForwardIterator, class T>
Marshall Clowd57c03d2018-01-16 02:34:411583 constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161584 equal_range(ForwardIterator first, ForwardIterator last, const T& value);
1585
1586template <class ForwardIterator, class T, class Compare>
Marshall Clowd57c03d2018-01-16 02:34:411587 constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161588 equal_range(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
1589
1590template <class ForwardIterator, class T>
Marshall Clowd57c03d2018-01-16 02:34:411591 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161592 binary_search(ForwardIterator first, ForwardIterator last, const T& value);
1593
1594template <class ForwardIterator, class T, class Compare>
Marshall Clow8da1a482018-01-22 23:10:401595 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161596 binary_search(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
1597
1598template <class InputIterator1, class InputIterator2, class OutputIterator>
Arthur O'Dwyer14098cf2020-12-04 18:47:121599 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161600 merge(InputIterator1 first1, InputIterator1 last1,
1601 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1602
1603template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
Arthur O'Dwyer14098cf2020-12-04 18:47:121604 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161605 merge(InputIterator1 first1, InputIterator1 last1,
1606 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1607
1608template <class BidirectionalIterator>
1609 void
1610 inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last);
1611
1612template <class BidirectionalIterator, class Compare>
1613 void
1614 inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last, Compare comp);
1615
1616template <class InputIterator1, class InputIterator2>
Marshall Clow8da1a482018-01-22 23:10:401617 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161618 includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2);
1619
1620template <class InputIterator1, class InputIterator2, class Compare>
Marshall Clow8da1a482018-01-22 23:10:401621 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161622 includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, Compare comp);
1623
1624template <class InputIterator1, class InputIterator2, class OutputIterator>
Arthur O'Dwyer14098cf2020-12-04 18:47:121625 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161626 set_union(InputIterator1 first1, InputIterator1 last1,
1627 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1628
1629template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
Arthur O'Dwyer14098cf2020-12-04 18:47:121630 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161631 set_union(InputIterator1 first1, InputIterator1 last1,
1632 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1633
1634template <class InputIterator1, class InputIterator2, class OutputIterator>
Marshall Clow8da1a482018-01-22 23:10:401635 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161636 set_intersection(InputIterator1 first1, InputIterator1 last1,
1637 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1638
1639template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
Marshall Clow8da1a482018-01-22 23:10:401640 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161641 set_intersection(InputIterator1 first1, InputIterator1 last1,
1642 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1643
1644template <class InputIterator1, class InputIterator2, class OutputIterator>
Arthur O'Dwyer14098cf2020-12-04 18:47:121645 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161646 set_difference(InputIterator1 first1, InputIterator1 last1,
1647 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1648
1649template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
Arthur O'Dwyer14098cf2020-12-04 18:47:121650 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161651 set_difference(InputIterator1 first1, InputIterator1 last1,
1652 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1653
1654template <class InputIterator1, class InputIterator2, class OutputIterator>
Arthur O'Dwyer14098cf2020-12-04 18:47:121655 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161656 set_symmetric_difference(InputIterator1 first1, InputIterator1 last1,
1657 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1658
1659template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
Arthur O'Dwyer14098cf2020-12-04 18:47:121660 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161661 set_symmetric_difference(InputIterator1 first1, InputIterator1 last1,
1662 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1663
1664template <class RandomAccessIterator>
Arthur O'Dwyer5386aa22020-12-17 05:26:181665 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161666 push_heap(RandomAccessIterator first, RandomAccessIterator last);
1667
1668template <class RandomAccessIterator, class Compare>
Arthur O'Dwyer5386aa22020-12-17 05:26:181669 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161670 push_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1671
1672template <class RandomAccessIterator>
Arthur O'Dwyer5386aa22020-12-17 05:26:181673 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161674 pop_heap(RandomAccessIterator first, RandomAccessIterator last);
1675
1676template <class RandomAccessIterator, class Compare>
Arthur O'Dwyer5386aa22020-12-17 05:26:181677 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161678 pop_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1679
1680template <class RandomAccessIterator>
Arthur O'Dwyer5386aa22020-12-17 05:26:181681 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161682 make_heap(RandomAccessIterator first, RandomAccessIterator last);
1683
1684template <class RandomAccessIterator, class Compare>
Arthur O'Dwyer5386aa22020-12-17 05:26:181685 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161686 make_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1687
1688template <class RandomAccessIterator>
Arthur O'Dwyer5386aa22020-12-17 05:26:181689 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161690 sort_heap(RandomAccessIterator first, RandomAccessIterator last);
1691
1692template <class RandomAccessIterator, class Compare>
Arthur O'Dwyer5386aa22020-12-17 05:26:181693 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161694 sort_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1695
Howard Hinnantb3371f62010-08-22 00:02:431696template <class RandomAccessIterator>
Marshall Clow49c76432018-01-15 16:16:321697 constexpr bool // constexpr in C++20
Howard Hinnantb3371f62010-08-22 00:02:431698 is_heap(RandomAccessIterator first, RandomAccessiterator last);
Howard Hinnant3e519522010-05-11 19:42:161699
Howard Hinnantb3371f62010-08-22 00:02:431700template <class RandomAccessIterator, class Compare>
Marshall Clow49c76432018-01-15 16:16:321701 constexpr bool // constexpr in C++20
Howard Hinnantb3371f62010-08-22 00:02:431702 is_heap(RandomAccessIterator first, RandomAccessiterator last, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161703
Howard Hinnantb3371f62010-08-22 00:02:431704template <class RandomAccessIterator>
Marshall Clow49c76432018-01-15 16:16:321705 constexpr RandomAccessIterator // constexpr in C++20
Howard Hinnantb3371f62010-08-22 00:02:431706 is_heap_until(RandomAccessIterator first, RandomAccessiterator last);
Howard Hinnant3e519522010-05-11 19:42:161707
Howard Hinnantb3371f62010-08-22 00:02:431708template <class RandomAccessIterator, class Compare>
Marshall Clow49c76432018-01-15 16:16:321709 constexpr RandomAccessIterator // constexpr in C++20
Howard Hinnantb3371f62010-08-22 00:02:431710 is_heap_until(RandomAccessIterator first, RandomAccessiterator last, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161711
Howard Hinnant4eb27b72010-08-21 20:10:011712template <class ForwardIterator>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181713 constexpr ForwardIterator // constexpr in C++14
1714 min_element(ForwardIterator first, ForwardIterator last);
Howard Hinnant4eb27b72010-08-21 20:10:011715
1716template <class ForwardIterator, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181717 constexpr ForwardIterator // constexpr in C++14
1718 min_element(ForwardIterator first, ForwardIterator last, Compare comp);
Howard Hinnant4eb27b72010-08-21 20:10:011719
Howard Hinnant3e519522010-05-11 19:42:161720template <class T>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181721 constexpr const T& // constexpr in C++14
1722 min(const T& a, const T& b);
Howard Hinnant3e519522010-05-11 19:42:161723
1724template <class T, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181725 constexpr const T& // constexpr in C++14
1726 min(const T& a, const T& b, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161727
Howard Hinnant4eb27b72010-08-21 20:10:011728template<class T>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181729 constexpr T // constexpr in C++14
1730 min(initializer_list<T> t);
Howard Hinnant4eb27b72010-08-21 20:10:011731
1732template<class T, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181733 constexpr T // constexpr in C++14
1734 min(initializer_list<T> t, Compare comp);
Howard Hinnant4eb27b72010-08-21 20:10:011735
Marshall Clow146c14a2016-03-07 22:43:491736template<class T>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181737 constexpr const T& clamp(const T& v, const T& lo, const T& hi); // C++17
Marshall Clow146c14a2016-03-07 22:43:491738
1739template<class T, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181740 constexpr const T& clamp(const T& v, const T& lo, const T& hi, Compare comp); // C++17
Marshall Clow146c14a2016-03-07 22:43:491741
Howard Hinnant4eb27b72010-08-21 20:10:011742template <class ForwardIterator>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181743 constexpr ForwardIterator // constexpr in C++14
1744 max_element(ForwardIterator first, ForwardIterator last);
Howard Hinnant4eb27b72010-08-21 20:10:011745
1746template <class ForwardIterator, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181747 constexpr ForwardIterator // constexpr in C++14
1748 max_element(ForwardIterator first, ForwardIterator last, Compare comp);
Howard Hinnant4eb27b72010-08-21 20:10:011749
Howard Hinnant3e519522010-05-11 19:42:161750template <class T>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181751 constexpr const T& // constexpr in C++14
1752 max(const T& a, const T& b);
Howard Hinnant3e519522010-05-11 19:42:161753
1754template <class T, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181755 constexpr const T& // constexpr in C++14
1756 max(const T& a, const T& b, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161757
Howard Hinnant4eb27b72010-08-21 20:10:011758template<class T>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181759 constexpr T // constexpr in C++14
1760 max(initializer_list<T> t);
Howard Hinnant3e519522010-05-11 19:42:161761
Howard Hinnant4eb27b72010-08-21 20:10:011762template<class T, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181763 constexpr T // constexpr in C++14
1764 max(initializer_list<T> t, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161765
Howard Hinnant4eb27b72010-08-21 20:10:011766template<class ForwardIterator>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181767 constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++14
1768 minmax_element(ForwardIterator first, ForwardIterator last);
Howard Hinnant3e519522010-05-11 19:42:161769
Howard Hinnant4eb27b72010-08-21 20:10:011770template<class ForwardIterator, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181771 constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++14
1772 minmax_element(ForwardIterator first, ForwardIterator last, Compare comp);
Howard Hinnant4eb27b72010-08-21 20:10:011773
1774template<class T>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181775 constexpr pair<const T&, const T&> // constexpr in C++14
1776 minmax(const T& a, const T& b);
Howard Hinnant4eb27b72010-08-21 20:10:011777
1778template<class T, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181779 constexpr pair<const T&, const T&> // constexpr in C++14
1780 minmax(const T& a, const T& b, Compare comp);
Howard Hinnant4eb27b72010-08-21 20:10:011781
1782template<class T>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181783 constexpr pair<T, T> // constexpr in C++14
1784 minmax(initializer_list<T> t);
Howard Hinnant4eb27b72010-08-21 20:10:011785
1786template<class T, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181787 constexpr pair<T, T> // constexpr in C++14
1788 minmax(initializer_list<T> t, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161789
1790template <class InputIterator1, class InputIterator2>
Marshall Clow1b9a4ff2018-01-22 20:44:331791 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161792 lexicographical_compare(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2);
1793
1794template <class InputIterator1, class InputIterator2, class Compare>
Marshall Clow1b9a4ff2018-01-22 20:44:331795 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161796 lexicographical_compare(InputIterator1 first1, InputIterator1 last1,
1797 InputIterator2 first2, InputIterator2 last2, Compare comp);
1798
Adrian Vogelsgesang2a067572022-08-04 22:21:271799template<class InputIterator1, class InputIterator2, class Cmp>
1800 constexpr auto
1801 lexicographical_compare_three_way(InputIterator1 first1, InputIterator1 last1,
1802 InputIterator2 first2, InputIterator2 last2,
1803 Cmp comp)
1804 -> decltype(comp(*b1, *b2)); // since C++20
1805
1806template<class InputIterator1, class InputIterator2>
1807 constexpr auto
1808 lexicographical_compare_three_way(InputIterator1 first1, InputIterator1 last1,
1809 InputIterator2 first2, InputIterator2 last2); // since C++20
1810
Howard Hinnant3e519522010-05-11 19:42:161811template <class BidirectionalIterator>
Arthur O'Dwyerf851db32020-12-17 05:01:081812 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161813 next_permutation(BidirectionalIterator first, BidirectionalIterator last);
1814
1815template <class BidirectionalIterator, class Compare>
Arthur O'Dwyerf851db32020-12-17 05:01:081816 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161817 next_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp);
1818
1819template <class BidirectionalIterator>
Arthur O'Dwyerf851db32020-12-17 05:01:081820 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161821 prev_permutation(BidirectionalIterator first, BidirectionalIterator last);
1822
1823template <class BidirectionalIterator, class Compare>
Arthur O'Dwyerf851db32020-12-17 05:01:081824 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161825 prev_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161826} // std
1827
1828*/
1829
Howard Hinnant3e519522010-05-11 19:42:161830#include <__config>
Howard Hinnant5d1a7012013-08-14 18:00:201831
Louis Dionne134723e2021-06-17 15:30:111832#include <__algorithm/adjacent_find.h>
1833#include <__algorithm/all_of.h>
1834#include <__algorithm/any_of.h>
1835#include <__algorithm/binary_search.h>
Louis Dionne134723e2021-06-17 15:30:111836#include <__algorithm/copy.h>
1837#include <__algorithm/copy_backward.h>
1838#include <__algorithm/copy_if.h>
1839#include <__algorithm/copy_n.h>
1840#include <__algorithm/count.h>
1841#include <__algorithm/count_if.h>
1842#include <__algorithm/equal.h>
1843#include <__algorithm/equal_range.h>
Louis Dionne134723e2021-06-17 15:30:111844#include <__algorithm/fill.h>
Arthur O'Dwyer4d81a462022-01-07 14:45:051845#include <__algorithm/fill_n.h>
Louis Dionne134723e2021-06-17 15:30:111846#include <__algorithm/find.h>
1847#include <__algorithm/find_end.h>
1848#include <__algorithm/find_first_of.h>
1849#include <__algorithm/find_if.h>
1850#include <__algorithm/find_if_not.h>
Louis Dionne134723e2021-06-17 15:30:111851#include <__algorithm/for_each.h>
Louis Dionne134723e2021-06-17 15:30:111852#include <__algorithm/generate.h>
Arthur O'Dwyer4d81a462022-01-07 14:45:051853#include <__algorithm/generate_n.h>
Louis Dionne134723e2021-06-17 15:30:111854#include <__algorithm/includes.h>
1855#include <__algorithm/inplace_merge.h>
1856#include <__algorithm/is_heap.h>
1857#include <__algorithm/is_heap_until.h>
1858#include <__algorithm/is_partitioned.h>
1859#include <__algorithm/is_permutation.h>
1860#include <__algorithm/is_sorted.h>
1861#include <__algorithm/is_sorted_until.h>
Christopher Di Bella6adbc832021-06-05 02:47:471862#include <__algorithm/iter_swap.h>
Louis Dionne134723e2021-06-17 15:30:111863#include <__algorithm/lexicographical_compare.h>
Louis Dionne134723e2021-06-17 15:30:111864#include <__algorithm/lower_bound.h>
1865#include <__algorithm/make_heap.h>
1866#include <__algorithm/max.h>
1867#include <__algorithm/max_element.h>
1868#include <__algorithm/merge.h>
1869#include <__algorithm/min.h>
1870#include <__algorithm/min_element.h>
Louis Dionne134723e2021-06-17 15:30:111871#include <__algorithm/minmax.h>
1872#include <__algorithm/minmax_element.h>
1873#include <__algorithm/mismatch.h>
1874#include <__algorithm/move.h>
1875#include <__algorithm/move_backward.h>
1876#include <__algorithm/next_permutation.h>
1877#include <__algorithm/none_of.h>
1878#include <__algorithm/nth_element.h>
1879#include <__algorithm/partial_sort.h>
1880#include <__algorithm/partial_sort_copy.h>
1881#include <__algorithm/partition.h>
1882#include <__algorithm/partition_copy.h>
1883#include <__algorithm/partition_point.h>
1884#include <__algorithm/pop_heap.h>
1885#include <__algorithm/prev_permutation.h>
Louis Dionne134723e2021-06-17 15:30:111886#include <__algorithm/push_heap.h>
Louis Dionne134723e2021-06-17 15:30:111887#include <__algorithm/remove.h>
1888#include <__algorithm/remove_copy.h>
1889#include <__algorithm/remove_copy_if.h>
1890#include <__algorithm/remove_if.h>
1891#include <__algorithm/replace.h>
1892#include <__algorithm/replace_copy.h>
1893#include <__algorithm/replace_copy_if.h>
1894#include <__algorithm/replace_if.h>
1895#include <__algorithm/reverse.h>
1896#include <__algorithm/reverse_copy.h>
1897#include <__algorithm/rotate.h>
1898#include <__algorithm/rotate_copy.h>
Louis Dionne134723e2021-06-17 15:30:111899#include <__algorithm/search.h>
1900#include <__algorithm/search_n.h>
1901#include <__algorithm/set_difference.h>
1902#include <__algorithm/set_intersection.h>
1903#include <__algorithm/set_symmetric_difference.h>
1904#include <__algorithm/set_union.h>
Louis Dionne134723e2021-06-17 15:30:111905#include <__algorithm/shuffle.h>
Louis Dionne134723e2021-06-17 15:30:111906#include <__algorithm/sort.h>
1907#include <__algorithm/sort_heap.h>
1908#include <__algorithm/stable_partition.h>
1909#include <__algorithm/stable_sort.h>
Christopher Di Bella6adbc832021-06-05 02:47:471910#include <__algorithm/swap_ranges.h>
Louis Dionne134723e2021-06-17 15:30:111911#include <__algorithm/transform.h>
Louis Dionne134723e2021-06-17 15:30:111912#include <__algorithm/unique.h>
Arthur O'Dwyer4d81a462022-01-07 14:45:051913#include <__algorithm/unique_copy.h>
Louis Dionne134723e2021-06-17 15:30:111914#include <__algorithm/upper_bound.h>
Eric Fiselierc1bd9192014-08-10 23:53:081915
Nikolas Klauserd5c654b2024-04-14 13:52:561916#if _LIBCPP_STD_VER >= 17
1917# include <__algorithm/clamp.h>
1918# include <__algorithm/for_each_n.h>
Louis Dionnee406d5e2024-05-27 21:51:121919# include <__algorithm/pstl.h>
Nikolas Klauserd5c654b2024-04-14 13:52:561920# include <__algorithm/sample.h>
1921#endif // _LIBCPP_STD_VER >= 17
1922
1923#if _LIBCPP_STD_VER >= 20
1924# include <__algorithm/in_found_result.h>
1925# include <__algorithm/in_fun_result.h>
1926# include <__algorithm/in_in_out_result.h>
1927# include <__algorithm/in_in_result.h>
1928# include <__algorithm/in_out_out_result.h>
1929# include <__algorithm/in_out_result.h>
1930# include <__algorithm/lexicographical_compare_three_way.h>
1931# include <__algorithm/min_max_result.h>
1932# include <__algorithm/ranges_adjacent_find.h>
1933# include <__algorithm/ranges_all_of.h>
1934# include <__algorithm/ranges_any_of.h>
1935# include <__algorithm/ranges_binary_search.h>
1936# include <__algorithm/ranges_clamp.h>
1937# include <__algorithm/ranges_contains.h>
1938# include <__algorithm/ranges_copy.h>
1939# include <__algorithm/ranges_copy_backward.h>
1940# include <__algorithm/ranges_copy_if.h>
1941# include <__algorithm/ranges_copy_n.h>
1942# include <__algorithm/ranges_count.h>
1943# include <__algorithm/ranges_count_if.h>
1944# include <__algorithm/ranges_equal.h>
1945# include <__algorithm/ranges_equal_range.h>
1946# include <__algorithm/ranges_fill.h>
1947# include <__algorithm/ranges_fill_n.h>
1948# include <__algorithm/ranges_find.h>
1949# include <__algorithm/ranges_find_end.h>
1950# include <__algorithm/ranges_find_first_of.h>
1951# include <__algorithm/ranges_find_if.h>
1952# include <__algorithm/ranges_find_if_not.h>
1953# include <__algorithm/ranges_for_each.h>
1954# include <__algorithm/ranges_for_each_n.h>
1955# include <__algorithm/ranges_generate.h>
1956# include <__algorithm/ranges_generate_n.h>
1957# include <__algorithm/ranges_includes.h>
1958# include <__algorithm/ranges_inplace_merge.h>
1959# include <__algorithm/ranges_is_heap.h>
1960# include <__algorithm/ranges_is_heap_until.h>
1961# include <__algorithm/ranges_is_partitioned.h>
1962# include <__algorithm/ranges_is_permutation.h>
1963# include <__algorithm/ranges_is_sorted.h>
1964# include <__algorithm/ranges_is_sorted_until.h>
1965# include <__algorithm/ranges_lexicographical_compare.h>
1966# include <__algorithm/ranges_lower_bound.h>
1967# include <__algorithm/ranges_make_heap.h>
1968# include <__algorithm/ranges_max.h>
1969# include <__algorithm/ranges_max_element.h>
1970# include <__algorithm/ranges_merge.h>
1971# include <__algorithm/ranges_min.h>
1972# include <__algorithm/ranges_min_element.h>
1973# include <__algorithm/ranges_minmax.h>
1974# include <__algorithm/ranges_minmax_element.h>
1975# include <__algorithm/ranges_mismatch.h>
1976# include <__algorithm/ranges_move.h>
1977# include <__algorithm/ranges_move_backward.h>
1978# include <__algorithm/ranges_next_permutation.h>
1979# include <__algorithm/ranges_none_of.h>
1980# include <__algorithm/ranges_nth_element.h>
1981# include <__algorithm/ranges_partial_sort.h>
1982# include <__algorithm/ranges_partial_sort_copy.h>
1983# include <__algorithm/ranges_partition.h>
1984# include <__algorithm/ranges_partition_copy.h>
1985# include <__algorithm/ranges_partition_point.h>
1986# include <__algorithm/ranges_pop_heap.h>
1987# include <__algorithm/ranges_prev_permutation.h>
1988# include <__algorithm/ranges_push_heap.h>
1989# include <__algorithm/ranges_remove.h>
1990# include <__algorithm/ranges_remove_copy.h>
1991# include <__algorithm/ranges_remove_copy_if.h>
1992# include <__algorithm/ranges_remove_if.h>
1993# include <__algorithm/ranges_replace.h>
1994# include <__algorithm/ranges_replace_copy.h>
1995# include <__algorithm/ranges_replace_copy_if.h>
1996# include <__algorithm/ranges_replace_if.h>
1997# include <__algorithm/ranges_reverse.h>
1998# include <__algorithm/ranges_reverse_copy.h>
1999# include <__algorithm/ranges_rotate.h>
2000# include <__algorithm/ranges_rotate_copy.h>
2001# include <__algorithm/ranges_sample.h>
2002# include <__algorithm/ranges_search.h>
2003# include <__algorithm/ranges_search_n.h>
2004# include <__algorithm/ranges_set_difference.h>
2005# include <__algorithm/ranges_set_intersection.h>
2006# include <__algorithm/ranges_set_symmetric_difference.h>
2007# include <__algorithm/ranges_set_union.h>
2008# include <__algorithm/ranges_shuffle.h>
2009# include <__algorithm/ranges_sort.h>
2010# include <__algorithm/ranges_sort_heap.h>
2011# include <__algorithm/ranges_stable_partition.h>
2012# include <__algorithm/ranges_stable_sort.h>
2013# include <__algorithm/ranges_swap_ranges.h>
2014# include <__algorithm/ranges_transform.h>
2015# include <__algorithm/ranges_unique.h>
2016# include <__algorithm/ranges_unique_copy.h>
2017# include <__algorithm/ranges_upper_bound.h>
2018# include <__algorithm/shift_left.h>
2019# include <__algorithm/shift_right.h>
2020#endif
2021
2022#if _LIBCPP_STD_VER >= 23
2023# include <__algorithm/fold.h>
2024# include <__algorithm/ranges_contains_subrange.h>
2025# include <__algorithm/ranges_ends_with.h>
nicole mazzuca04760bf2024-07-19 16:42:162026# include <__algorithm/ranges_find_last.h>
Nikolas Klauserd5c654b2024-04-14 13:52:562027# include <__algorithm/ranges_starts_with.h>
2028#endif // _LIBCPP_STD_VER >= 23
2029
2030#include <version>
2031
Nikolas Klauserdb1978b2022-06-16 20:43:462032// standard-mandated includes
Nikolas Klauser473a1602022-09-22 16:05:082033
2034// [algorithm.syn]
Nikolas Klauserdb1978b2022-06-16 20:43:462035#include <initializer_list>
2036
Howard Hinnant073458b2011-10-17 20:05:102037#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
Arthur O'Dwyerfa6b9e42022-02-02 01:16:402038# pragma GCC system_header
Howard Hinnant073458b2011-10-17 20:05:102039#endif
Howard Hinnant3e519522010-05-11 19:42:162040
Nikolas Klauserd5c654b2024-04-14 13:52:562041#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER == 14
2042# include <execution>
2043#endif
2044
Mark de Wevere31c2a12022-09-02 15:53:282045#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
Nikolas Klauserd5e26772022-09-04 22:01:152046# include <atomic>
Nikolas Klauser40a20ae2023-01-08 14:26:322047# include <bit>
Nikolas Klauser89b356f2022-11-02 19:27:422048# include <concepts>
Nikolas Klauser75196f82023-01-08 15:47:532049# include <cstdlib>
varconst5629d492023-01-14 00:56:582050# include <cstring>
Mark de Wevere31c2a12022-09-02 15:53:282051# include <iterator>
Nikolas Klauserd5e26772022-09-04 22:01:152052# include <memory>
2053# include <stdexcept>
Nikolas Klausere698c592022-12-26 15:24:012054# include <type_traits>
Mark de Wevere31c2a12022-09-02 15:53:282055# include <utility>
2056#endif
2057
Louis Dionne4cd6ca12021-04-20 16:03:322058#endif // _LIBCPP_ALGORITHM