Warning, /include/c++/v1/__cxx03/algorithm is written in an unsupported language. File is not indexed.
0001 // -*- C++ -*-
0002 //===----------------------------------------------------------------------===//
0003 //
0004 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0005 // See https://llvm.org/LICENSE.txt for license information.
0006 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0007 //
0008 //===----------------------------------------------------------------------===//
0009
0010 #ifndef _LIBCPP___CXX03_ALGORITHM
0011 #define _LIBCPP___CXX03_ALGORITHM
0012
0013 /*
0014 algorithm synopsis
0015
0016 #include <__cxx03/initializer_list>
0017
0018 namespace std
0019 {
0020
0021 namespace ranges {
0022
0023 // [algorithms.results], algorithm result types
0024 template <class I, class F>
0025 struct in_fun_result; // since C++20
0026
0027 template <class I1, class I2>
0028 struct in_in_result; // since C++20
0029
0030 template <class I, class O>
0031 struct in_out_result; // since C++20
0032
0033 template <class I1, class I2, class O>
0034 struct in_in_out_result; // since C++20
0035
0036 template <class I, class O1, class O2>
0037 struct in_out_out_result; // since C++20
0038
0039 template <class I1, class I2>
0040 struct min_max_result; // since C++20
0041
0042 template <class I>
0043 struct in_found_result; // since C++20
0044
0045 template <class I, class T>
0046 struct in_value_result; // since C++23
0047
0048 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
0049 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> // since C++20
0050 constexpr I min_element(I first, S last, Comp comp = {}, Proj proj = {});
0051
0052 template<forward_range R, class Proj = identity,
0053 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> // since C++20
0054 constexpr borrowed_iterator_t<R> min_element(R&& r, Comp comp = {}, Proj proj = {});
0055
0056 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
0057 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
0058 constexpr I ranges::max_element(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
0059
0060 template<forward_range R, class Proj = identity,
0061 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
0062 constexpr borrowed_iterator_t<R> ranges::max_element(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
0063
0064 template<class I1, class I2>
0065 using mismatch_result = in_in_result<I1, I2>;
0066
0067 template <input_iterator I1, sentinel_for<_I1> S1, input_iterator I2, sentinel_for<_I2> S2,
0068 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
0069 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
0070 constexpr mismatch_result<_I1, _I2> // since C++20
0071 mismatch()(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {})
0072
0073 template <input_range R1, input_range R2,
0074 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
0075 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
0076 constexpr mismatch_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
0077 mismatch(R1&& r1, R2&& r2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}) // since C++20
0078
0079 requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
0080 constexpr I find(I first, S last, const T& value, Proj proj = {}); // since C++20
0081
0082 template<input_range R, class T, class Proj = identity>
0083 requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
0084 constexpr borrowed_iterator_t<R>
0085 find(R&& r, const T& value, Proj proj = {}); // since C++20
0086
0087 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
0088 indirect_unary_predicate<projected<I, Proj>> Pred>
0089 constexpr I find_if(I first, S last, Pred pred, Proj proj = {}); // since C++20
0090
0091 template<input_range R, class Proj = identity,
0092 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
0093 constexpr borrowed_iterator_t<R>
0094 find_if(R&& r, Pred pred, Proj proj = {}); // since C++20
0095
0096 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
0097 indirect_unary_predicate<projected<I, Proj>> Pred>
0098 constexpr I find_if_not(I first, S last, Pred pred, Proj proj = {}); // since C++20
0099
0100 template<input_range R, class Proj = identity,
0101 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
0102 constexpr borrowed_iterator_t<R>
0103 find_if_not(R&& r, Pred pred, Proj proj = {}); // since C++20
0104
0105 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity>
0106 requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
0107 constexpr subrange<I> find_last(I first, S last, const T& value, Proj proj = {}); // since C++23
0108
0109 template<forward_range R, class T, class Proj = identity>
0110 requires
0111 indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
0112 constexpr borrowed_subrange_t<R> find_last(R&& r, const T& value, Proj proj = {}); // since C++23
0113
0114 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
0115 indirect_unary_predicate<projected<I, Proj>> Pred>
0116 constexpr subrange<I> find_last_if(I first, S last, Pred pred, Proj proj = {}); // since C++23
0117
0118 template<forward_range R, class Proj = identity,
0119 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
0120 constexpr borrowed_subrange_t<R> find_last_if(R&& r, Pred pred, Proj proj = {}); // since C++23
0121
0122 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
0123 indirect_unary_predicate<projected<I, Proj>> Pred>
0124 constexpr subrange<I> find_last_if_not(I first, S last, Pred pred, Proj proj = {}); // since C++23
0125
0126 template<forward_range R, class Proj = identity,
0127 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
0128 constexpr borrowed_subrange_t<R> find_last_if_not(R&& r, Pred pred, Proj proj = {}); // since C++23
0129
0130 template<class T, class Proj = identity,
0131 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
0132 constexpr const T& min(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20
0133
0134 template<copyable T, class Proj = identity,
0135 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
0136 constexpr T min(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20
0137
0138 template<input_range R, class Proj = identity,
0139 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
0140 requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
0141 constexpr range_value_t<R>
0142 min(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
0143
0144 template<class T, class Proj = identity,
0145 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
0146 constexpr const T& max(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20
0147
0148 template<copyable T, class Proj = identity,
0149 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
0150 constexpr T max(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20
0151
0152 template<input_range R, class Proj = identity,
0153 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
0154 requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
0155 constexpr range_value_t<R>
0156 max(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
0157
0158 template<class I, class O>
0159 using unary_transform_result = in_out_result<I, O>; // since C++20
0160
0161 template<class I1, class I2, class O>
0162 using binary_transform_result = in_in_out_result<I1, I2, O>; // since C++20
0163
0164 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O,
0165 copy_constructible F, class Proj = identity>
0166 requires indirectly_writable<O, indirect_result_t<F&, projected<I, Proj>>>
0167 constexpr ranges::unary_transform_result<I, O>
0168 transform(I first1, S last1, O result, F op, Proj proj = {}); // since C++20
0169
0170 template<input_range R, weakly_incrementable O, copy_constructible F,
0171 class Proj = identity>
0172 requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R>, Proj>>>
0173 constexpr ranges::unary_transform_result<borrowed_iterator_t<R>, O>
0174 transform(R&& r, O result, F op, Proj proj = {}); // since C++20
0175
0176 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
0177 weakly_incrementable O, copy_constructible F, class Proj1 = identity,
0178 class Proj2 = identity>
0179 requires indirectly_writable<O, indirect_result_t<F&, projected<I1, Proj1>,
0180 projected<I2, Proj2>>>
0181 constexpr ranges::binary_transform_result<I1, I2, O>
0182 transform(I1 first1, S1 last1, I2 first2, S2 last2, O result,
0183 F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
0184
0185 template<input_range R1, input_range R2, weakly_incrementable O,
0186 copy_constructible F, class Proj1 = identity, class Proj2 = identity>
0187 requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R1>, Proj1>,
0188 projected<iterator_t<R2>, Proj2>>>
0189 constexpr ranges::binary_transform_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
0190 transform(R1&& r1, R2&& r2, O result,
0191 F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
0192
0193 template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity>
0194 requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
0195 constexpr iter_difference_t<I>
0196 count(I first, S last, const T& value, Proj proj = {}); // since C++20
0197
0198 template<input_range R, class T, class Proj = identity>
0199 requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
0200 constexpr range_difference_t<R>
0201 count(R&& r, const T& value, Proj proj = {}); // since C++20
0202
0203 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
0204 indirect_unary_predicate<projected<I, Proj>> Pred>
0205 constexpr iter_difference_t<I>
0206 count_if(I first, S last, Pred pred, Proj proj = {}); // since C++20
0207
0208 template<input_range R, class Proj = identity,
0209 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
0210 constexpr range_difference_t<R>
0211 count_if(R&& r, Pred pred, Proj proj = {}); // since C++20
0212
0213 template<class T>
0214 using minmax_result = min_max_result<T>;
0215
0216 template<class T, class Proj = identity,
0217 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
0218 constexpr ranges::minmax_result<const T&>
0219 minmax(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20
0220
0221 template<copyable T, class Proj = identity,
0222 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
0223 constexpr ranges::minmax_result<T>
0224 minmax(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20
0225
0226 template<input_range R, class Proj = identity,
0227 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
0228 requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
0229 constexpr ranges::minmax_result<range_value_t<R>>
0230 minmax(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
0231
0232 template<class I>
0233 using minmax_element_result = min_max_result<I>;
0234
0235 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
0236 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
0237 constexpr ranges::minmax_element_result<I>
0238 minmax_element(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
0239
0240 template<forward_range R, class Proj = identity,
0241 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
0242 constexpr ranges::minmax_element_result<borrowed_iterator_t<R>>
0243 minmax_element(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
0244
0245 template<forward_iterator I1, sentinel_for<I1> S1,
0246 forward_iterator I2, sentinel_for<I2> S2,
0247 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
0248 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
0249 constexpr bool contains_subrange(I1 first1, S1 last1, I2 first2, S2 last2,
0250 Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23
0251
0252 template<forward_range R1, forward_range R2,
0253 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
0254 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
0255 constexpr bool contains_subrange(R1&& r1, R2&& r2, Pred pred = {},
0256 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23
0257
0258 template<class I, class O>
0259 using copy_result = in_out_result<I, O>; // since C++20
0260
0261 template<class I, class O>
0262 using copy_n_result = in_out_result<I, O>; // since C++20
0263
0264 template<class I, class O>
0265 using copy_if_result = in_out_result<I, O>; // since C++20
0266
0267 template<class I1, class I2>
0268 using copy_backward_result = in_out_result<I1, I2>; // since C++20
0269
0270 template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity>
0271 requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
0272 constexpr bool ranges::contains(I first, S last, const T& value, Proj proj = {}); // since C++23
0273
0274 template<input_range R, class T, class Proj = identity>
0275 requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
0276 constexpr bool ranges::contains(R&& r, const T& value, Proj proj = {}); // since C++23
0277
0278 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O>
0279 requires indirectly_copyable<I, O>
0280 constexpr ranges::copy_result<I, O> ranges::copy(I first, S last, O result); // since C++20
0281
0282 template<input_range R, weakly_incrementable O>
0283 requires indirectly_copyable<iterator_t<R>, O>
0284 constexpr ranges::copy_result<borrowed_iterator_t<R>, O> ranges::copy(R&& r, O result); // since C++20
0285
0286 template<input_iterator I, weakly_incrementable O>
0287 requires indirectly_copyable<I, O>
0288 constexpr ranges::copy_n_result<I, O>
0289 ranges::copy_n(I first, iter_difference_t<I> n, O result); // since C++20
0290
0291 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Proj = identity,
0292 indirect_unary_predicate<projected<I, Proj>> Pred>
0293 requires indirectly_copyable<I, O>
0294 constexpr ranges::copy_if_result<I, O>
0295 ranges::copy_if(I first, S last, O result, Pred pred, Proj proj = {}); // since C++20
0296
0297 template<input_range R, weakly_incrementable O, class Proj = identity,
0298 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
0299 requires indirectly_copyable<iterator_t<R>, O>
0300 constexpr ranges::copy_if_result<borrowed_iterator_t<R>, O>
0301 ranges::copy_if(R&& r, O result, Pred pred, Proj proj = {}); // since C++20
0302
0303 template<bidirectional_iterator I1, sentinel_for<I1> S1, bidirectional_iterator I2>
0304 requires indirectly_copyable<I1, I2>
0305 constexpr ranges::copy_backward_result<I1, I2>
0306 ranges::copy_backward(I1 first, S1 last, I2 result); // since C++20
0307
0308 template<bidirectional_range R, bidirectional_iterator I>
0309 requires indirectly_copyable<iterator_t<R>, I>
0310 constexpr ranges::copy_backward_result<borrowed_iterator_t<R>, I>
0311 ranges::copy_backward(R&& r, I result); // since C++20
0312
0313 template<class I, class F>
0314 using for_each_result = in_fun_result<I, F>; // since C++20
0315
0316 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
0317 indirectly_unary_invocable<projected<I, Proj>> Fun>
0318 constexpr ranges::for_each_result<I, Fun>
0319 ranges::for_each(I first, S last, Fun f, Proj proj = {}); // since C++20
0320
0321 template<input_range R, class Proj = identity,
0322 indirectly_unary_invocable<projected<iterator_t<R>, Proj>> Fun>
0323 constexpr ranges::for_each_result<borrowed_iterator_t<R>, Fun>
0324 ranges::for_each(R&& r, Fun f, Proj proj = {}); // since C++20
0325
0326 template<input_iterator I, class Proj = identity,
0327 indirectly_unary_invocable<projected<I, Proj>> Fun>
0328 constexpr ranges::for_each_n_result<I, Fun>
0329 ranges::for_each_n(I first, iter_difference_t<I> n, Fun f, Proj proj = {}); // since C++20
0330
0331 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
0332 indirect_unary_predicate<projected<I, Proj>> Pred>
0333 constexpr bool ranges::is_partitioned(I first, S last, Pred pred, Proj proj = {}); // since C++20
0334
0335 template<input_range R, class Proj = identity,
0336 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
0337 constexpr bool ranges::is_partitioned(R&& r, Pred pred, Proj proj = {}); // since C++20
0338
0339 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
0340 class Proj = identity>
0341 requires sortable<I, Comp, Proj>
0342 constexpr I
0343 ranges::push_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
0344
0345 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
0346 requires sortable<iterator_t<R>, Comp, Proj>
0347 constexpr borrowed_iterator_t<R>
0348 ranges::push_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
0349
0350 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
0351 class Proj = identity>
0352 requires sortable<I, Comp, Proj>
0353 constexpr I
0354 ranges::pop_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
0355
0356 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
0357 requires sortable<iterator_t<R>, Comp, Proj>
0358 constexpr borrowed_iterator_t<R>
0359 ranges::pop_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
0360
0361 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
0362 class Proj = identity>
0363 requires sortable<I, Comp, Proj>
0364 constexpr I
0365 ranges::make_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
0366
0367 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
0368 requires sortable<iterator_t<R>, Comp, Proj>
0369 constexpr borrowed_iterator_t<R>
0370 ranges::make_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
0371
0372 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
0373 class Proj = identity>
0374 requires sortable<I, Comp, Proj>
0375 constexpr I
0376 ranges::sort_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
0377
0378 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
0379 requires sortable<iterator_t<R>, Comp, Proj>
0380 constexpr borrowed_iterator_t<R>
0381 ranges::sort_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
0382
0383 template<random_access_iterator I, sentinel_for<I> S, class Proj = identity,
0384 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
0385 constexpr bool is_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
0386
0387 template<random_access_range R, class Proj = identity,
0388 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
0389 constexpr bool is_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
0390
0391 template<random_access_iterator I, sentinel_for<I> S, class Proj = identity,
0392 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
0393 constexpr I is_heap_until(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
0394
0395 template<random_access_range R, class Proj = identity,
0396 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
0397 constexpr borrowed_iterator_t<R>
0398 is_heap_until(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
0399
0400 template<bidirectional_iterator I, sentinel_for<I> S>
0401 requires permutable<I>
0402 constexpr I ranges::reverse(I first, S last); // since C++20
0403
0404 template<bidirectional_range R>
0405 requires permutable<iterator_t<R>>
0406 constexpr borrowed_iterator_t<R> ranges::reverse(R&& r); // since C++20
0407
0408 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
0409 class Proj = identity>
0410 requires sortable<I, Comp, Proj>
0411 constexpr I
0412 ranges::sort(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
0413
0414 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
0415 requires sortable<iterator_t<R>, Comp, Proj>
0416 constexpr borrowed_iterator_t<R>
0417 ranges::sort(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
0418
0419 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
0420 class Proj = identity>
0421 requires sortable<I, Comp, Proj>
0422 I ranges::stable_sort(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
0423
0424 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
0425 requires sortable<iterator_t<R>, Comp, Proj>
0426 borrowed_iterator_t<R>
0427 ranges::stable_sort(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
0428
0429 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
0430 class Proj = identity>
0431 requires sortable<I, Comp, Proj>
0432 constexpr I
0433 ranges::partial_sort(I first, I middle, S last, Comp comp = {}, Proj proj = {}); // since C++20
0434
0435 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
0436 requires sortable<iterator_t<R>, Comp, Proj>
0437 constexpr borrowed_iterator_t<R>
0438 ranges::partial_sort(R&& r, iterator_t<R> middle, Comp comp = {}, Proj proj = {}); // since C++20
0439
0440 template<class T, output_iterator<const T&> O, sentinel_for<O> S>
0441 constexpr O ranges::fill(O first, S last, const T& value); // since C++20
0442
0443 template<class T, output_range<const T&> R>
0444 constexpr borrowed_iterator_t<R> ranges::fill(R&& r, const T& value); // since C++20
0445
0446 template<class T, output_iterator<const T&> O>
0447 constexpr O ranges::fill_n(O first, iter_difference_t<O> n, const T& value); // since C++20
0448
0449 template<input_or_output_iterator O, sentinel_for<O> S, copy_constructible F>
0450 requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>>
0451 constexpr O generate(O first, S last, F gen); // since C++20
0452
0453 template<class ExecutionPolicy, class ForwardIterator, class Generator>
0454 void generate(ExecutionPolicy&& exec,
0455 ForwardIterator first, ForwardIterator last,
0456 Generator gen); // since C++17
0457
0458 template<class R, copy_constructible F>
0459 requires invocable<F&> && output_range<R, invoke_result_t<F&>>
0460 constexpr borrowed_iterator_t<R> generate(R&& r, F gen); // since C++20
0461
0462 template<input_or_output_iterator O, copy_constructible F>
0463 requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>>
0464 constexpr O generate_n(O first, iter_difference_t<O> n, F gen); // since C++20
0465
0466 template<class ExecutionPolicy, class ForwardIterator, class Size, class Generator>
0467 ForwardIterator generate_n(ExecutionPolicy&& exec,
0468 ForwardIterator first, Size n, Generator gen); // since C++17
0469
0470 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
0471 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
0472 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
0473 constexpr bool ranges::equal(I1 first1, S1 last1, I2 first2, S2 last2,
0474 Pred pred = {},
0475 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
0476
0477 template<input_range R1, input_range R2, class Pred = ranges::equal_to,
0478 class Proj1 = identity, class Proj2 = identity>
0479 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
0480 constexpr bool ranges::equal(R1&& r1, R2&& r2, Pred pred = {},
0481 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
0482
0483 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
0484 indirect_unary_predicate<projected<I, Proj>> Pred>
0485 constexpr bool ranges::all_of(I first, S last, Pred pred, Proj proj = {}); // since C++20
0486
0487 template<input_range R, class Proj = identity,
0488 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
0489 constexpr bool ranges::all_of(R&& r, Pred pred, Proj proj = {}); // since C++20
0490
0491 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
0492 indirect_unary_predicate<projected<I, Proj>> Pred>
0493 constexpr bool ranges::any_of(I first, S last, Pred pred, Proj proj = {}); // since C++20
0494
0495 template<input_range R, class Proj = identity,
0496 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
0497 constexpr bool ranges::any_of(R&& r, Pred pred, Proj proj = {}); // since C++20
0498
0499 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
0500 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
0501 requires (forward_iterator<I1> || sized_sentinel_for<S1, I1>) &&
0502 (forward_iterator<I2> || sized_sentinel_for<S2, I2>) &&
0503 indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
0504 constexpr bool ranges::ends_with(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
0505 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23
0506
0507 template<input_range R1, input_range R2, class Pred = ranges::equal_to, class Proj1 = identity,
0508 class Proj2 = identity>
0509 requires (forward_range<R1> || sized_range<R1>) &&
0510 (forward_range<R2> || sized_range<R2>) &&
0511 indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
0512 constexpr bool ranges::ends_with(R1&& r1, R2&& r2, Pred pred = {},
0513 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23
0514
0515 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
0516 indirect_unary_predicate<projected<I, Proj>> Pred>
0517 constexpr bool ranges::none_of(I first, S last, Pred pred, Proj proj = {}); // since C++20
0518
0519 template<input_range R, class Proj = identity,
0520 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
0521 constexpr bool ranges::none_of(R&& r, Pred pred, Proj proj = {}); // since C++20
0522
0523 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
0524 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
0525 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
0526 constexpr bool ranges::starts_with(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
0527 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23
0528
0529 template<input_range R1, input_range R2, class Pred = ranges::equal_to, class Proj1 = identity,
0530 class Proj2 = identity>
0531 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
0532 constexpr bool ranges::starts_with(R1&& r1, R2&& r2, Pred pred = {},
0533 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23
0534
0535 template<input_iterator I1, sentinel_for<I1> S1,
0536 random_access_iterator I2, sentinel_for<I2> S2,
0537 class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
0538 requires indirectly_copyable<I1, I2> && sortable<I2, Comp, Proj2> &&
0539 indirect_strict_weak_order<Comp, projected<I1, Proj1>, projected<I2, Proj2>>
0540 constexpr partial_sort_copy_result<I1, I2>
0541 partial_sort_copy(I1 first, S1 last, I2 result_first, S2 result_last,
0542 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
0543
0544 template<input_range R1, random_access_range R2, class Comp = ranges::less,
0545 class Proj1 = identity, class Proj2 = identity>
0546 requires indirectly_copyable<iterator_t<R1>, iterator_t<R2>> &&
0547 sortable<iterator_t<R2>, Comp, Proj2> &&
0548 indirect_strict_weak_order<Comp, projected<iterator_t<R1>, Proj1>,
0549 projected<iterator_t<R2>, Proj2>>
0550 constexpr partial_sort_copy_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
0551 partial_sort_copy(R1&& r, R2&& result_r, Comp comp = {},
0552 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
0553
0554 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
0555 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
0556 constexpr bool ranges::is_sorted(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
0557
0558 template<forward_range R, class Proj = identity,
0559 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
0560 constexpr bool ranges::is_sorted(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
0561
0562 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
0563 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
0564 constexpr I ranges::is_sorted_until(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
0565
0566 template<forward_range R, class Proj = identity,
0567 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
0568 constexpr borrowed_iterator_t<R>
0569 ranges::is_sorted_until(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
0570
0571 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
0572 class Proj = identity>
0573 requires sortable<I, Comp, Proj>
0574 constexpr I
0575 ranges::nth_element(I first, I nth, S last, Comp comp = {}, Proj proj = {}); // since C++20
0576
0577 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
0578 requires sortable<iterator_t<R>, Comp, Proj>
0579 constexpr borrowed_iterator_t<R>
0580 ranges::nth_element(R&& r, iterator_t<R> nth, Comp comp = {}, Proj proj = {}); // since C++20
0581
0582 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
0583 indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less> // since C++20
0584 constexpr I upper_bound(I first, S last, const T& value, Comp comp = {}, Proj proj = {});
0585
0586 template<forward_range R, class T, class Proj = identity,
0587 indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
0588 ranges::less>
0589 constexpr borrowed_iterator_t<R>
0590 upper_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20
0591
0592 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
0593 indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
0594 constexpr I lower_bound(I first, S last, const T& value, Comp comp = {},
0595 Proj proj = {}); // since C++20
0596 template<forward_range R, class T, class Proj = identity,
0597 indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
0598 ranges::less>
0599 constexpr borrowed_iterator_t<R>
0600 lower_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20
0601
0602 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
0603 indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
0604 constexpr bool binary_search(I first, S last, const T& value, Comp comp = {},
0605 Proj proj = {}); // since C++20
0606
0607 template<forward_range R, class T, class Proj = identity,
0608 indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
0609 ranges::less>
0610 constexpr bool binary_search(R&& r, const T& value, Comp comp = {},
0611 Proj proj = {}); // since C++20
0612
0613 template<permutable I, sentinel_for<I> S, class Proj = identity,
0614 indirect_unary_predicate<projected<I, Proj>> Pred>
0615 constexpr subrange<I>
0616 partition(I first, S last, Pred pred, Proj proj = {}); // since C++20
0617
0618 template<forward_range R, class Proj = identity,
0619 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
0620 requires permutable<iterator_t<R>>
0621 constexpr borrowed_subrange_t<R>
0622 partition(R&& r, Pred pred, Proj proj = {}); // since C++20
0623
0624 template<bidirectional_iterator I, sentinel_for<I> S, class Proj = identity,
0625 indirect_unary_predicate<projected<I, Proj>> Pred>
0626 requires permutable<I>
0627 subrange<I> stable_partition(I first, S last, Pred pred, Proj proj = {}); // since C++20
0628
0629 template<bidirectional_range R, class Proj = identity,
0630 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
0631 requires permutable<iterator_t<R>>
0632 borrowed_subrange_t<R> stable_partition(R&& r, Pred pred, Proj proj = {}); // since C++20
0633
0634 template<input_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2,
0635 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
0636 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
0637 constexpr I1 ranges::find_first_of(I1 first1, S1 last1, I2 first2, S2 last2,
0638 Pred pred = {},
0639 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
0640
0641 template<input_range R1, forward_range R2,
0642 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
0643 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
0644 constexpr borrowed_iterator_t<R1>
0645 ranges::find_first_of(R1&& r1, R2&& r2,
0646 Pred pred = {},
0647 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
0648
0649 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
0650 indirect_binary_predicate<projected<I, Proj>,
0651 projected<I, Proj>> Pred = ranges::equal_to>
0652 constexpr I ranges::adjacent_find(I first, S last, Pred pred = {}, Proj proj = {}); // since C++20
0653
0654 template<forward_range R, class Proj = identity,
0655 indirect_binary_predicate<projected<iterator_t<R>, Proj>,
0656 projected<iterator_t<R>, Proj>> Pred = ranges::equal_to>
0657 constexpr borrowed_iterator_t<R> ranges::adjacent_find(R&& r, Pred pred = {}, Proj proj = {}); // since C++20
0658
0659 template<input_iterator I, sentinel_for<I> S, class T1, class T2, class Proj = identity>
0660 requires indirectly_writable<I, const T2&> &&
0661 indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*>
0662 constexpr I
0663 ranges::replace(I first, S last, const T1& old_value, const T2& new_value, Proj proj = {}); // since C++20
0664
0665 template<input_range R, class T1, class T2, class Proj = identity>
0666 requires indirectly_writable<iterator_t<R>, const T2&> &&
0667 indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T1*>
0668 constexpr borrowed_iterator_t<R>
0669 ranges::replace(R&& r, const T1& old_value, const T2& new_value, Proj proj = {}); // since C++20
0670
0671 template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity,
0672 indirect_unary_predicate<projected<I, Proj>> Pred>
0673 requires indirectly_writable<I, const T&>
0674 constexpr I ranges::replace_if(I first, S last, Pred pred, const T& new_value, Proj proj = {}); // since C++20
0675
0676 template<input_range R, class T, class Proj = identity,
0677 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
0678 requires indirectly_writable<iterator_t<R>, const T&>
0679 constexpr borrowed_iterator_t<R>
0680 ranges::replace_if(R&& r, Pred pred, const T& new_value, Proj proj = {}); // since C++20
0681
0682 template<class T, class Proj = identity,
0683 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
0684 constexpr const T&
0685 ranges::clamp(const T& v, const T& lo, const T& hi, Comp comp = {}, Proj proj = {}); // since C++20
0686
0687 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
0688 class Proj1 = identity, class Proj2 = identity,
0689 indirect_strict_weak_order<projected<I1, Proj1>,
0690 projected<I2, Proj2>> Comp = ranges::less>
0691 constexpr bool
0692 ranges::lexicographical_compare(I1 first1, S1 last1, I2 first2, S2 last2,
0693 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
0694
0695 template<input_range R1, input_range R2, class Proj1 = identity,
0696 class Proj2 = identity,
0697 indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>,
0698 projected<iterator_t<R2>, Proj2>> Comp = ranges::less>
0699 constexpr bool
0700 ranges::lexicographical_compare(R1&& r1, R2&& r2, Comp comp = {},
0701 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
0702
0703 template<bidirectional_iterator I1, sentinel_for<I1> S1, bidirectional_iterator I2>
0704 requires indirectly_movable<I1, I2>
0705 constexpr ranges::move_backward_result<I1, I2>
0706 ranges::move_backward(I1 first, S1 last, I2 result); // since C++20
0707
0708 template<bidirectional_range R, bidirectional_iterator I>
0709 requires indirectly_movable<iterator_t<R>, I>
0710 constexpr ranges::move_backward_result<borrowed_iterator_t<R>, I>
0711 ranges::move_backward(R&& r, I result); // since C++20
0712
0713 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O>
0714 requires indirectly_movable<I, O>
0715 constexpr ranges::move_result<I, O>
0716 ranges::move(I first, S last, O result); // since C++20
0717
0718 template<input_range R, weakly_incrementable O>
0719 requires indirectly_movable<iterator_t<R>, O>
0720 constexpr ranges::move_result<borrowed_iterator_t<R>, O>
0721 ranges::move(R&& r, O result); // since C++20
0722
0723 template<class I, class O1, class O2>
0724 using partition_copy_result = in_out_out_result<I, O1, O2>; // since C++20
0725
0726 template<input_iterator I, sentinel_for<I> S,
0727 weakly_incrementable O1, weakly_incrementable O2,
0728 class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
0729 requires indirectly_copyable<I, O1> && indirectly_copyable<I, O2>
0730 constexpr partition_copy_result<I, O1, O2>
0731 partition_copy(I first, S last, O1 out_true, O2 out_false, Pred pred,
0732 Proj proj = {}); // since C++20
0733
0734 template<input_range R, weakly_incrementable O1, weakly_incrementable O2,
0735 class Proj = identity,
0736 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
0737 requires indirectly_copyable<iterator_t<R>, O1> &&
0738 indirectly_copyable<iterator_t<R>, O2>
0739 constexpr partition_copy_result<borrowed_iterator_t<R>, O1, O2>
0740 partition_copy(R&& r, O1 out_true, O2 out_false, Pred pred, Proj proj = {}); // since C++20
0741
0742 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
0743 indirect_unary_predicate<projected<I, Proj>> Pred>
0744 constexpr I partition_point(I first, S last, Pred pred, Proj proj = {}); // since C++20
0745
0746 template<forward_range R, class Proj = identity,
0747 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
0748 constexpr borrowed_iterator_t<R>
0749 partition_point(R&& r, Pred pred, Proj proj = {}); // since C++20
0750
0751 template<class I1, class I2, class O>
0752 using merge_result = in_in_out_result<I1, I2, O>; // since C++20
0753
0754 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
0755 weakly_incrementable O, class Comp = ranges::less, class Proj1 = identity,
0756 class Proj2 = identity>
0757 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
0758 constexpr merge_result<I1, I2, O>
0759 merge(I1 first1, S1 last1, I2 first2, S2 last2, O result,
0760 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
0761
0762 template<input_range R1, input_range R2, weakly_incrementable O, class Comp = ranges::less,
0763 class Proj1 = identity, class Proj2 = identity>
0764 requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
0765 constexpr merge_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
0766 merge(R1&& r1, R2&& r2, O result,
0767 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
0768
0769 template<permutable I, sentinel_for<I> S, class T, class Proj = identity>
0770 requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
0771 constexpr subrange<I> ranges::remove(I first, S last, const T& value, Proj proj = {}); // since C++20
0772
0773 template<forward_range R, class T, class Proj = identity>
0774 requires permutable<iterator_t<R>> &&
0775 indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
0776 constexpr borrowed_subrange_t<R>
0777 ranges::remove(R&& r, const T& value, Proj proj = {}); // since C++20
0778
0779 template<permutable I, sentinel_for<I> S, class Proj = identity,
0780 indirect_unary_predicate<projected<I, Proj>> Pred>
0781 constexpr subrange<I> ranges::remove_if(I first, S last, Pred pred, Proj proj = {}); // since C++20
0782
0783 template<forward_range R, class Proj = identity,
0784 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
0785 requires permutable<iterator_t<R>>
0786 constexpr borrowed_subrange_t<R>
0787 ranges::remove_if(R&& r, Pred pred, Proj proj = {}); // since C++20
0788
0789 template<class I, class O>
0790 using set_difference_result = in_out_result<I, O>; // since C++20
0791
0792 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
0793 weakly_incrementable O, class Comp = ranges::less,
0794 class Proj1 = identity, class Proj2 = identity>
0795 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
0796 constexpr set_difference_result<I1, O>
0797 set_difference(I1 first1, S1 last1, I2 first2, S2 last2, O result,
0798 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
0799
0800 template<input_range R1, input_range R2, weakly_incrementable O,
0801 class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
0802 requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
0803 constexpr set_difference_result<borrowed_iterator_t<R1>, O>
0804 set_difference(R1&& r1, R2&& r2, O result,
0805 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
0806
0807 template<class I1, class I2, class O>
0808 using set_intersection_result = in_in_out_result<I1, I2, O>; // since C++20
0809
0810 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
0811 weakly_incrementable O, class Comp = ranges::less,
0812 class Proj1 = identity, class Proj2 = identity>
0813 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
0814 constexpr set_intersection_result<I1, I2, O>
0815 set_intersection(I1 first1, S1 last1, I2 first2, S2 last2, O result,
0816 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
0817
0818 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
0819 weakly_incrementable O, class Comp = ranges::less,
0820 class Proj1 = identity, class Proj2 = identity>
0821 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
0822 constexpr set_intersection_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
0823 set_intersection(R1&& r1, R2&& r2, O result,
0824 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
0825
0826 template <class _InIter, class _OutIter>
0827 using reverse_copy_result = in_out_result<_InIter, _OutIter>; // since C++20
0828
0829 template<bidirectional_iterator I, sentinel_for<I> S, weakly_incrementable O>
0830 requires indirectly_copyable<I, O>
0831 constexpr ranges::reverse_copy_result<I, O>
0832 ranges::reverse_copy(I first, S last, O result); // since C++20
0833
0834 template<bidirectional_range R, weakly_incrementable O>
0835 requires indirectly_copyable<iterator_t<R>, O>
0836 constexpr ranges::reverse_copy_result<borrowed_iterator_t<R>, O>
0837 ranges::reverse_copy(R&& r, O result); // since C++20
0838
0839 template<permutable I, sentinel_for<I> S>
0840 constexpr subrange<I> rotate(I first, I middle, S last); // since C++20
0841
0842 template<forward_range R>
0843 requires permutable<iterator_t<R>>
0844 constexpr borrowed_subrange_t<R> rotate(R&& r, iterator_t<R> middle); // since C++20
0845
0846 template <class _InIter, class _OutIter>
0847 using rotate_copy_result = in_out_result<_InIter, _OutIter>; // since C++20
0848
0849 template<forward_iterator I, sentinel_for<I> S, weakly_incrementable O>
0850 requires indirectly_copyable<I, O>
0851 constexpr ranges::rotate_copy_result<I, O>
0852 ranges::rotate_copy(I first, I middle, S last, O result); // since C++20
0853
0854 template<forward_range R, weakly_incrementable O>
0855 requires indirectly_copyable<iterator_t<R>, O>
0856 constexpr ranges::rotate_copy_result<borrowed_iterator_t<R>, O>
0857 ranges::rotate_copy(R&& r, iterator_t<R> middle, O result); // since C++20
0858
0859 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Gen>
0860 requires (forward_iterator<I> || random_access_iterator<O>) &&
0861 indirectly_copyable<I, O> &&
0862 uniform_random_bit_generator<remove_reference_t<Gen>>
0863 O sample(I first, S last, O out, iter_difference_t<I> n, Gen&& g); // since C++20
0864
0865 template<input_range R, weakly_incrementable O, class Gen>
0866 requires (forward_range<R> || random_access_iterator<O>) &&
0867 indirectly_copyable<iterator_t<R>, O> &&
0868 uniform_random_bit_generator<remove_reference_t<Gen>>
0869 O sample(R&& r, O out, range_difference_t<R> n, Gen&& g); // since C++20
0870
0871 template<random_access_iterator I, sentinel_for<I> S, class Gen>
0872 requires permutable<I> &&
0873 uniform_random_bit_generator<remove_reference_t<Gen>>
0874 I shuffle(I first, S last, Gen&& g); // since C++20
0875
0876 template<random_access_range R, class Gen>
0877 requires permutable<iterator_t<R>> &&
0878 uniform_random_bit_generator<remove_reference_t<Gen>>
0879 borrowed_iterator_t<R> shuffle(R&& r, Gen&& g); // since C++20
0880
0881 template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2,
0882 sentinel_for<I2> S2, class Proj1 = identity, class Proj2 = identity,
0883 indirect_equivalence_relation<projected<I1, Proj1>,
0884 projected<I2, Proj2>> Pred = ranges::equal_to>
0885 constexpr bool ranges::is_permutation(I1 first1, S1 last1, I2 first2, S2 last2,
0886 Pred pred = {},
0887 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
0888
0889 template<forward_range R1, forward_range R2,
0890 class Proj1 = identity, class Proj2 = identity,
0891 indirect_equivalence_relation<projected<iterator_t<R1>, Proj1>,
0892 projected<iterator_t<R2>, Proj2>> Pred = ranges::equal_to>
0893 constexpr bool ranges::is_permutation(R1&& r1, R2&& r2, Pred pred = {},
0894 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
0895
0896 template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2,
0897 sentinel_for<I2> S2, class Pred = ranges::equal_to,
0898 class Proj1 = identity, class Proj2 = identity>
0899 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
0900 constexpr subrange<I1>
0901 ranges::search(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
0902 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
0903
0904 template<forward_range R1, forward_range R2, class Pred = ranges::equal_to,
0905 class Proj1 = identity, class Proj2 = identity>
0906 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
0907 constexpr borrowed_subrange_t<R1>
0908 ranges::search(R1&& r1, R2&& r2, Pred pred = {},
0909 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
0910
0911 template<forward_iterator I, sentinel_for<I> S, class T,
0912 class Pred = ranges::equal_to, class Proj = identity>
0913 requires indirectly_comparable<I, const T*, Pred, Proj>
0914 constexpr subrange<I>
0915 ranges::search_n(I first, S last, iter_difference_t<I> count,
0916 const T& value, Pred pred = {}, Proj proj = {}); // since C++20
0917
0918 template<forward_range R, class T, class Pred = ranges::equal_to,
0919 class Proj = identity>
0920 requires indirectly_comparable<iterator_t<R>, const T*, Pred, Proj>
0921 constexpr borrowed_subrange_t<R>
0922 ranges::search_n(R&& r, range_difference_t<R> count,
0923 const T& value, Pred pred = {}, Proj proj = {}); // since C++20
0924
0925 template<input_iterator I, sentinel_for<I> S, class T,
0926 indirectly-binary-left-foldable<T, I> F>
0927 constexpr auto ranges::fold_left(I first, S last, T init, F f); // since C++23
0928
0929 template<input_range R, class T, indirectly-binary-left-foldable<T, iterator_t<R>> F>
0930 constexpr auto fold_left(R&& r, T init, F f); // since C++23
0931
0932 template<class I, class T>
0933 using fold_left_with_iter_result = in_value_result<I, T>; // since C++23
0934
0935 template<input_iterator I, sentinel_for<I> S, class T,
0936 indirectly-binary-left-foldable<T, I> F>
0937 constexpr see below fold_left_with_iter(I first, S last, T init, F f); // since C++23
0938
0939 template<input_range R, class T, indirectly-binary-left-foldable<T, iterator_t<R>> F>
0940 constexpr see below fold_left_with_iter(R&& r, T init, F f); // since C++23
0941
0942 template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2,
0943 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
0944 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
0945 constexpr subrange<I1>
0946 ranges::find_end(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
0947 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
0948
0949 template<forward_range R1, forward_range R2,
0950 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
0951 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
0952 constexpr borrowed_subrange_t<R1>
0953 ranges::find_end(R1&& r1, R2&& r2, Pred pred = {},
0954 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
0955
0956 template<class I1, class I2, class O>
0957 using set_symmetric_difference_result = in_in_out_result<I1, I2, O>; // since C++20
0958
0959 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
0960 weakly_incrementable O, class Comp = ranges::less,
0961 class Proj1 = identity, class Proj2 = identity>
0962 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
0963 constexpr set_symmetric_difference_result<I1, I2, O>
0964 set_symmetric_difference(I1 first1, S1 last1, I2 first2, S2 last2, O result,
0965 Comp comp = {}, Proj1 proj1 = {},
0966 Proj2 proj2 = {}); // since C++20
0967
0968 template<input_range R1, input_range R2, weakly_incrementable O,
0969 class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
0970 requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
0971 constexpr set_symmetric_difference_result<borrowed_iterator_t<R1>,
0972 borrowed_iterator_t<R2>, O>
0973 set_symmetric_difference(R1&& r1, R2&& r2, O result, Comp comp = {},
0974 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
0975
0976 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
0977 indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
0978 constexpr subrange<I>
0979 equal_range(I first, S last, const T& value, Comp comp = {}, Proj proj = {}); // since C++20
0980
0981 template<forward_range R, class T, class Proj = identity,
0982 indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
0983 ranges::less>
0984 constexpr borrowed_subrange_t<R>
0985 equal_range(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20
0986
0987 template<class I1, class I2, class O>
0988 using set_union_result = in_in_out_result<I1, I2, O>; // since C++20
0989
0990 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
0991 weakly_incrementable O, class Comp = ranges::less,
0992 class Proj1 = identity, class Proj2 = identity>
0993 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
0994 constexpr set_union_result<I1, I2, O>
0995 set_union(I1 first1, S1 last1, I2 first2, S2 last2, O result, Comp comp = {},
0996 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
0997
0998 template<input_range R1, input_range R2, weakly_incrementable O,
0999 class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
1000 requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
1001 constexpr set_union_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
1002 set_union(R1&& r1, R2&& r2, O result, Comp comp = {},
1003 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
1004
1005 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
1006 class Proj1 = identity, class Proj2 = identity,
1007 indirect_strict_weak_order<projected<I1, Proj1>, projected<I2, Proj2>> Comp =
1008 ranges::less>
1009 constexpr bool includes(I1 first1, S1 last1, I2 first2, S2 last2, Comp comp = {},
1010 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
1011
1012 template<input_range R1, input_range R2, class Proj1 = identity,
1013 class Proj2 = identity,
1014 indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>,
1015 projected<iterator_t<R2>, Proj2>> Comp = ranges::less>
1016 constexpr bool includes(R1&& r1, R2&& r2, Comp comp = {},
1017 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
1018
1019 template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
1020 class Proj = identity>
1021 requires sortable<I, Comp, Proj>
1022 I inplace_merge(I first, I middle, S last, Comp comp = {}, Proj proj = {}); // since C++20
1023
1024 template<bidirectional_range R, class Comp = ranges::less, class Proj = identity>
1025 requires sortable<iterator_t<R>, Comp, Proj>
1026 borrowed_iterator_t<R>
1027 inplace_merge(R&& r, iterator_t<R> middle, Comp comp = {},
1028 Proj proj = {}); // since C++20
1029
1030 template<permutable I, sentinel_for<I> S, class Proj = identity,
1031 indirect_equivalence_relation<projected<I, Proj>> C = ranges::equal_to>
1032 constexpr subrange<I> unique(I first, S last, C comp = {}, Proj proj = {}); // since C++20
1033
1034 template<forward_range R, class Proj = identity,
1035 indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to>
1036 requires permutable<iterator_t<R>>
1037 constexpr borrowed_subrange_t<R>
1038 unique(R&& r, C comp = {}, Proj proj = {}); // since C++20
1039
1040 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Proj = identity,
1041 indirect_equivalence_relation<projected<I, Proj>> C = ranges::equal_to>
1042 requires indirectly_copyable<I, O> &&
1043 (forward_iterator<I> ||
1044 (input_iterator<O> && same_as<iter_value_t<I>, iter_value_t<O>>) ||
1045 indirectly_copyable_storable<I, O>)
1046 constexpr unique_copy_result<I, O>
1047 unique_copy(I first, S last, O result, C comp = {}, Proj proj = {}); // since C++20
1048
1049 template<input_range R, weakly_incrementable O, class Proj = identity,
1050 indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to>
1051 requires indirectly_copyable<iterator_t<R>, O> &&
1052 (forward_iterator<iterator_t<R>> ||
1053 (input_iterator<O> && same_as<range_value_t<R>, iter_value_t<O>>) ||
1054 indirectly_copyable_storable<iterator_t<R>, O>)
1055 constexpr unique_copy_result<borrowed_iterator_t<R>, O>
1056 unique_copy(R&& r, O result, C comp = {}, Proj proj = {}); // since C++20
1057
1058 template<class I, class O>
1059 using remove_copy_result = in_out_result<I, O>; // since C++20
1060
1061 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class T,
1062 class Proj = identity>
1063 indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
1064 constexpr remove_copy_result<I, O>
1065 remove_copy(I first, S last, O result, const T& value, Proj proj = {}); // since C++20
1066
1067 template<input_range R, weakly_incrementable O, class T, class Proj = identity>
1068 requires indirectly_copyable<iterator_t<R>, O> &&
1069 indirect_binary_predicate<ranges::equal_to,
1070 projected<iterator_t<R>, Proj>, const T*>
1071 constexpr remove_copy_result<borrowed_iterator_t<R>, O>
1072 remove_copy(R&& r, O result, const T& value, Proj proj = {}); // since C++20
1073
1074 template<class I, class O>
1075 using remove_copy_if_result = in_out_result<I, O>; // since C++20
1076
1077 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O,
1078 class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
1079 requires indirectly_copyable<I, O>
1080 constexpr remove_copy_if_result<I, O>
1081 remove_copy_if(I first, S last, O result, Pred pred, Proj proj = {}); // since C++20
1082
1083 template<input_range R, weakly_incrementable O, class Proj = identity,
1084 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
1085 requires indirectly_copyable<iterator_t<R>, O>
1086 constexpr remove_copy_if_result<borrowed_iterator_t<R>, O>
1087 remove_copy_if(R&& r, O result, Pred pred, Proj proj = {}); // since C++20
1088
1089 template<class I, class O>
1090 using replace_copy_result = in_out_result<I, O>; // since C++20
1091
1092 template<input_iterator I, sentinel_for<I> S, class T1, class T2,
1093 output_iterator<const T2&> O, class Proj = identity>
1094 requires indirectly_copyable<I, O> &&
1095 indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*>
1096 constexpr replace_copy_result<I, O>
1097 replace_copy(I first, S last, O result, const T1& old_value, const T2& new_value,
1098 Proj proj = {}); // since C++20
1099
1100 template<input_range R, class T1, class T2, output_iterator<const T2&> O,
1101 class Proj = identity>
1102 requires indirectly_copyable<iterator_t<R>, O> &&
1103 indirect_binary_predicate<ranges::equal_to,
1104 projected<iterator_t<R>, Proj>, const T1*>
1105 constexpr replace_copy_result<borrowed_iterator_t<R>, O>
1106 replace_copy(R&& r, O result, const T1& old_value, const T2& new_value,
1107 Proj proj = {}); // since C++20
1108
1109 template<class I, class O>
1110 using replace_copy_if_result = in_out_result<I, O>; // since C++20
1111
1112 template<input_iterator I, sentinel_for<I> S, class T, output_iterator<const T&> O,
1113 class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
1114 requires indirectly_copyable<I, O>
1115 constexpr replace_copy_if_result<I, O>
1116 replace_copy_if(I first, S last, O result, Pred pred, const T& new_value,
1117 Proj proj = {}); // since C++20
1118
1119 template<input_range R, class T, output_iterator<const T&> O, class Proj = identity,
1120 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
1121 requires indirectly_copyable<iterator_t<R>, O>
1122 constexpr replace_copy_if_result<borrowed_iterator_t<R>, O>
1123 replace_copy_if(R&& r, O result, Pred pred, const T& new_value,
1124 Proj proj = {}); // since C++20
1125
1126 template<class I>
1127 using prev_permutation_result = in_found_result<I>; // since C++20
1128
1129 template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
1130 class Proj = identity>
1131 requires sortable<I, Comp, Proj>
1132 constexpr ranges::prev_permutation_result<I>
1133 ranges::prev_permutation(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
1134
1135 template<bidirectional_range R, class Comp = ranges::less,
1136 class Proj = identity>
1137 requires sortable<iterator_t<R>, Comp, Proj>
1138 constexpr ranges::prev_permutation_result<borrowed_iterator_t<R>>
1139 ranges::prev_permutation(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
1140
1141 template<class I>
1142 using next_permutation_result = in_found_result<I>; // since C++20
1143
1144 template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
1145 class Proj = identity>
1146 requires sortable<I, Comp, Proj>
1147 constexpr ranges::next_permutation_result<I>
1148 ranges::next_permutation(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
1149
1150 template<bidirectional_range R, class Comp = ranges::less,
1151 class Proj = identity>
1152 requires sortable<iterator_t<R>, Comp, Proj>
1153 constexpr ranges::next_permutation_result<borrowed_iterator_t<R>>
1154 ranges::next_permutation(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
1155
1156 }
1157
1158 template <class InputIterator, class Predicate>
1159 constexpr bool // constexpr in C++20
1160 all_of(InputIterator first, InputIterator last, Predicate pred);
1161
1162 template <class InputIterator, class Predicate>
1163 constexpr bool // constexpr in C++20
1164 any_of(InputIterator first, InputIterator last, Predicate pred);
1165
1166 template <class InputIterator, class Predicate>
1167 constexpr bool // constexpr in C++20
1168 none_of(InputIterator first, InputIterator last, Predicate pred);
1169
1170 template <class InputIterator, class Function>
1171 constexpr Function // constexpr in C++20
1172 for_each(InputIterator first, InputIterator last, Function f);
1173
1174 template<class InputIterator, class Size, class Function>
1175 constexpr InputIterator // constexpr in C++20
1176 for_each_n(InputIterator first, Size n, Function f); // C++17
1177
1178 template <class InputIterator, class T>
1179 constexpr InputIterator // constexpr in C++20
1180 find(InputIterator first, InputIterator last, const T& value);
1181
1182 template <class InputIterator, class Predicate>
1183 constexpr InputIterator // constexpr in C++20
1184 find_if(InputIterator first, InputIterator last, Predicate pred);
1185
1186 template<class InputIterator, class Predicate>
1187 constexpr InputIterator // constexpr in C++20
1188 find_if_not(InputIterator first, InputIterator last, Predicate pred);
1189
1190 template <class ForwardIterator1, class ForwardIterator2>
1191 constexpr ForwardIterator1 // constexpr in C++20
1192 find_end(ForwardIterator1 first1, ForwardIterator1 last1,
1193 ForwardIterator2 first2, ForwardIterator2 last2);
1194
1195 template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
1196 constexpr ForwardIterator1 // constexpr in C++20
1197 find_end(ForwardIterator1 first1, ForwardIterator1 last1,
1198 ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
1199
1200 template <class ForwardIterator1, class ForwardIterator2>
1201 constexpr ForwardIterator1 // constexpr in C++20
1202 find_first_of(ForwardIterator1 first1, ForwardIterator1 last1,
1203 ForwardIterator2 first2, ForwardIterator2 last2);
1204
1205 template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
1206 constexpr ForwardIterator1 // constexpr in C++20
1207 find_first_of(ForwardIterator1 first1, ForwardIterator1 last1,
1208 ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
1209
1210 template <class ForwardIterator>
1211 constexpr ForwardIterator // constexpr in C++20
1212 adjacent_find(ForwardIterator first, ForwardIterator last);
1213
1214 template <class ForwardIterator, class BinaryPredicate>
1215 constexpr ForwardIterator // constexpr in C++20
1216 adjacent_find(ForwardIterator first, ForwardIterator last, BinaryPredicate pred);
1217
1218 template <class InputIterator, class T>
1219 constexpr typename iterator_traits<InputIterator>::difference_type // constexpr in C++20
1220 count(InputIterator first, InputIterator last, const T& value);
1221
1222 template <class InputIterator, class Predicate>
1223 constexpr typename iterator_traits<InputIterator>::difference_type // constexpr in C++20
1224 count_if(InputIterator first, InputIterator last, Predicate pred);
1225
1226 template <class InputIterator1, class InputIterator2>
1227 constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20
1228 mismatch(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2);
1229
1230 template <class InputIterator1, class InputIterator2>
1231 constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20
1232 mismatch(InputIterator1 first1, InputIterator1 last1,
1233 InputIterator2 first2, InputIterator2 last2); // **C++14**
1234
1235 template <class InputIterator1, class InputIterator2, class BinaryPredicate>
1236 constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20
1237 mismatch(InputIterator1 first1, InputIterator1 last1,
1238 InputIterator2 first2, BinaryPredicate pred);
1239
1240 template <class InputIterator1, class InputIterator2, class BinaryPredicate>
1241 constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20
1242 mismatch(InputIterator1 first1, InputIterator1 last1,
1243 InputIterator2 first2, InputIterator2 last2,
1244 BinaryPredicate pred); // **C++14**
1245
1246 template <class InputIterator1, class InputIterator2>
1247 constexpr bool // constexpr in C++20
1248 equal(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2);
1249
1250 template <class InputIterator1, class InputIterator2>
1251 constexpr bool // constexpr in C++20
1252 equal(InputIterator1 first1, InputIterator1 last1,
1253 InputIterator2 first2, InputIterator2 last2); // **C++14**
1254
1255 template <class InputIterator1, class InputIterator2, class BinaryPredicate>
1256 constexpr bool // constexpr in C++20
1257 equal(InputIterator1 first1, InputIterator1 last1,
1258 InputIterator2 first2, BinaryPredicate pred);
1259
1260 template <class InputIterator1, class InputIterator2, class BinaryPredicate>
1261 constexpr bool // constexpr in C++20
1262 equal(InputIterator1 first1, InputIterator1 last1,
1263 InputIterator2 first2, InputIterator2 last2,
1264 BinaryPredicate pred); // **C++14**
1265
1266 template<class ForwardIterator1, class ForwardIterator2>
1267 constexpr bool // constexpr in C++20
1268 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
1269 ForwardIterator2 first2);
1270
1271 template<class ForwardIterator1, class ForwardIterator2>
1272 constexpr bool // constexpr in C++20
1273 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
1274 ForwardIterator2 first2, ForwardIterator2 last2); // **C++14**
1275
1276 template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
1277 constexpr bool // constexpr in C++20
1278 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
1279 ForwardIterator2 first2, BinaryPredicate pred);
1280
1281 template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
1282 constexpr bool // constexpr in C++20
1283 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
1284 ForwardIterator2 first2, ForwardIterator2 last2,
1285 BinaryPredicate pred); // **C++14**
1286
1287 template <class ForwardIterator1, class ForwardIterator2>
1288 constexpr ForwardIterator1 // constexpr in C++20
1289 search(ForwardIterator1 first1, ForwardIterator1 last1,
1290 ForwardIterator2 first2, ForwardIterator2 last2);
1291
1292 template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
1293 constexpr ForwardIterator1 // constexpr in C++20
1294 search(ForwardIterator1 first1, ForwardIterator1 last1,
1295 ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
1296
1297 template <class ForwardIterator, class Size, class T>
1298 constexpr ForwardIterator // constexpr in C++20
1299 search_n(ForwardIterator first, ForwardIterator last, Size count, const T& value);
1300
1301 template <class ForwardIterator, class Size, class T, class BinaryPredicate>
1302 constexpr ForwardIterator // constexpr in C++20
1303 search_n(ForwardIterator first, ForwardIterator last,
1304 Size count, const T& value, BinaryPredicate pred);
1305
1306 template <class InputIterator, class OutputIterator>
1307 constexpr OutputIterator // constexpr in C++20
1308 copy(InputIterator first, InputIterator last, OutputIterator result);
1309
1310 template<class InputIterator, class OutputIterator, class Predicate>
1311 constexpr OutputIterator // constexpr in C++20
1312 copy_if(InputIterator first, InputIterator last,
1313 OutputIterator result, Predicate pred);
1314
1315 template<class InputIterator, class Size, class OutputIterator>
1316 constexpr OutputIterator // constexpr in C++20
1317 copy_n(InputIterator first, Size n, OutputIterator result);
1318
1319 template <class BidirectionalIterator1, class BidirectionalIterator2>
1320 constexpr BidirectionalIterator2 // constexpr in C++20
1321 copy_backward(BidirectionalIterator1 first, BidirectionalIterator1 last,
1322 BidirectionalIterator2 result);
1323
1324 // [alg.move], move
1325 template<class InputIterator, class OutputIterator>
1326 constexpr OutputIterator move(InputIterator first, InputIterator last,
1327 OutputIterator result);
1328
1329 template<class BidirectionalIterator1, class BidirectionalIterator2>
1330 constexpr BidirectionalIterator2
1331 move_backward(BidirectionalIterator1 first, BidirectionalIterator1 last,
1332 BidirectionalIterator2 result);
1333
1334 template <class ForwardIterator1, class ForwardIterator2>
1335 constexpr ForwardIterator2 // constexpr in C++20
1336 swap_ranges(ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2);
1337
1338 namespace ranges {
1339 template<class I1, class I2>
1340 using swap_ranges_result = in_in_result<I1, I2>;
1341
1342 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2>
1343 requires indirectly_swappable<I1, I2>
1344 constexpr ranges::swap_ranges_result<I1, I2>
1345 swap_ranges(I1 first1, S1 last1, I2 first2, S2 last2);
1346
1347 template<input_range R1, input_range R2>
1348 requires indirectly_swappable<iterator_t<R1>, iterator_t<R2>>
1349 constexpr ranges::swap_ranges_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
1350 swap_ranges(R1&& r1, R2&& r2);
1351 }
1352
1353 template <class ForwardIterator1, class ForwardIterator2>
1354 constexpr void // constexpr in C++20
1355 iter_swap(ForwardIterator1 a, ForwardIterator2 b);
1356
1357 template <class InputIterator, class OutputIterator, class UnaryOperation>
1358 constexpr OutputIterator // constexpr in C++20
1359 transform(InputIterator first, InputIterator last, OutputIterator result, UnaryOperation op);
1360
1361 template <class InputIterator1, class InputIterator2, class OutputIterator, class BinaryOperation>
1362 constexpr OutputIterator // constexpr in C++20
1363 transform(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2,
1364 OutputIterator result, BinaryOperation binary_op);
1365
1366 template <class ForwardIterator, class T>
1367 constexpr void // constexpr in C++20
1368 replace(ForwardIterator first, ForwardIterator last, const T& old_value, const T& new_value);
1369
1370 template <class ForwardIterator, class Predicate, class T>
1371 constexpr void // constexpr in C++20
1372 replace_if(ForwardIterator first, ForwardIterator last, Predicate pred, const T& new_value);
1373
1374 template <class InputIterator, class OutputIterator, class T>
1375 constexpr OutputIterator // constexpr in C++20
1376 replace_copy(InputIterator first, InputIterator last, OutputIterator result,
1377 const T& old_value, const T& new_value);
1378
1379 template <class InputIterator, class OutputIterator, class Predicate, class T>
1380 constexpr OutputIterator // constexpr in C++20
1381 replace_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred, const T& new_value);
1382
1383 template <class ForwardIterator, class T>
1384 constexpr void // constexpr in C++20
1385 fill(ForwardIterator first, ForwardIterator last, const T& value);
1386
1387 template <class OutputIterator, class Size, class T>
1388 constexpr OutputIterator // constexpr in C++20
1389 fill_n(OutputIterator first, Size n, const T& value);
1390
1391 template <class ForwardIterator, class Generator>
1392 constexpr void // constexpr in C++20
1393 generate(ForwardIterator first, ForwardIterator last, Generator gen);
1394
1395 template <class OutputIterator, class Size, class Generator>
1396 constexpr OutputIterator // constexpr in C++20
1397 generate_n(OutputIterator first, Size n, Generator gen);
1398
1399 template <class ForwardIterator, class T>
1400 constexpr ForwardIterator // constexpr in C++20
1401 remove(ForwardIterator first, ForwardIterator last, const T& value);
1402
1403 template <class ForwardIterator, class Predicate>
1404 constexpr ForwardIterator // constexpr in C++20
1405 remove_if(ForwardIterator first, ForwardIterator last, Predicate pred);
1406
1407 template <class InputIterator, class OutputIterator, class T>
1408 constexpr OutputIterator // constexpr in C++20
1409 remove_copy(InputIterator first, InputIterator last, OutputIterator result, const T& value);
1410
1411 template <class InputIterator, class OutputIterator, class Predicate>
1412 constexpr OutputIterator // constexpr in C++20
1413 remove_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred);
1414
1415 template <class ForwardIterator>
1416 constexpr ForwardIterator // constexpr in C++20
1417 unique(ForwardIterator first, ForwardIterator last);
1418
1419 template <class ForwardIterator, class BinaryPredicate>
1420 constexpr ForwardIterator // constexpr in C++20
1421 unique(ForwardIterator first, ForwardIterator last, BinaryPredicate pred);
1422
1423 template <class InputIterator, class OutputIterator>
1424 constexpr OutputIterator // constexpr in C++20
1425 unique_copy(InputIterator first, InputIterator last, OutputIterator result);
1426
1427 template <class InputIterator, class OutputIterator, class BinaryPredicate>
1428 constexpr OutputIterator // constexpr in C++20
1429 unique_copy(InputIterator first, InputIterator last, OutputIterator result, BinaryPredicate pred);
1430
1431 template <class BidirectionalIterator>
1432 constexpr void // constexpr in C++20
1433 reverse(BidirectionalIterator first, BidirectionalIterator last);
1434
1435 template <class BidirectionalIterator, class OutputIterator>
1436 constexpr OutputIterator // constexpr in C++20
1437 reverse_copy(BidirectionalIterator first, BidirectionalIterator last, OutputIterator result);
1438
1439 template <class ForwardIterator>
1440 constexpr ForwardIterator // constexpr in C++20
1441 rotate(ForwardIterator first, ForwardIterator middle, ForwardIterator last);
1442
1443 template <class ForwardIterator, class OutputIterator>
1444 constexpr OutputIterator // constexpr in C++20
1445 rotate_copy(ForwardIterator first, ForwardIterator middle, ForwardIterator last, OutputIterator result);
1446
1447 template <class RandomAccessIterator>
1448 void
1449 random_shuffle(RandomAccessIterator first, RandomAccessIterator last); // deprecated in C++14, removed in C++17
1450
1451 template <class RandomAccessIterator, class RandomNumberGenerator>
1452 void
1453 random_shuffle(RandomAccessIterator first, RandomAccessIterator last,
1454 RandomNumberGenerator& rand); // deprecated in C++14, removed in C++17
1455
1456 template<class PopulationIterator, class SampleIterator,
1457 class Distance, class UniformRandomBitGenerator>
1458 SampleIterator sample(PopulationIterator first, PopulationIterator last,
1459 SampleIterator out, Distance n,
1460 UniformRandomBitGenerator&& g); // C++17
1461
1462 template<class RandomAccessIterator, class UniformRandomNumberGenerator>
1463 void shuffle(RandomAccessIterator first, RandomAccessIterator last,
1464 UniformRandomNumberGenerator&& g);
1465
1466 template<class ForwardIterator>
1467 constexpr ForwardIterator
1468 shift_left(ForwardIterator first, ForwardIterator last,
1469 typename iterator_traits<ForwardIterator>::difference_type n); // C++20
1470
1471 template<class ForwardIterator>
1472 constexpr ForwardIterator
1473 shift_right(ForwardIterator first, ForwardIterator last,
1474 typename iterator_traits<ForwardIterator>::difference_type n); // C++20
1475
1476 template <class InputIterator, class Predicate>
1477 constexpr bool // constexpr in C++20
1478 is_partitioned(InputIterator first, InputIterator last, Predicate pred);
1479
1480 template <class ForwardIterator, class Predicate>
1481 constexpr ForwardIterator // constexpr in C++20
1482 partition(ForwardIterator first, ForwardIterator last, Predicate pred);
1483
1484 template <class InputIterator, class OutputIterator1,
1485 class OutputIterator2, class Predicate>
1486 constexpr pair<OutputIterator1, OutputIterator2> // constexpr in C++20
1487 partition_copy(InputIterator first, InputIterator last,
1488 OutputIterator1 out_true, OutputIterator2 out_false,
1489 Predicate pred);
1490
1491 template <class ForwardIterator, class Predicate>
1492 ForwardIterator
1493 stable_partition(ForwardIterator first, ForwardIterator last, Predicate pred);
1494
1495 template<class ForwardIterator, class Predicate>
1496 constexpr ForwardIterator // constexpr in C++20
1497 partition_point(ForwardIterator first, ForwardIterator last, Predicate pred);
1498
1499 template <class ForwardIterator>
1500 constexpr bool // constexpr in C++20
1501 is_sorted(ForwardIterator first, ForwardIterator last);
1502
1503 template <class ForwardIterator, class Compare>
1504 constexpr bool // constexpr in C++20
1505 is_sorted(ForwardIterator first, ForwardIterator last, Compare comp);
1506
1507 template<class ForwardIterator>
1508 constexpr ForwardIterator // constexpr in C++20
1509 is_sorted_until(ForwardIterator first, ForwardIterator last);
1510
1511 template <class ForwardIterator, class Compare>
1512 constexpr ForwardIterator // constexpr in C++20
1513 is_sorted_until(ForwardIterator first, ForwardIterator last, Compare comp);
1514
1515 template <class RandomAccessIterator>
1516 constexpr void // constexpr in C++20
1517 sort(RandomAccessIterator first, RandomAccessIterator last);
1518
1519 template <class RandomAccessIterator, class Compare>
1520 constexpr void // constexpr in C++20
1521 sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1522
1523 template <class RandomAccessIterator>
1524 void
1525 stable_sort(RandomAccessIterator first, RandomAccessIterator last);
1526
1527 template <class RandomAccessIterator, class Compare>
1528 void
1529 stable_sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1530
1531 template <class RandomAccessIterator>
1532 constexpr void // constexpr in C++20
1533 partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last);
1534
1535 template <class RandomAccessIterator, class Compare>
1536 constexpr void // constexpr in C++20
1537 partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last, Compare comp);
1538
1539 template <class InputIterator, class RandomAccessIterator>
1540 constexpr RandomAccessIterator // constexpr in C++20
1541 partial_sort_copy(InputIterator first, InputIterator last,
1542 RandomAccessIterator result_first, RandomAccessIterator result_last);
1543
1544 template <class InputIterator, class RandomAccessIterator, class Compare>
1545 constexpr RandomAccessIterator // constexpr in C++20
1546 partial_sort_copy(InputIterator first, InputIterator last,
1547 RandomAccessIterator result_first, RandomAccessIterator result_last, Compare comp);
1548
1549 template <class RandomAccessIterator>
1550 constexpr void // constexpr in C++20
1551 nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last);
1552
1553 template <class RandomAccessIterator, class Compare>
1554 constexpr void // constexpr in C++20
1555 nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last, Compare comp);
1556
1557 template <class ForwardIterator, class T>
1558 constexpr ForwardIterator // constexpr in C++20
1559 lower_bound(ForwardIterator first, ForwardIterator last, const T& value);
1560
1561 template <class ForwardIterator, class T, class Compare>
1562 constexpr ForwardIterator // constexpr in C++20
1563 lower_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
1564
1565 template <class ForwardIterator, class T>
1566 constexpr ForwardIterator // constexpr in C++20
1567 upper_bound(ForwardIterator first, ForwardIterator last, const T& value);
1568
1569 template <class ForwardIterator, class T, class Compare>
1570 constexpr ForwardIterator // constexpr in C++20
1571 upper_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
1572
1573 template <class ForwardIterator, class T>
1574 constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++20
1575 equal_range(ForwardIterator first, ForwardIterator last, const T& value);
1576
1577 template <class ForwardIterator, class T, class Compare>
1578 constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++20
1579 equal_range(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
1580
1581 template <class ForwardIterator, class T>
1582 constexpr bool // constexpr in C++20
1583 binary_search(ForwardIterator first, ForwardIterator last, const T& value);
1584
1585 template <class ForwardIterator, class T, class Compare>
1586 constexpr bool // constexpr in C++20
1587 binary_search(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
1588
1589 template <class InputIterator1, class InputIterator2, class OutputIterator>
1590 constexpr OutputIterator // constexpr in C++20
1591 merge(InputIterator1 first1, InputIterator1 last1,
1592 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1593
1594 template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
1595 constexpr OutputIterator // constexpr in C++20
1596 merge(InputIterator1 first1, InputIterator1 last1,
1597 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1598
1599 template <class BidirectionalIterator>
1600 void
1601 inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last);
1602
1603 template <class BidirectionalIterator, class Compare>
1604 void
1605 inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last, Compare comp);
1606
1607 template <class InputIterator1, class InputIterator2>
1608 constexpr bool // constexpr in C++20
1609 includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2);
1610
1611 template <class InputIterator1, class InputIterator2, class Compare>
1612 constexpr bool // constexpr in C++20
1613 includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, Compare comp);
1614
1615 template <class InputIterator1, class InputIterator2, class OutputIterator>
1616 constexpr OutputIterator // constexpr in C++20
1617 set_union(InputIterator1 first1, InputIterator1 last1,
1618 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1619
1620 template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
1621 constexpr OutputIterator // constexpr in C++20
1622 set_union(InputIterator1 first1, InputIterator1 last1,
1623 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1624
1625 template <class InputIterator1, class InputIterator2, class OutputIterator>
1626 constexpr OutputIterator // constexpr in C++20
1627 set_intersection(InputIterator1 first1, InputIterator1 last1,
1628 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1629
1630 template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
1631 constexpr OutputIterator // constexpr in C++20
1632 set_intersection(InputIterator1 first1, InputIterator1 last1,
1633 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1634
1635 template <class InputIterator1, class InputIterator2, class OutputIterator>
1636 constexpr OutputIterator // constexpr in C++20
1637 set_difference(InputIterator1 first1, InputIterator1 last1,
1638 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1639
1640 template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
1641 constexpr OutputIterator // constexpr in C++20
1642 set_difference(InputIterator1 first1, InputIterator1 last1,
1643 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1644
1645 template <class InputIterator1, class InputIterator2, class OutputIterator>
1646 constexpr OutputIterator // constexpr in C++20
1647 set_symmetric_difference(InputIterator1 first1, InputIterator1 last1,
1648 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1649
1650 template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
1651 constexpr OutputIterator // constexpr in C++20
1652 set_symmetric_difference(InputIterator1 first1, InputIterator1 last1,
1653 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1654
1655 template <class RandomAccessIterator>
1656 constexpr void // constexpr in C++20
1657 push_heap(RandomAccessIterator first, RandomAccessIterator last);
1658
1659 template <class RandomAccessIterator, class Compare>
1660 constexpr void // constexpr in C++20
1661 push_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1662
1663 template <class RandomAccessIterator>
1664 constexpr void // constexpr in C++20
1665 pop_heap(RandomAccessIterator first, RandomAccessIterator last);
1666
1667 template <class RandomAccessIterator, class Compare>
1668 constexpr void // constexpr in C++20
1669 pop_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1670
1671 template <class RandomAccessIterator>
1672 constexpr void // constexpr in C++20
1673 make_heap(RandomAccessIterator first, RandomAccessIterator last);
1674
1675 template <class RandomAccessIterator, class Compare>
1676 constexpr void // constexpr in C++20
1677 make_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1678
1679 template <class RandomAccessIterator>
1680 constexpr void // constexpr in C++20
1681 sort_heap(RandomAccessIterator first, RandomAccessIterator last);
1682
1683 template <class RandomAccessIterator, class Compare>
1684 constexpr void // constexpr in C++20
1685 sort_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1686
1687 template <class RandomAccessIterator>
1688 constexpr bool // constexpr in C++20
1689 is_heap(RandomAccessIterator first, RandomAccessiterator last);
1690
1691 template <class RandomAccessIterator, class Compare>
1692 constexpr bool // constexpr in C++20
1693 is_heap(RandomAccessIterator first, RandomAccessiterator last, Compare comp);
1694
1695 template <class RandomAccessIterator>
1696 constexpr RandomAccessIterator // constexpr in C++20
1697 is_heap_until(RandomAccessIterator first, RandomAccessiterator last);
1698
1699 template <class RandomAccessIterator, class Compare>
1700 constexpr RandomAccessIterator // constexpr in C++20
1701 is_heap_until(RandomAccessIterator first, RandomAccessiterator last, Compare comp);
1702
1703 template <class ForwardIterator>
1704 constexpr ForwardIterator // constexpr in C++14
1705 min_element(ForwardIterator first, ForwardIterator last);
1706
1707 template <class ForwardIterator, class Compare>
1708 constexpr ForwardIterator // constexpr in C++14
1709 min_element(ForwardIterator first, ForwardIterator last, Compare comp);
1710
1711 template <class T>
1712 constexpr const T& // constexpr in C++14
1713 min(const T& a, const T& b);
1714
1715 template <class T, class Compare>
1716 constexpr const T& // constexpr in C++14
1717 min(const T& a, const T& b, Compare comp);
1718
1719 template<class T>
1720 constexpr T // constexpr in C++14
1721 min(initializer_list<T> t);
1722
1723 template<class T, class Compare>
1724 constexpr T // constexpr in C++14
1725 min(initializer_list<T> t, Compare comp);
1726
1727 template<class T>
1728 constexpr const T& clamp(const T& v, const T& lo, const T& hi); // C++17
1729
1730 template<class T, class Compare>
1731 constexpr const T& clamp(const T& v, const T& lo, const T& hi, Compare comp); // C++17
1732
1733 template <class ForwardIterator>
1734 constexpr ForwardIterator // constexpr in C++14
1735 max_element(ForwardIterator first, ForwardIterator last);
1736
1737 template <class ForwardIterator, class Compare>
1738 constexpr ForwardIterator // constexpr in C++14
1739 max_element(ForwardIterator first, ForwardIterator last, Compare comp);
1740
1741 template <class T>
1742 constexpr const T& // constexpr in C++14
1743 max(const T& a, const T& b);
1744
1745 template <class T, class Compare>
1746 constexpr const T& // constexpr in C++14
1747 max(const T& a, const T& b, Compare comp);
1748
1749 template<class T>
1750 constexpr T // constexpr in C++14
1751 max(initializer_list<T> t);
1752
1753 template<class T, class Compare>
1754 constexpr T // constexpr in C++14
1755 max(initializer_list<T> t, Compare comp);
1756
1757 template<class ForwardIterator>
1758 constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++14
1759 minmax_element(ForwardIterator first, ForwardIterator last);
1760
1761 template<class ForwardIterator, class Compare>
1762 constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++14
1763 minmax_element(ForwardIterator first, ForwardIterator last, Compare comp);
1764
1765 template<class T>
1766 constexpr pair<const T&, const T&> // constexpr in C++14
1767 minmax(const T& a, const T& b);
1768
1769 template<class T, class Compare>
1770 constexpr pair<const T&, const T&> // constexpr in C++14
1771 minmax(const T& a, const T& b, Compare comp);
1772
1773 template<class T>
1774 constexpr pair<T, T> // constexpr in C++14
1775 minmax(initializer_list<T> t);
1776
1777 template<class T, class Compare>
1778 constexpr pair<T, T> // constexpr in C++14
1779 minmax(initializer_list<T> t, Compare comp);
1780
1781 template <class InputIterator1, class InputIterator2>
1782 constexpr bool // constexpr in C++20
1783 lexicographical_compare(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2);
1784
1785 template <class InputIterator1, class InputIterator2, class Compare>
1786 constexpr bool // constexpr in C++20
1787 lexicographical_compare(InputIterator1 first1, InputIterator1 last1,
1788 InputIterator2 first2, InputIterator2 last2, Compare comp);
1789
1790 template<class InputIterator1, class InputIterator2, class Cmp>
1791 constexpr auto
1792 lexicographical_compare_three_way(InputIterator1 first1, InputIterator1 last1,
1793 InputIterator2 first2, InputIterator2 last2,
1794 Cmp comp)
1795 -> decltype(comp(*b1, *b2)); // since C++20
1796
1797 template<class InputIterator1, class InputIterator2>
1798 constexpr auto
1799 lexicographical_compare_three_way(InputIterator1 first1, InputIterator1 last1,
1800 InputIterator2 first2, InputIterator2 last2); // since C++20
1801
1802 template <class BidirectionalIterator>
1803 constexpr bool // constexpr in C++20
1804 next_permutation(BidirectionalIterator first, BidirectionalIterator last);
1805
1806 template <class BidirectionalIterator, class Compare>
1807 constexpr bool // constexpr in C++20
1808 next_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp);
1809
1810 template <class BidirectionalIterator>
1811 constexpr bool // constexpr in C++20
1812 prev_permutation(BidirectionalIterator first, BidirectionalIterator last);
1813
1814 template <class BidirectionalIterator, class Compare>
1815 constexpr bool // constexpr in C++20
1816 prev_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp);
1817 } // std
1818
1819 */
1820
1821 #include <__cxx03/__config>
1822
1823 #include <__cxx03/__algorithm/adjacent_find.h>
1824 #include <__cxx03/__algorithm/all_of.h>
1825 #include <__cxx03/__algorithm/any_of.h>
1826 #include <__cxx03/__algorithm/binary_search.h>
1827 #include <__cxx03/__algorithm/copy.h>
1828 #include <__cxx03/__algorithm/copy_backward.h>
1829 #include <__cxx03/__algorithm/copy_if.h>
1830 #include <__cxx03/__algorithm/copy_n.h>
1831 #include <__cxx03/__algorithm/count.h>
1832 #include <__cxx03/__algorithm/count_if.h>
1833 #include <__cxx03/__algorithm/equal.h>
1834 #include <__cxx03/__algorithm/equal_range.h>
1835 #include <__cxx03/__algorithm/fill.h>
1836 #include <__cxx03/__algorithm/fill_n.h>
1837 #include <__cxx03/__algorithm/find.h>
1838 #include <__cxx03/__algorithm/find_end.h>
1839 #include <__cxx03/__algorithm/find_first_of.h>
1840 #include <__cxx03/__algorithm/find_if.h>
1841 #include <__cxx03/__algorithm/find_if_not.h>
1842 #include <__cxx03/__algorithm/for_each.h>
1843 #include <__cxx03/__algorithm/generate.h>
1844 #include <__cxx03/__algorithm/generate_n.h>
1845 #include <__cxx03/__algorithm/includes.h>
1846 #include <__cxx03/__algorithm/inplace_merge.h>
1847 #include <__cxx03/__algorithm/is_heap.h>
1848 #include <__cxx03/__algorithm/is_heap_until.h>
1849 #include <__cxx03/__algorithm/is_partitioned.h>
1850 #include <__cxx03/__algorithm/is_permutation.h>
1851 #include <__cxx03/__algorithm/is_sorted.h>
1852 #include <__cxx03/__algorithm/is_sorted_until.h>
1853 #include <__cxx03/__algorithm/iter_swap.h>
1854 #include <__cxx03/__algorithm/lexicographical_compare.h>
1855 #include <__cxx03/__algorithm/lower_bound.h>
1856 #include <__cxx03/__algorithm/make_heap.h>
1857 #include <__cxx03/__algorithm/max.h>
1858 #include <__cxx03/__algorithm/max_element.h>
1859 #include <__cxx03/__algorithm/merge.h>
1860 #include <__cxx03/__algorithm/min.h>
1861 #include <__cxx03/__algorithm/min_element.h>
1862 #include <__cxx03/__algorithm/minmax.h>
1863 #include <__cxx03/__algorithm/minmax_element.h>
1864 #include <__cxx03/__algorithm/mismatch.h>
1865 #include <__cxx03/__algorithm/move.h>
1866 #include <__cxx03/__algorithm/move_backward.h>
1867 #include <__cxx03/__algorithm/next_permutation.h>
1868 #include <__cxx03/__algorithm/none_of.h>
1869 #include <__cxx03/__algorithm/nth_element.h>
1870 #include <__cxx03/__algorithm/partial_sort.h>
1871 #include <__cxx03/__algorithm/partial_sort_copy.h>
1872 #include <__cxx03/__algorithm/partition.h>
1873 #include <__cxx03/__algorithm/partition_copy.h>
1874 #include <__cxx03/__algorithm/partition_point.h>
1875 #include <__cxx03/__algorithm/pop_heap.h>
1876 #include <__cxx03/__algorithm/prev_permutation.h>
1877 #include <__cxx03/__algorithm/push_heap.h>
1878 #include <__cxx03/__algorithm/remove.h>
1879 #include <__cxx03/__algorithm/remove_copy.h>
1880 #include <__cxx03/__algorithm/remove_copy_if.h>
1881 #include <__cxx03/__algorithm/remove_if.h>
1882 #include <__cxx03/__algorithm/replace.h>
1883 #include <__cxx03/__algorithm/replace_copy.h>
1884 #include <__cxx03/__algorithm/replace_copy_if.h>
1885 #include <__cxx03/__algorithm/replace_if.h>
1886 #include <__cxx03/__algorithm/reverse.h>
1887 #include <__cxx03/__algorithm/reverse_copy.h>
1888 #include <__cxx03/__algorithm/rotate.h>
1889 #include <__cxx03/__algorithm/rotate_copy.h>
1890 #include <__cxx03/__algorithm/search.h>
1891 #include <__cxx03/__algorithm/search_n.h>
1892 #include <__cxx03/__algorithm/set_difference.h>
1893 #include <__cxx03/__algorithm/set_intersection.h>
1894 #include <__cxx03/__algorithm/set_symmetric_difference.h>
1895 #include <__cxx03/__algorithm/set_union.h>
1896 #include <__cxx03/__algorithm/shuffle.h>
1897 #include <__cxx03/__algorithm/sort.h>
1898 #include <__cxx03/__algorithm/sort_heap.h>
1899 #include <__cxx03/__algorithm/stable_partition.h>
1900 #include <__cxx03/__algorithm/stable_sort.h>
1901 #include <__cxx03/__algorithm/swap_ranges.h>
1902 #include <__cxx03/__algorithm/transform.h>
1903 #include <__cxx03/__algorithm/unique.h>
1904 #include <__cxx03/__algorithm/unique_copy.h>
1905 #include <__cxx03/__algorithm/upper_bound.h>
1906
1907 #if _LIBCPP_STD_VER >= 17
1908 # include <__cxx03/__algorithm/clamp.h>
1909 # include <__cxx03/__algorithm/for_each_n.h>
1910 # include <__cxx03/__algorithm/pstl.h>
1911 # include <__cxx03/__algorithm/sample.h>
1912 #endif // _LIBCPP_STD_VER >= 17
1913
1914 #if _LIBCPP_STD_VER >= 20
1915 # include <__cxx03/__algorithm/in_found_result.h>
1916 # include <__cxx03/__algorithm/in_fun_result.h>
1917 # include <__cxx03/__algorithm/in_in_out_result.h>
1918 # include <__cxx03/__algorithm/in_in_result.h>
1919 # include <__cxx03/__algorithm/in_out_out_result.h>
1920 # include <__cxx03/__algorithm/in_out_result.h>
1921 # include <__cxx03/__algorithm/lexicographical_compare_three_way.h>
1922 # include <__cxx03/__algorithm/min_max_result.h>
1923 # include <__cxx03/__algorithm/ranges_adjacent_find.h>
1924 # include <__cxx03/__algorithm/ranges_all_of.h>
1925 # include <__cxx03/__algorithm/ranges_any_of.h>
1926 # include <__cxx03/__algorithm/ranges_binary_search.h>
1927 # include <__cxx03/__algorithm/ranges_clamp.h>
1928 # include <__cxx03/__algorithm/ranges_contains.h>
1929 # include <__cxx03/__algorithm/ranges_copy.h>
1930 # include <__cxx03/__algorithm/ranges_copy_backward.h>
1931 # include <__cxx03/__algorithm/ranges_copy_if.h>
1932 # include <__cxx03/__algorithm/ranges_copy_n.h>
1933 # include <__cxx03/__algorithm/ranges_count.h>
1934 # include <__cxx03/__algorithm/ranges_count_if.h>
1935 # include <__cxx03/__algorithm/ranges_equal.h>
1936 # include <__cxx03/__algorithm/ranges_equal_range.h>
1937 # include <__cxx03/__algorithm/ranges_fill.h>
1938 # include <__cxx03/__algorithm/ranges_fill_n.h>
1939 # include <__cxx03/__algorithm/ranges_find.h>
1940 # include <__cxx03/__algorithm/ranges_find_end.h>
1941 # include <__cxx03/__algorithm/ranges_find_first_of.h>
1942 # include <__cxx03/__algorithm/ranges_find_if.h>
1943 # include <__cxx03/__algorithm/ranges_find_if_not.h>
1944 # include <__cxx03/__algorithm/ranges_for_each.h>
1945 # include <__cxx03/__algorithm/ranges_for_each_n.h>
1946 # include <__cxx03/__algorithm/ranges_generate.h>
1947 # include <__cxx03/__algorithm/ranges_generate_n.h>
1948 # include <__cxx03/__algorithm/ranges_includes.h>
1949 # include <__cxx03/__algorithm/ranges_inplace_merge.h>
1950 # include <__cxx03/__algorithm/ranges_is_heap.h>
1951 # include <__cxx03/__algorithm/ranges_is_heap_until.h>
1952 # include <__cxx03/__algorithm/ranges_is_partitioned.h>
1953 # include <__cxx03/__algorithm/ranges_is_permutation.h>
1954 # include <__cxx03/__algorithm/ranges_is_sorted.h>
1955 # include <__cxx03/__algorithm/ranges_is_sorted_until.h>
1956 # include <__cxx03/__algorithm/ranges_lexicographical_compare.h>
1957 # include <__cxx03/__algorithm/ranges_lower_bound.h>
1958 # include <__cxx03/__algorithm/ranges_make_heap.h>
1959 # include <__cxx03/__algorithm/ranges_max.h>
1960 # include <__cxx03/__algorithm/ranges_max_element.h>
1961 # include <__cxx03/__algorithm/ranges_merge.h>
1962 # include <__cxx03/__algorithm/ranges_min.h>
1963 # include <__cxx03/__algorithm/ranges_min_element.h>
1964 # include <__cxx03/__algorithm/ranges_minmax.h>
1965 # include <__cxx03/__algorithm/ranges_minmax_element.h>
1966 # include <__cxx03/__algorithm/ranges_mismatch.h>
1967 # include <__cxx03/__algorithm/ranges_move.h>
1968 # include <__cxx03/__algorithm/ranges_move_backward.h>
1969 # include <__cxx03/__algorithm/ranges_next_permutation.h>
1970 # include <__cxx03/__algorithm/ranges_none_of.h>
1971 # include <__cxx03/__algorithm/ranges_nth_element.h>
1972 # include <__cxx03/__algorithm/ranges_partial_sort.h>
1973 # include <__cxx03/__algorithm/ranges_partial_sort_copy.h>
1974 # include <__cxx03/__algorithm/ranges_partition.h>
1975 # include <__cxx03/__algorithm/ranges_partition_copy.h>
1976 # include <__cxx03/__algorithm/ranges_partition_point.h>
1977 # include <__cxx03/__algorithm/ranges_pop_heap.h>
1978 # include <__cxx03/__algorithm/ranges_prev_permutation.h>
1979 # include <__cxx03/__algorithm/ranges_push_heap.h>
1980 # include <__cxx03/__algorithm/ranges_remove.h>
1981 # include <__cxx03/__algorithm/ranges_remove_copy.h>
1982 # include <__cxx03/__algorithm/ranges_remove_copy_if.h>
1983 # include <__cxx03/__algorithm/ranges_remove_if.h>
1984 # include <__cxx03/__algorithm/ranges_replace.h>
1985 # include <__cxx03/__algorithm/ranges_replace_copy.h>
1986 # include <__cxx03/__algorithm/ranges_replace_copy_if.h>
1987 # include <__cxx03/__algorithm/ranges_replace_if.h>
1988 # include <__cxx03/__algorithm/ranges_reverse.h>
1989 # include <__cxx03/__algorithm/ranges_reverse_copy.h>
1990 # include <__cxx03/__algorithm/ranges_rotate.h>
1991 # include <__cxx03/__algorithm/ranges_rotate_copy.h>
1992 # include <__cxx03/__algorithm/ranges_sample.h>
1993 # include <__cxx03/__algorithm/ranges_search.h>
1994 # include <__cxx03/__algorithm/ranges_search_n.h>
1995 # include <__cxx03/__algorithm/ranges_set_difference.h>
1996 # include <__cxx03/__algorithm/ranges_set_intersection.h>
1997 # include <__cxx03/__algorithm/ranges_set_symmetric_difference.h>
1998 # include <__cxx03/__algorithm/ranges_set_union.h>
1999 # include <__cxx03/__algorithm/ranges_shuffle.h>
2000 # include <__cxx03/__algorithm/ranges_sort.h>
2001 # include <__cxx03/__algorithm/ranges_sort_heap.h>
2002 # include <__cxx03/__algorithm/ranges_stable_partition.h>
2003 # include <__cxx03/__algorithm/ranges_stable_sort.h>
2004 # include <__cxx03/__algorithm/ranges_swap_ranges.h>
2005 # include <__cxx03/__algorithm/ranges_transform.h>
2006 # include <__cxx03/__algorithm/ranges_unique.h>
2007 # include <__cxx03/__algorithm/ranges_unique_copy.h>
2008 # include <__cxx03/__algorithm/ranges_upper_bound.h>
2009 # include <__cxx03/__algorithm/shift_left.h>
2010 # include <__cxx03/__algorithm/shift_right.h>
2011 #endif
2012
2013 #if _LIBCPP_STD_VER >= 23
2014 # include <__cxx03/__algorithm/fold.h>
2015 # include <__cxx03/__algorithm/ranges_contains_subrange.h>
2016 # include <__cxx03/__algorithm/ranges_ends_with.h>
2017 # include <__cxx03/__algorithm/ranges_find_last.h>
2018 # include <__cxx03/__algorithm/ranges_starts_with.h>
2019 #endif // _LIBCPP_STD_VER >= 23
2020
2021 #include <__cxx03/version>
2022
2023 // standard-mandated includes
2024
2025 // [algorithm.syn]
2026 #include <__cxx03/initializer_list>
2027
2028 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2029 # pragma GCC system_header
2030 #endif
2031
2032 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER == 14
2033 # include <__cxx03/execution>
2034 #endif
2035
2036 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
2037 # include <__cxx03/atomic>
2038 # include <__cxx03/bit>
2039 # include <__cxx03/concepts>
2040 # include <__cxx03/cstdlib>
2041 # include <__cxx03/cstring>
2042 # include <__cxx03/iterator>
2043 # include <__cxx03/memory>
2044 # include <__cxx03/stdexcept>
2045 # include <__cxx03/type_traits>
2046 # include <__cxx03/utility>
2047 #endif
2048
2049 #endif // _LIBCPP___CXX03_ALGORITHM