Back to home page

EIC code displayed by LXR

 
 

    


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