10b57cec5SDimitry Andric// -*- C++ -*- 2349cc55cSDimitry Andric//===----------------------------------------------------------------------===// 30b57cec5SDimitry Andric// 40b57cec5SDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 50b57cec5SDimitry Andric// See https://llvm.org/LICENSE.txt for license information. 60b57cec5SDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 70b57cec5SDimitry Andric// 80b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 90b57cec5SDimitry Andric 100b57cec5SDimitry Andric#ifndef _LIBCPP_ALGORITHM 110b57cec5SDimitry Andric#define _LIBCPP_ALGORITHM 120b57cec5SDimitry Andric 130b57cec5SDimitry Andric/* 140b57cec5SDimitry Andric algorithm synopsis 150b57cec5SDimitry Andric 160b57cec5SDimitry Andric#include <initializer_list> 170b57cec5SDimitry Andric 180b57cec5SDimitry Andricnamespace std 190b57cec5SDimitry Andric{ 200b57cec5SDimitry Andric 2104eeddc0SDimitry Andricnamespace ranges { 2281ad6265SDimitry Andric 2381ad6265SDimitry Andric // [algorithms.results], algorithm result types 2481ad6265SDimitry Andric template <class I, class F> 2581ad6265SDimitry Andric struct in_fun_result; // since C++20 2681ad6265SDimitry Andric 2704eeddc0SDimitry Andric template <class I1, class I2> 2804eeddc0SDimitry Andric struct in_in_result; // since C++20 291fd87a68SDimitry Andric 3081ad6265SDimitry Andric template <class I, class O> 3181ad6265SDimitry Andric struct in_out_result; // since C++20 3281ad6265SDimitry Andric 331fd87a68SDimitry Andric template <class I1, class I2, class O> 341fd87a68SDimitry Andric struct in_in_out_result; // since C++20 3581ad6265SDimitry Andric 3681ad6265SDimitry Andric template <class I, class O1, class O2> 3781ad6265SDimitry Andric struct in_out_out_result; // since C++20 3881ad6265SDimitry Andric 3981ad6265SDimitry Andric template <class I1, class I2> 4081ad6265SDimitry Andric struct min_max_result; // since C++20 4181ad6265SDimitry Andric 4281ad6265SDimitry Andric template <class I> 4381ad6265SDimitry Andric struct in_found_result; // since C++20 4481ad6265SDimitry Andric 4581ad6265SDimitry Andric template<forward_iterator I, sentinel_for<I> S, class Proj = identity, 4681ad6265SDimitry Andric indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> // since C++20 4781ad6265SDimitry Andric constexpr I min_element(I first, S last, Comp comp = {}, Proj proj = {}); 4881ad6265SDimitry Andric 4981ad6265SDimitry Andric template<forward_range R, class Proj = identity, 5081ad6265SDimitry Andric indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> // since C++20 5181ad6265SDimitry Andric constexpr borrowed_iterator_t<R> min_element(R&& r, Comp comp = {}, Proj proj = {}); 5281ad6265SDimitry Andric 5381ad6265SDimitry Andric template<forward_iterator I, sentinel_for<I> S, class Proj = identity, 5481ad6265SDimitry Andric indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> 5581ad6265SDimitry Andric constexpr I ranges::max_element(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 5681ad6265SDimitry Andric 5781ad6265SDimitry Andric template<forward_range R, class Proj = identity, 5881ad6265SDimitry Andric indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> 5981ad6265SDimitry Andric constexpr borrowed_iterator_t<R> ranges::max_element(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 6081ad6265SDimitry Andric 6181ad6265SDimitry Andric template<class I1, class I2> 6281ad6265SDimitry Andric using mismatch_result = in_in_result<I1, I2>; 6381ad6265SDimitry Andric 6481ad6265SDimitry Andric template <input_iterator I1, sentinel_for<_I1> S1, input_iterator I2, sentinel_for<_I2> S2, 6581ad6265SDimitry Andric class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> 6681ad6265SDimitry Andric requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2> 6706c3fb27SDimitry Andric constexpr mismatch_result<_I1, _I2> // since C++20 6806c3fb27SDimitry Andric mismatch()(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}) 6981ad6265SDimitry Andric 7081ad6265SDimitry Andric template <input_range R1, input_range R2, 7181ad6265SDimitry Andric class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> 7281ad6265SDimitry Andric requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2> 7381ad6265SDimitry Andric constexpr mismatch_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>> 7481ad6265SDimitry Andric mismatch(R1&& r1, R2&& r2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}) // since C++20 7581ad6265SDimitry Andric 7681ad6265SDimitry Andric requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*> 7781ad6265SDimitry Andric constexpr I find(I first, S last, const T& value, Proj proj = {}); // since C++20 7881ad6265SDimitry Andric 7981ad6265SDimitry Andric template<input_range R, class T, class Proj = identity> 8081ad6265SDimitry Andric requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*> 8181ad6265SDimitry Andric constexpr borrowed_iterator_t<R> 8281ad6265SDimitry Andric find(R&& r, const T& value, Proj proj = {}); // since C++20 8381ad6265SDimitry Andric 8481ad6265SDimitry Andric template<input_iterator I, sentinel_for<I> S, class Proj = identity, 8581ad6265SDimitry Andric indirect_unary_predicate<projected<I, Proj>> Pred> 8681ad6265SDimitry Andric constexpr I find_if(I first, S last, Pred pred, Proj proj = {}); // since C++20 8781ad6265SDimitry Andric 8881ad6265SDimitry Andric template<input_range R, class Proj = identity, 8981ad6265SDimitry Andric indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> 9081ad6265SDimitry Andric constexpr borrowed_iterator_t<R> 9181ad6265SDimitry Andric find_if(R&& r, Pred pred, Proj proj = {}); // since C++20 9281ad6265SDimitry Andric 9381ad6265SDimitry Andric template<input_iterator I, sentinel_for<I> S, class Proj = identity, 9481ad6265SDimitry Andric indirect_unary_predicate<projected<I, Proj>> Pred> 9581ad6265SDimitry Andric constexpr I find_if_not(I first, S last, Pred pred, Proj proj = {}); // since C++20 9681ad6265SDimitry Andric 9781ad6265SDimitry Andric template<input_range R, class Proj = identity, 9881ad6265SDimitry Andric indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> 9981ad6265SDimitry Andric constexpr borrowed_iterator_t<R> 10081ad6265SDimitry Andric find_if_not(R&& r, Pred pred, Proj proj = {}); // since C++20 10181ad6265SDimitry Andric 10281ad6265SDimitry Andric template<class T, class Proj = identity, 10381ad6265SDimitry Andric indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less> 10481ad6265SDimitry Andric constexpr const T& min(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20 10581ad6265SDimitry Andric 10681ad6265SDimitry Andric template<copyable T, class Proj = identity, 10781ad6265SDimitry Andric indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less> 10881ad6265SDimitry Andric constexpr T min(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20 10981ad6265SDimitry Andric 11081ad6265SDimitry Andric template<input_range R, class Proj = identity, 11181ad6265SDimitry Andric indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> 11281ad6265SDimitry Andric requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*> 11381ad6265SDimitry Andric constexpr range_value_t<R> 11481ad6265SDimitry Andric min(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 11581ad6265SDimitry Andric 11681ad6265SDimitry Andric template<class T, class Proj = identity, 11781ad6265SDimitry Andric indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less> 11881ad6265SDimitry Andric constexpr const T& max(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20 11981ad6265SDimitry Andric 12081ad6265SDimitry Andric template<copyable T, class Proj = identity, 12181ad6265SDimitry Andric indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less> 12281ad6265SDimitry Andric constexpr T max(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20 12381ad6265SDimitry Andric 12481ad6265SDimitry Andric template<input_range R, class Proj = identity, 12581ad6265SDimitry Andric indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> 12681ad6265SDimitry Andric requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*> 12781ad6265SDimitry Andric constexpr range_value_t<R> 12881ad6265SDimitry Andric max(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 12981ad6265SDimitry Andric 13081ad6265SDimitry Andric template<class I, class O> 13181ad6265SDimitry Andric using unary_transform_result = in_out_result<I, O>; // since C++20 13281ad6265SDimitry Andric 13381ad6265SDimitry Andric template<class I1, class I2, class O> 13481ad6265SDimitry Andric using binary_transform_result = in_in_out_result<I1, I2, O>; // since C++20 13581ad6265SDimitry Andric 13681ad6265SDimitry Andric template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, 13781ad6265SDimitry Andric copy_constructible F, class Proj = identity> 13881ad6265SDimitry Andric requires indirectly_writable<O, indirect_result_t<F&, projected<I, Proj>>> 13981ad6265SDimitry Andric constexpr ranges::unary_transform_result<I, O> 14081ad6265SDimitry Andric transform(I first1, S last1, O result, F op, Proj proj = {}); // since C++20 14181ad6265SDimitry Andric 14281ad6265SDimitry Andric template<input_range R, weakly_incrementable O, copy_constructible F, 14381ad6265SDimitry Andric class Proj = identity> 14481ad6265SDimitry Andric requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R>, Proj>>> 14581ad6265SDimitry Andric constexpr ranges::unary_transform_result<borrowed_iterator_t<R>, O> 14681ad6265SDimitry Andric transform(R&& r, O result, F op, Proj proj = {}); // since C++20 14781ad6265SDimitry Andric 14881ad6265SDimitry Andric template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, 14981ad6265SDimitry Andric weakly_incrementable O, copy_constructible F, class Proj1 = identity, 15081ad6265SDimitry Andric class Proj2 = identity> 15181ad6265SDimitry Andric requires indirectly_writable<O, indirect_result_t<F&, projected<I1, Proj1>, 15281ad6265SDimitry Andric projected<I2, Proj2>>> 15381ad6265SDimitry Andric constexpr ranges::binary_transform_result<I1, I2, O> 15481ad6265SDimitry Andric transform(I1 first1, S1 last1, I2 first2, S2 last2, O result, 15581ad6265SDimitry Andric F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 15681ad6265SDimitry Andric 15781ad6265SDimitry Andric template<input_range R1, input_range R2, weakly_incrementable O, 15881ad6265SDimitry Andric copy_constructible F, class Proj1 = identity, class Proj2 = identity> 15981ad6265SDimitry Andric requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R1>, Proj1>, 16081ad6265SDimitry Andric projected<iterator_t<R2>, Proj2>>> 16181ad6265SDimitry Andric constexpr ranges::binary_transform_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O> 16281ad6265SDimitry Andric transform(R1&& r1, R2&& r2, O result, 16381ad6265SDimitry Andric F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 16481ad6265SDimitry Andric 16581ad6265SDimitry Andric template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity> 16681ad6265SDimitry Andric requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*> 16781ad6265SDimitry Andric constexpr iter_difference_t<I> 16881ad6265SDimitry Andric count(I first, S last, const T& value, Proj proj = {}); // since C++20 16981ad6265SDimitry Andric 17081ad6265SDimitry Andric template<input_range R, class T, class Proj = identity> 17181ad6265SDimitry Andric requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*> 17281ad6265SDimitry Andric constexpr range_difference_t<R> 17381ad6265SDimitry Andric count(R&& r, const T& value, Proj proj = {}); // since C++20 17481ad6265SDimitry Andric 17581ad6265SDimitry Andric template<input_iterator I, sentinel_for<I> S, class Proj = identity, 17681ad6265SDimitry Andric indirect_unary_predicate<projected<I, Proj>> Pred> 17781ad6265SDimitry Andric constexpr iter_difference_t<I> 17881ad6265SDimitry Andric count_if(I first, S last, Pred pred, Proj proj = {}); // since C++20 17981ad6265SDimitry Andric 18081ad6265SDimitry Andric template<input_range R, class Proj = identity, 18181ad6265SDimitry Andric indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> 18281ad6265SDimitry Andric constexpr range_difference_t<R> 18381ad6265SDimitry Andric count_if(R&& r, Pred pred, Proj proj = {}); // since C++20 18481ad6265SDimitry Andric 18581ad6265SDimitry Andric template<class T> 18681ad6265SDimitry Andric using minmax_result = min_max_result<T>; 18781ad6265SDimitry Andric 18881ad6265SDimitry Andric template<class T, class Proj = identity, 18981ad6265SDimitry Andric indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less> 19081ad6265SDimitry Andric constexpr ranges::minmax_result<const T&> 19181ad6265SDimitry Andric minmax(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20 19281ad6265SDimitry Andric 19381ad6265SDimitry Andric template<copyable T, class Proj = identity, 19481ad6265SDimitry Andric indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less> 19581ad6265SDimitry Andric constexpr ranges::minmax_result<T> 19681ad6265SDimitry Andric minmax(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20 19781ad6265SDimitry Andric 19881ad6265SDimitry Andric template<input_range R, class Proj = identity, 19981ad6265SDimitry Andric indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> 20081ad6265SDimitry Andric requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*> 20181ad6265SDimitry Andric constexpr ranges::minmax_result<range_value_t<R>> 20281ad6265SDimitry Andric minmax(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 20381ad6265SDimitry Andric 20481ad6265SDimitry Andric template<class I> 20581ad6265SDimitry Andric using minmax_element_result = min_max_result<I>; 20681ad6265SDimitry Andric 20781ad6265SDimitry Andric template<forward_iterator I, sentinel_for<I> S, class Proj = identity, 20881ad6265SDimitry Andric indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> 20981ad6265SDimitry Andric constexpr ranges::minmax_element_result<I> 21081ad6265SDimitry Andric minmax_element(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 21181ad6265SDimitry Andric 21281ad6265SDimitry Andric template<forward_range R, class Proj = identity, 21381ad6265SDimitry Andric indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> 21481ad6265SDimitry Andric constexpr ranges::minmax_element_result<borrowed_iterator_t<R>> 21581ad6265SDimitry Andric minmax_element(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 21681ad6265SDimitry Andric 21781ad6265SDimitry Andric template<class I, class O> 21881ad6265SDimitry Andric using copy_result = in_out_result<I, O>; // since C++20 21981ad6265SDimitry Andric 22081ad6265SDimitry Andric template<class I, class O> 22181ad6265SDimitry Andric using copy_n_result = in_out_result<I, O>; // since C++20 22281ad6265SDimitry Andric 22381ad6265SDimitry Andric template<class I, class O> 22481ad6265SDimitry Andric using copy_if_result = in_out_result<I, O>; // since C++20 22581ad6265SDimitry Andric 22681ad6265SDimitry Andric template<class I1, class I2> 22781ad6265SDimitry Andric using copy_backward_result = in_out_result<I1, I2>; // since C++20 22881ad6265SDimitry Andric 22981ad6265SDimitry Andric template<input_iterator I, sentinel_for<I> S, weakly_incrementable O> 23081ad6265SDimitry Andric requires indirectly_copyable<I, O> 23181ad6265SDimitry Andric constexpr ranges::copy_result<I, O> ranges::copy(I first, S last, O result); // since C++20 23281ad6265SDimitry Andric 23381ad6265SDimitry Andric template<input_range R, weakly_incrementable O> 23481ad6265SDimitry Andric requires indirectly_copyable<iterator_t<R>, O> 23581ad6265SDimitry Andric constexpr ranges::copy_result<borrowed_iterator_t<R>, O> ranges::copy(R&& r, O result); // since C++20 23681ad6265SDimitry Andric 23781ad6265SDimitry Andric template<input_iterator I, weakly_incrementable O> 23881ad6265SDimitry Andric requires indirectly_copyable<I, O> 23981ad6265SDimitry Andric constexpr ranges::copy_n_result<I, O> 24081ad6265SDimitry Andric ranges::copy_n(I first, iter_difference_t<I> n, O result); // since C++20 24181ad6265SDimitry Andric 24281ad6265SDimitry Andric template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Proj = identity, 24381ad6265SDimitry Andric indirect_unary_predicate<projected<I, Proj>> Pred> 24481ad6265SDimitry Andric requires indirectly_copyable<I, O> 24581ad6265SDimitry Andric constexpr ranges::copy_if_result<I, O> 24681ad6265SDimitry Andric ranges::copy_if(I first, S last, O result, Pred pred, Proj proj = {}); // since C++20 24781ad6265SDimitry Andric 24881ad6265SDimitry Andric template<input_range R, weakly_incrementable O, class Proj = identity, 24981ad6265SDimitry Andric indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> 25081ad6265SDimitry Andric requires indirectly_copyable<iterator_t<R>, O> 25181ad6265SDimitry Andric constexpr ranges::copy_if_result<borrowed_iterator_t<R>, O> 25281ad6265SDimitry Andric ranges::copy_if(R&& r, O result, Pred pred, Proj proj = {}); // since C++20 25381ad6265SDimitry Andric 25481ad6265SDimitry Andric template<bidirectional_iterator I1, sentinel_for<I1> S1, bidirectional_iterator I2> 25581ad6265SDimitry Andric requires indirectly_copyable<I1, I2> 25681ad6265SDimitry Andric constexpr ranges::copy_backward_result<I1, I2> 25781ad6265SDimitry Andric ranges::copy_backward(I1 first, S1 last, I2 result); // since C++20 25881ad6265SDimitry Andric 25981ad6265SDimitry Andric template<bidirectional_range R, bidirectional_iterator I> 26081ad6265SDimitry Andric requires indirectly_copyable<iterator_t<R>, I> 26181ad6265SDimitry Andric constexpr ranges::copy_backward_result<borrowed_iterator_t<R>, I> 26281ad6265SDimitry Andric ranges::copy_backward(R&& r, I result); // since C++20 26381ad6265SDimitry Andric 26481ad6265SDimitry Andric template<class I, class F> 26581ad6265SDimitry Andric using for_each_result = in_fun_result<I, F>; // since C++20 26681ad6265SDimitry Andric 26781ad6265SDimitry Andric template<input_iterator I, sentinel_for<I> S, class Proj = identity, 26881ad6265SDimitry Andric indirectly_unary_invocable<projected<I, Proj>> Fun> 26981ad6265SDimitry Andric constexpr ranges::for_each_result<I, Fun> 27081ad6265SDimitry Andric ranges::for_each(I first, S last, Fun f, Proj proj = {}); // since C++20 27181ad6265SDimitry Andric 27281ad6265SDimitry Andric template<input_range R, class Proj = identity, 27381ad6265SDimitry Andric indirectly_unary_invocable<projected<iterator_t<R>, Proj>> Fun> 27481ad6265SDimitry Andric constexpr ranges::for_each_result<borrowed_iterator_t<R>, Fun> 27581ad6265SDimitry Andric ranges::for_each(R&& r, Fun f, Proj proj = {}); // since C++20 27681ad6265SDimitry Andric 27781ad6265SDimitry Andric template<input_iterator I, class Proj = identity, 27881ad6265SDimitry Andric indirectly_unary_invocable<projected<I, Proj>> Fun> 27981ad6265SDimitry Andric constexpr ranges::for_each_n_result<I, Fun> 28081ad6265SDimitry Andric ranges::for_each_n(I first, iter_difference_t<I> n, Fun f, Proj proj = {}); // since C++20 28181ad6265SDimitry Andric 28281ad6265SDimitry Andric template<input_iterator I, sentinel_for<I> S, class Proj = identity, 28381ad6265SDimitry Andric indirect_unary_predicate<projected<I, Proj>> Pred> 28481ad6265SDimitry Andric constexpr bool ranges::is_partitioned(I first, S last, Pred pred, Proj proj = {}); // since C++20 28581ad6265SDimitry Andric 28681ad6265SDimitry Andric template<input_range R, class Proj = identity, 28781ad6265SDimitry Andric indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> 28881ad6265SDimitry Andric constexpr bool ranges::is_partitioned(R&& r, Pred pred, Proj proj = {}); // since C++20 28981ad6265SDimitry Andric 290753f127fSDimitry Andric template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less, 291753f127fSDimitry Andric class Proj = identity> 292753f127fSDimitry Andric requires sortable<I, Comp, Proj> 293753f127fSDimitry Andric constexpr I 294753f127fSDimitry Andric ranges::push_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 295753f127fSDimitry Andric 296753f127fSDimitry Andric template<random_access_range R, class Comp = ranges::less, class Proj = identity> 297753f127fSDimitry Andric requires sortable<iterator_t<R>, Comp, Proj> 298753f127fSDimitry Andric constexpr borrowed_iterator_t<R> 299753f127fSDimitry Andric ranges::push_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 300753f127fSDimitry Andric 301753f127fSDimitry Andric template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less, 302753f127fSDimitry Andric class Proj = identity> 303753f127fSDimitry Andric requires sortable<I, Comp, Proj> 304753f127fSDimitry Andric constexpr I 305753f127fSDimitry Andric ranges::pop_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 306753f127fSDimitry Andric 307753f127fSDimitry Andric template<random_access_range R, class Comp = ranges::less, class Proj = identity> 308753f127fSDimitry Andric requires sortable<iterator_t<R>, Comp, Proj> 309753f127fSDimitry Andric constexpr borrowed_iterator_t<R> 310753f127fSDimitry Andric ranges::pop_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 311753f127fSDimitry Andric 312753f127fSDimitry Andric template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less, 313753f127fSDimitry Andric class Proj = identity> 314753f127fSDimitry Andric requires sortable<I, Comp, Proj> 315753f127fSDimitry Andric constexpr I 316753f127fSDimitry Andric ranges::make_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 317753f127fSDimitry Andric 318753f127fSDimitry Andric template<random_access_range R, class Comp = ranges::less, class Proj = identity> 319753f127fSDimitry Andric requires sortable<iterator_t<R>, Comp, Proj> 320753f127fSDimitry Andric constexpr borrowed_iterator_t<R> 321753f127fSDimitry Andric ranges::make_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 322753f127fSDimitry Andric 323753f127fSDimitry Andric template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less, 324753f127fSDimitry Andric class Proj = identity> 325753f127fSDimitry Andric requires sortable<I, Comp, Proj> 326753f127fSDimitry Andric constexpr I 327753f127fSDimitry Andric ranges::sort_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 328753f127fSDimitry Andric 329753f127fSDimitry Andric template<random_access_range R, class Comp = ranges::less, class Proj = identity> 330753f127fSDimitry Andric requires sortable<iterator_t<R>, Comp, Proj> 331753f127fSDimitry Andric constexpr borrowed_iterator_t<R> 332753f127fSDimitry Andric ranges::sort_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 333753f127fSDimitry Andric 334972a253aSDimitry Andric template<random_access_iterator I, sentinel_for<I> S, class Proj = identity, 335972a253aSDimitry Andric indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> 33606c3fb27SDimitry Andric constexpr bool is_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 337972a253aSDimitry Andric 338972a253aSDimitry Andric template<random_access_range R, class Proj = identity, 339972a253aSDimitry Andric indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> 34006c3fb27SDimitry Andric constexpr bool is_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 341972a253aSDimitry Andric 342972a253aSDimitry Andric template<random_access_iterator I, sentinel_for<I> S, class Proj = identity, 343972a253aSDimitry Andric indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> 34406c3fb27SDimitry Andric constexpr I is_heap_until(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 345972a253aSDimitry Andric 346972a253aSDimitry Andric template<random_access_range R, class Proj = identity, 347972a253aSDimitry Andric indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> 348972a253aSDimitry Andric constexpr borrowed_iterator_t<R> 34906c3fb27SDimitry Andric is_heap_until(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 350972a253aSDimitry Andric 35181ad6265SDimitry Andric template<bidirectional_iterator I, sentinel_for<I> S> 35281ad6265SDimitry Andric requires permutable<I> 35381ad6265SDimitry Andric constexpr I ranges::reverse(I first, S last); // since C++20 35481ad6265SDimitry Andric 35581ad6265SDimitry Andric template<bidirectional_range R> 35681ad6265SDimitry Andric requires permutable<iterator_t<R>> 35781ad6265SDimitry Andric constexpr borrowed_iterator_t<R> ranges::reverse(R&& r); // since C++20 35881ad6265SDimitry Andric 35981ad6265SDimitry Andric template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less, 36081ad6265SDimitry Andric class Proj = identity> 36181ad6265SDimitry Andric requires sortable<I, Comp, Proj> 36281ad6265SDimitry Andric constexpr I 36381ad6265SDimitry Andric ranges::sort(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 36481ad6265SDimitry Andric 36581ad6265SDimitry Andric template<random_access_range R, class Comp = ranges::less, class Proj = identity> 36681ad6265SDimitry Andric requires sortable<iterator_t<R>, Comp, Proj> 36781ad6265SDimitry Andric constexpr borrowed_iterator_t<R> 36881ad6265SDimitry Andric ranges::sort(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 36981ad6265SDimitry Andric 37081ad6265SDimitry Andric template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less, 37181ad6265SDimitry Andric class Proj = identity> 37281ad6265SDimitry Andric requires sortable<I, Comp, Proj> 37381ad6265SDimitry Andric I ranges::stable_sort(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 37481ad6265SDimitry Andric 37581ad6265SDimitry Andric template<random_access_range R, class Comp = ranges::less, class Proj = identity> 37681ad6265SDimitry Andric requires sortable<iterator_t<R>, Comp, Proj> 37781ad6265SDimitry Andric borrowed_iterator_t<R> 37881ad6265SDimitry Andric ranges::stable_sort(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 37981ad6265SDimitry Andric 380fcaf7f86SDimitry Andric template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less, 381fcaf7f86SDimitry Andric class Proj = identity> 382fcaf7f86SDimitry Andric requires sortable<I, Comp, Proj> 383fcaf7f86SDimitry Andric constexpr I 384fcaf7f86SDimitry Andric ranges::partial_sort(I first, I middle, S last, Comp comp = {}, Proj proj = {}); // since C++20 385fcaf7f86SDimitry Andric 386fcaf7f86SDimitry Andric template<random_access_range R, class Comp = ranges::less, class Proj = identity> 387fcaf7f86SDimitry Andric requires sortable<iterator_t<R>, Comp, Proj> 388fcaf7f86SDimitry Andric constexpr borrowed_iterator_t<R> 389fcaf7f86SDimitry Andric ranges::partial_sort(R&& r, iterator_t<R> middle, Comp comp = {}, Proj proj = {}); // since C++20 390fcaf7f86SDimitry Andric 39181ad6265SDimitry Andric template<class T, output_iterator<const T&> O, sentinel_for<O> S> 39281ad6265SDimitry Andric constexpr O ranges::fill(O first, S last, const T& value); // since C++20 39381ad6265SDimitry Andric 39481ad6265SDimitry Andric template<class T, output_range<const T&> R> 39581ad6265SDimitry Andric constexpr borrowed_iterator_t<R> ranges::fill(R&& r, const T& value); // since C++20 39681ad6265SDimitry Andric 39781ad6265SDimitry Andric template<class T, output_iterator<const T&> O> 39881ad6265SDimitry Andric constexpr O ranges::fill_n(O first, iter_difference_t<O> n, const T& value); // since C++20 39981ad6265SDimitry Andric 400972a253aSDimitry Andric template<input_or_output_iterator O, sentinel_for<O> S, copy_constructible F> 401972a253aSDimitry Andric requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>> 40206c3fb27SDimitry Andric constexpr O generate(O first, S last, F gen); // since C++20 40306c3fb27SDimitry Andric 40406c3fb27SDimitry Andric template<class ExecutionPolicy, class ForwardIterator, class Generator> 40506c3fb27SDimitry Andric void generate(ExecutionPolicy&& exec, 40606c3fb27SDimitry Andric ForwardIterator first, ForwardIterator last, 40706c3fb27SDimitry Andric Generator gen); // since C++17 408972a253aSDimitry Andric 409972a253aSDimitry Andric template<class R, copy_constructible F> 410972a253aSDimitry Andric requires invocable<F&> && output_range<R, invoke_result_t<F&>> 41106c3fb27SDimitry Andric constexpr borrowed_iterator_t<R> generate(R&& r, F gen); // since C++20 412972a253aSDimitry Andric 413972a253aSDimitry Andric template<input_or_output_iterator O, copy_constructible F> 414972a253aSDimitry Andric requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>> 41506c3fb27SDimitry Andric constexpr O generate_n(O first, iter_difference_t<O> n, F gen); // since C++20 41606c3fb27SDimitry Andric 41706c3fb27SDimitry Andric template<class ExecutionPolicy, class ForwardIterator, class Size, class Generator> 41806c3fb27SDimitry Andric ForwardIterator generate_n(ExecutionPolicy&& exec, 41906c3fb27SDimitry Andric ForwardIterator first, Size n, Generator gen); // since C++17 420972a253aSDimitry Andric 42181ad6265SDimitry Andric template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, 42281ad6265SDimitry Andric class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> 42381ad6265SDimitry Andric requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2> 42481ad6265SDimitry Andric constexpr bool ranges::equal(I1 first1, S1 last1, I2 first2, S2 last2, 42581ad6265SDimitry Andric Pred pred = {}, 42681ad6265SDimitry Andric Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 42781ad6265SDimitry Andric 42881ad6265SDimitry Andric template<input_range R1, input_range R2, class Pred = ranges::equal_to, 42981ad6265SDimitry Andric class Proj1 = identity, class Proj2 = identity> 43081ad6265SDimitry Andric requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2> 43181ad6265SDimitry Andric constexpr bool ranges::equal(R1&& r1, R2&& r2, Pred pred = {}, 43281ad6265SDimitry Andric Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 43381ad6265SDimitry Andric 43481ad6265SDimitry Andric template<input_iterator I, sentinel_for<I> S, class Proj = identity, 43581ad6265SDimitry Andric indirect_unary_predicate<projected<I, Proj>> Pred> 43681ad6265SDimitry Andric constexpr bool ranges::all_of(I first, S last, Pred pred, Proj proj = {}); // since C++20 43781ad6265SDimitry Andric 43881ad6265SDimitry Andric template<input_range R, class Proj = identity, 43981ad6265SDimitry Andric indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> 44081ad6265SDimitry Andric constexpr bool ranges::all_of(R&& r, Pred pred, Proj proj = {}); // since C++20 44181ad6265SDimitry Andric 44281ad6265SDimitry Andric template<input_iterator I, sentinel_for<I> S, class Proj = identity, 44381ad6265SDimitry Andric indirect_unary_predicate<projected<I, Proj>> Pred> 44481ad6265SDimitry Andric constexpr bool ranges::any_of(I first, S last, Pred pred, Proj proj = {}); // since C++20 44581ad6265SDimitry Andric 44681ad6265SDimitry Andric template<input_range R, class Proj = identity, 44781ad6265SDimitry Andric indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> 44881ad6265SDimitry Andric constexpr bool ranges::any_of(R&& r, Pred pred, Proj proj = {}); // since C++20 44981ad6265SDimitry Andric 450*5f757f3fSDimitry Andric template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, 451*5f757f3fSDimitry Andric class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> 452*5f757f3fSDimitry Andric requires (forward_iterator<I1> || sized_sentinel_for<S1, I1>) && 453*5f757f3fSDimitry Andric (forward_iterator<I2> || sized_sentinel_for<S2, I2>) && 454*5f757f3fSDimitry Andric indirectly_comparable<I1, I2, Pred, Proj1, Proj2> 455*5f757f3fSDimitry Andric constexpr bool ranges::ends_with(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, 456*5f757f3fSDimitry Andric Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23 457*5f757f3fSDimitry Andric 458*5f757f3fSDimitry Andric template<input_range R1, input_range R2, class Pred = ranges::equal_to, class Proj1 = identity, 459*5f757f3fSDimitry Andric class Proj2 = identity> 460*5f757f3fSDimitry Andric requires (forward_range<R1> || sized_range<R1>) && 461*5f757f3fSDimitry Andric (forward_range<R2> || sized_range<R2>) && 462*5f757f3fSDimitry Andric indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2> 463*5f757f3fSDimitry Andric constexpr bool ranges::ends_with(R1&& r1, R2&& r2, Pred pred = {}, 464*5f757f3fSDimitry Andric Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23 465*5f757f3fSDimitry Andric 46681ad6265SDimitry Andric template<input_iterator I, sentinel_for<I> S, class Proj = identity, 46781ad6265SDimitry Andric indirect_unary_predicate<projected<I, Proj>> Pred> 46881ad6265SDimitry Andric constexpr bool ranges::none_of(I first, S last, Pred pred, Proj proj = {}); // since C++20 46981ad6265SDimitry Andric 47081ad6265SDimitry Andric template<input_range R, class Proj = identity, 47181ad6265SDimitry Andric indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> 47281ad6265SDimitry Andric constexpr bool ranges::none_of(R&& r, Pred pred, Proj proj = {}); // since C++20 47381ad6265SDimitry Andric 47406c3fb27SDimitry Andric template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, 47506c3fb27SDimitry Andric class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> 47606c3fb27SDimitry Andric requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2> 47706c3fb27SDimitry Andric constexpr bool ranges::starts_with(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, 47806c3fb27SDimitry Andric Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23 47906c3fb27SDimitry Andric 48006c3fb27SDimitry Andric template<input_range R1, input_range R2, class Pred = ranges::equal_to, class Proj1 = identity, 48106c3fb27SDimitry Andric class Proj2 = identity> 48206c3fb27SDimitry Andric requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2> 48306c3fb27SDimitry Andric constexpr bool ranges::starts_with(R1&& r1, R2&& r2, Pred pred = {}, 48406c3fb27SDimitry Andric Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23 48506c3fb27SDimitry Andric 48661cfbce3SDimitry Andric template<input_iterator I1, sentinel_for<I1> S1, 48761cfbce3SDimitry Andric random_access_iterator I2, sentinel_for<I2> S2, 48861cfbce3SDimitry Andric class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity> 48961cfbce3SDimitry Andric requires indirectly_copyable<I1, I2> && sortable<I2, Comp, Proj2> && 49061cfbce3SDimitry Andric indirect_strict_weak_order<Comp, projected<I1, Proj1>, projected<I2, Proj2>> 49161cfbce3SDimitry Andric constexpr partial_sort_copy_result<I1, I2> 49261cfbce3SDimitry Andric partial_sort_copy(I1 first, S1 last, I2 result_first, S2 result_last, 49306c3fb27SDimitry Andric Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 49461cfbce3SDimitry Andric 49561cfbce3SDimitry Andric template<input_range R1, random_access_range R2, class Comp = ranges::less, 49661cfbce3SDimitry Andric class Proj1 = identity, class Proj2 = identity> 49761cfbce3SDimitry Andric requires indirectly_copyable<iterator_t<R1>, iterator_t<R2>> && 49861cfbce3SDimitry Andric sortable<iterator_t<R2>, Comp, Proj2> && 49961cfbce3SDimitry Andric indirect_strict_weak_order<Comp, projected<iterator_t<R1>, Proj1>, 50061cfbce3SDimitry Andric projected<iterator_t<R2>, Proj2>> 50161cfbce3SDimitry Andric constexpr partial_sort_copy_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>> 50261cfbce3SDimitry Andric partial_sort_copy(R1&& r, R2&& result_r, Comp comp = {}, 50306c3fb27SDimitry Andric Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 50461cfbce3SDimitry Andric 50581ad6265SDimitry Andric template<forward_iterator I, sentinel_for<I> S, class Proj = identity, 50681ad6265SDimitry Andric indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> 50781ad6265SDimitry Andric constexpr bool ranges::is_sorted(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 50881ad6265SDimitry Andric 50981ad6265SDimitry Andric template<forward_range R, class Proj = identity, 51081ad6265SDimitry Andric indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> 51181ad6265SDimitry Andric constexpr bool ranges::is_sorted(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 51281ad6265SDimitry Andric 51381ad6265SDimitry Andric template<forward_iterator I, sentinel_for<I> S, class Proj = identity, 51481ad6265SDimitry Andric indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> 51581ad6265SDimitry Andric constexpr I ranges::is_sorted_until(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 51681ad6265SDimitry Andric 51781ad6265SDimitry Andric template<forward_range R, class Proj = identity, 51881ad6265SDimitry Andric indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> 51981ad6265SDimitry Andric constexpr borrowed_iterator_t<R> 52081ad6265SDimitry Andric ranges::is_sorted_until(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 52181ad6265SDimitry Andric 522753f127fSDimitry Andric template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less, 523753f127fSDimitry Andric class Proj = identity> 524753f127fSDimitry Andric requires sortable<I, Comp, Proj> 525753f127fSDimitry Andric constexpr I 526753f127fSDimitry Andric ranges::nth_element(I first, I nth, S last, Comp comp = {}, Proj proj = {}); // since C++20 527753f127fSDimitry Andric 528753f127fSDimitry Andric template<random_access_range R, class Comp = ranges::less, class Proj = identity> 529753f127fSDimitry Andric requires sortable<iterator_t<R>, Comp, Proj> 530753f127fSDimitry Andric constexpr borrowed_iterator_t<R> 531753f127fSDimitry Andric ranges::nth_element(R&& r, iterator_t<R> nth, Comp comp = {}, Proj proj = {}); // since C++20 532753f127fSDimitry Andric 53381ad6265SDimitry Andric template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity, 53406c3fb27SDimitry Andric indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less> // since C++20 53506c3fb27SDimitry Andric constexpr I upper_bound(I first, S last, const T& value, Comp comp = {}, Proj proj = {}); 53681ad6265SDimitry Andric 53781ad6265SDimitry Andric template<forward_range R, class T, class Proj = identity, 53881ad6265SDimitry Andric indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp = 53981ad6265SDimitry Andric ranges::less> 54081ad6265SDimitry Andric constexpr borrowed_iterator_t<R> 54181ad6265SDimitry Andric upper_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20 54281ad6265SDimitry Andric 54381ad6265SDimitry Andric template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity, 54481ad6265SDimitry Andric indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less> 54581ad6265SDimitry Andric constexpr I lower_bound(I first, S last, const T& value, Comp comp = {}, 54681ad6265SDimitry Andric Proj proj = {}); // since C++20 54781ad6265SDimitry Andric template<forward_range R, class T, class Proj = identity, 54881ad6265SDimitry Andric indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp = 54981ad6265SDimitry Andric ranges::less> 55081ad6265SDimitry Andric constexpr borrowed_iterator_t<R> 55181ad6265SDimitry Andric lower_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20 55281ad6265SDimitry Andric 55381ad6265SDimitry Andric template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity, 55481ad6265SDimitry Andric indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less> 55581ad6265SDimitry Andric constexpr bool binary_search(I first, S last, const T& value, Comp comp = {}, 55681ad6265SDimitry Andric Proj proj = {}); // since C++20 55781ad6265SDimitry Andric 55881ad6265SDimitry Andric template<forward_range R, class T, class Proj = identity, 55981ad6265SDimitry Andric indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp = 56081ad6265SDimitry Andric ranges::less> 56181ad6265SDimitry Andric constexpr bool binary_search(R&& r, const T& value, Comp comp = {}, 56281ad6265SDimitry Andric Proj proj = {}); // since C++20 563fcaf7f86SDimitry Andric 564fcaf7f86SDimitry Andric template<permutable I, sentinel_for<I> S, class Proj = identity, 565fcaf7f86SDimitry Andric indirect_unary_predicate<projected<I, Proj>> Pred> 566fcaf7f86SDimitry Andric constexpr subrange<I> 56706c3fb27SDimitry Andric partition(I first, S last, Pred pred, Proj proj = {}); // since C++20 568fcaf7f86SDimitry Andric 569fcaf7f86SDimitry Andric template<forward_range R, class Proj = identity, 570fcaf7f86SDimitry Andric indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> 571fcaf7f86SDimitry Andric requires permutable<iterator_t<R>> 572fcaf7f86SDimitry Andric constexpr borrowed_subrange_t<R> 57306c3fb27SDimitry Andric partition(R&& r, Pred pred, Proj proj = {}); // since C++20 574fcaf7f86SDimitry Andric 575fcaf7f86SDimitry Andric template<bidirectional_iterator I, sentinel_for<I> S, class Proj = identity, 576fcaf7f86SDimitry Andric indirect_unary_predicate<projected<I, Proj>> Pred> 577fcaf7f86SDimitry Andric requires permutable<I> 57806c3fb27SDimitry Andric subrange<I> stable_partition(I first, S last, Pred pred, Proj proj = {}); // since C++20 579fcaf7f86SDimitry Andric 580fcaf7f86SDimitry Andric template<bidirectional_range R, class Proj = identity, 581fcaf7f86SDimitry Andric indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> 582fcaf7f86SDimitry Andric requires permutable<iterator_t<R>> 58306c3fb27SDimitry Andric borrowed_subrange_t<R> stable_partition(R&& r, Pred pred, Proj proj = {}); // since C++20 584fcaf7f86SDimitry Andric 58581ad6265SDimitry Andric template<input_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2, 58681ad6265SDimitry Andric class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> 58781ad6265SDimitry Andric requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2> 58881ad6265SDimitry Andric constexpr I1 ranges::find_first_of(I1 first1, S1 last1, I2 first2, S2 last2, 58981ad6265SDimitry Andric Pred pred = {}, 59081ad6265SDimitry Andric Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 59181ad6265SDimitry Andric 59281ad6265SDimitry Andric template<input_range R1, forward_range R2, 59381ad6265SDimitry Andric class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> 59481ad6265SDimitry Andric requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2> 59581ad6265SDimitry Andric constexpr borrowed_iterator_t<R1> 59681ad6265SDimitry Andric ranges::find_first_of(R1&& r1, R2&& r2, 59781ad6265SDimitry Andric Pred pred = {}, 59881ad6265SDimitry Andric Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 59981ad6265SDimitry Andric 60081ad6265SDimitry Andric template<forward_iterator I, sentinel_for<I> S, class Proj = identity, 60181ad6265SDimitry Andric indirect_binary_predicate<projected<I, Proj>, 60281ad6265SDimitry Andric projected<I, Proj>> Pred = ranges::equal_to> 60306c3fb27SDimitry Andric constexpr I ranges::adjacent_find(I first, S last, Pred pred = {}, Proj proj = {}); // since C++20 60481ad6265SDimitry Andric 60581ad6265SDimitry Andric template<forward_range R, class Proj = identity, 60681ad6265SDimitry Andric indirect_binary_predicate<projected<iterator_t<R>, Proj>, 60781ad6265SDimitry Andric projected<iterator_t<R>, Proj>> Pred = ranges::equal_to> 60881ad6265SDimitry Andric constexpr borrowed_iterator_t<R> ranges::adjacent_find(R&& r, Pred pred = {}, Proj proj = {}); // since C++20 60981ad6265SDimitry Andric 61081ad6265SDimitry Andric template<input_iterator I, sentinel_for<I> S, class T1, class T2, class Proj = identity> 61181ad6265SDimitry Andric requires indirectly_writable<I, const T2&> && 61281ad6265SDimitry Andric indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*> 61381ad6265SDimitry Andric constexpr I 61481ad6265SDimitry Andric ranges::replace(I first, S last, const T1& old_value, const T2& new_value, Proj proj = {}); // since C++20 61581ad6265SDimitry Andric 61681ad6265SDimitry Andric template<input_range R, class T1, class T2, class Proj = identity> 61781ad6265SDimitry Andric requires indirectly_writable<iterator_t<R>, const T2&> && 61881ad6265SDimitry Andric indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T1*> 61981ad6265SDimitry Andric constexpr borrowed_iterator_t<R> 62081ad6265SDimitry Andric ranges::replace(R&& r, const T1& old_value, const T2& new_value, Proj proj = {}); // since C++20 62181ad6265SDimitry Andric 62281ad6265SDimitry Andric template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity, 62381ad6265SDimitry Andric indirect_unary_predicate<projected<I, Proj>> Pred> 62481ad6265SDimitry Andric requires indirectly_writable<I, const T&> 62581ad6265SDimitry Andric constexpr I ranges::replace_if(I first, S last, Pred pred, const T& new_value, Proj proj = {}); // since C++20 62681ad6265SDimitry Andric 62781ad6265SDimitry Andric template<input_range R, class T, class Proj = identity, 62881ad6265SDimitry Andric indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> 62981ad6265SDimitry Andric requires indirectly_writable<iterator_t<R>, const T&> 63081ad6265SDimitry Andric constexpr borrowed_iterator_t<R> 63181ad6265SDimitry Andric ranges::replace_if(R&& r, Pred pred, const T& new_value, Proj proj = {}); // since C++20 63281ad6265SDimitry Andric 63361cfbce3SDimitry Andric template<class T, class Proj = identity, 63461cfbce3SDimitry Andric indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less> 63561cfbce3SDimitry Andric constexpr const T& 63661cfbce3SDimitry Andric ranges::clamp(const T& v, const T& lo, const T& hi, Comp comp = {}, Proj proj = {}); // since C++20 63761cfbce3SDimitry Andric 63881ad6265SDimitry Andric template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, 63981ad6265SDimitry Andric class Proj1 = identity, class Proj2 = identity, 64081ad6265SDimitry Andric indirect_strict_weak_order<projected<I1, Proj1>, 64181ad6265SDimitry Andric projected<I2, Proj2>> Comp = ranges::less> 64281ad6265SDimitry Andric constexpr bool 64381ad6265SDimitry Andric ranges::lexicographical_compare(I1 first1, S1 last1, I2 first2, S2 last2, 64481ad6265SDimitry Andric Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 64581ad6265SDimitry Andric 64681ad6265SDimitry Andric template<input_range R1, input_range R2, class Proj1 = identity, 64781ad6265SDimitry Andric class Proj2 = identity, 64881ad6265SDimitry Andric indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>, 64981ad6265SDimitry Andric projected<iterator_t<R2>, Proj2>> Comp = ranges::less> 65081ad6265SDimitry Andric constexpr bool 65181ad6265SDimitry Andric ranges::lexicographical_compare(R1&& r1, R2&& r2, Comp comp = {}, 65281ad6265SDimitry Andric Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 65381ad6265SDimitry Andric 65481ad6265SDimitry Andric template<bidirectional_iterator I1, sentinel_for<I1> S1, bidirectional_iterator I2> 65581ad6265SDimitry Andric requires indirectly_movable<I1, I2> 65681ad6265SDimitry Andric constexpr ranges::move_backward_result<I1, I2> 65781ad6265SDimitry Andric ranges::move_backward(I1 first, S1 last, I2 result); // since C++20 65881ad6265SDimitry Andric 65981ad6265SDimitry Andric template<bidirectional_range R, bidirectional_iterator I> 66081ad6265SDimitry Andric requires indirectly_movable<iterator_t<R>, I> 66181ad6265SDimitry Andric constexpr ranges::move_backward_result<borrowed_iterator_t<R>, I> 66281ad6265SDimitry Andric ranges::move_backward(R&& r, I result); // since C++20 66381ad6265SDimitry Andric 66481ad6265SDimitry Andric template<input_iterator I, sentinel_for<I> S, weakly_incrementable O> 66581ad6265SDimitry Andric requires indirectly_movable<I, O> 66681ad6265SDimitry Andric constexpr ranges::move_result<I, O> 66781ad6265SDimitry Andric ranges::move(I first, S last, O result); // since C++20 66881ad6265SDimitry Andric 66981ad6265SDimitry Andric template<input_range R, weakly_incrementable O> 67081ad6265SDimitry Andric requires indirectly_movable<iterator_t<R>, O> 67181ad6265SDimitry Andric constexpr ranges::move_result<borrowed_iterator_t<R>, O> 67281ad6265SDimitry Andric ranges::move(R&& r, O result); // since C++20 67381ad6265SDimitry Andric 674fcaf7f86SDimitry Andric template<class I, class O1, class O2> 675fcaf7f86SDimitry Andric using partition_copy_result = in_out_out_result<I, O1, O2>; // since C++20 676fcaf7f86SDimitry Andric 677fcaf7f86SDimitry Andric template<input_iterator I, sentinel_for<I> S, 678fcaf7f86SDimitry Andric weakly_incrementable O1, weakly_incrementable O2, 679fcaf7f86SDimitry Andric class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred> 680fcaf7f86SDimitry Andric requires indirectly_copyable<I, O1> && indirectly_copyable<I, O2> 681fcaf7f86SDimitry Andric constexpr partition_copy_result<I, O1, O2> 682fcaf7f86SDimitry Andric partition_copy(I first, S last, O1 out_true, O2 out_false, Pred pred, 68306c3fb27SDimitry Andric Proj proj = {}); // since C++20 684fcaf7f86SDimitry Andric 685fcaf7f86SDimitry Andric template<input_range R, weakly_incrementable O1, weakly_incrementable O2, 686fcaf7f86SDimitry Andric class Proj = identity, 687fcaf7f86SDimitry Andric indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> 688fcaf7f86SDimitry Andric requires indirectly_copyable<iterator_t<R>, O1> && 689fcaf7f86SDimitry Andric indirectly_copyable<iterator_t<R>, O2> 690fcaf7f86SDimitry Andric constexpr partition_copy_result<borrowed_iterator_t<R>, O1, O2> 69106c3fb27SDimitry Andric partition_copy(R&& r, O1 out_true, O2 out_false, Pred pred, Proj proj = {}); // since C++20 692fcaf7f86SDimitry Andric 693fcaf7f86SDimitry Andric template<forward_iterator I, sentinel_for<I> S, class Proj = identity, 694fcaf7f86SDimitry Andric indirect_unary_predicate<projected<I, Proj>> Pred> 69506c3fb27SDimitry Andric constexpr I partition_point(I first, S last, Pred pred, Proj proj = {}); // since C++20 696fcaf7f86SDimitry Andric 697fcaf7f86SDimitry Andric template<forward_range R, class Proj = identity, 698fcaf7f86SDimitry Andric indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> 699fcaf7f86SDimitry Andric constexpr borrowed_iterator_t<R> 70006c3fb27SDimitry Andric partition_point(R&& r, Pred pred, Proj proj = {}); // since C++20 701fcaf7f86SDimitry Andric 702753f127fSDimitry Andric template<class I1, class I2, class O> 703753f127fSDimitry Andric using merge_result = in_in_out_result<I1, I2, O>; // since C++20 704753f127fSDimitry Andric 705753f127fSDimitry Andric template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, 706753f127fSDimitry Andric weakly_incrementable O, class Comp = ranges::less, class Proj1 = identity, 707753f127fSDimitry Andric class Proj2 = identity> 708753f127fSDimitry Andric requires mergeable<I1, I2, O, Comp, Proj1, Proj2> 709753f127fSDimitry Andric constexpr merge_result<I1, I2, O> 710753f127fSDimitry Andric merge(I1 first1, S1 last1, I2 first2, S2 last2, O result, 711753f127fSDimitry Andric Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 712753f127fSDimitry Andric 713753f127fSDimitry Andric template<input_range R1, input_range R2, weakly_incrementable O, class Comp = ranges::less, 714753f127fSDimitry Andric class Proj1 = identity, class Proj2 = identity> 715753f127fSDimitry Andric requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2> 716753f127fSDimitry Andric constexpr merge_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O> 717753f127fSDimitry Andric merge(R1&& r1, R2&& r2, O result, 718753f127fSDimitry Andric Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 719753f127fSDimitry Andric 720753f127fSDimitry Andric template<permutable I, sentinel_for<I> S, class T, class Proj = identity> 721753f127fSDimitry Andric requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*> 722753f127fSDimitry Andric constexpr subrange<I> ranges::remove(I first, S last, const T& value, Proj proj = {}); // since C++20 723753f127fSDimitry Andric 724753f127fSDimitry Andric template<forward_range R, class T, class Proj = identity> 725753f127fSDimitry Andric requires permutable<iterator_t<R>> && 726753f127fSDimitry Andric indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*> 727753f127fSDimitry Andric constexpr borrowed_subrange_t<R> 728753f127fSDimitry Andric ranges::remove(R&& r, const T& value, Proj proj = {}); // since C++20 729753f127fSDimitry Andric 730753f127fSDimitry Andric template<permutable I, sentinel_for<I> S, class Proj = identity, 731753f127fSDimitry Andric indirect_unary_predicate<projected<I, Proj>> Pred> 732753f127fSDimitry Andric constexpr subrange<I> ranges::remove_if(I first, S last, Pred pred, Proj proj = {}); // since C++20 733753f127fSDimitry Andric 734753f127fSDimitry Andric template<forward_range R, class Proj = identity, 735753f127fSDimitry Andric indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> 736753f127fSDimitry Andric requires permutable<iterator_t<R>> 737753f127fSDimitry Andric constexpr borrowed_subrange_t<R> 738753f127fSDimitry Andric ranges::remove_if(R&& r, Pred pred, Proj proj = {}); // since C++20 739753f127fSDimitry Andric 740753f127fSDimitry Andric template<class I, class O> 741753f127fSDimitry Andric using set_difference_result = in_out_result<I, O>; // since C++20 742753f127fSDimitry Andric 743753f127fSDimitry Andric template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, 744753f127fSDimitry Andric weakly_incrementable O, class Comp = ranges::less, 745753f127fSDimitry Andric class Proj1 = identity, class Proj2 = identity> 746753f127fSDimitry Andric requires mergeable<I1, I2, O, Comp, Proj1, Proj2> 747753f127fSDimitry Andric constexpr set_difference_result<I1, O> 748753f127fSDimitry Andric set_difference(I1 first1, S1 last1, I2 first2, S2 last2, O result, 749753f127fSDimitry Andric Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 750753f127fSDimitry Andric 751753f127fSDimitry Andric template<input_range R1, input_range R2, weakly_incrementable O, 752753f127fSDimitry Andric class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity> 753753f127fSDimitry Andric requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2> 754753f127fSDimitry Andric constexpr set_difference_result<borrowed_iterator_t<R1>, O> 755753f127fSDimitry Andric set_difference(R1&& r1, R2&& r2, O result, 756753f127fSDimitry Andric Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 757753f127fSDimitry Andric 758753f127fSDimitry Andric template<class I1, class I2, class O> 759753f127fSDimitry Andric using set_intersection_result = in_in_out_result<I1, I2, O>; // since C++20 760753f127fSDimitry Andric 761753f127fSDimitry Andric template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, 762753f127fSDimitry Andric weakly_incrementable O, class Comp = ranges::less, 763753f127fSDimitry Andric class Proj1 = identity, class Proj2 = identity> 764753f127fSDimitry Andric requires mergeable<I1, I2, O, Comp, Proj1, Proj2> 765753f127fSDimitry Andric constexpr set_intersection_result<I1, I2, O> 766753f127fSDimitry Andric set_intersection(I1 first1, S1 last1, I2 first2, S2 last2, O result, 767753f127fSDimitry Andric Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 768753f127fSDimitry Andric 769753f127fSDimitry Andric template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, 770753f127fSDimitry Andric weakly_incrementable O, class Comp = ranges::less, 771753f127fSDimitry Andric class Proj1 = identity, class Proj2 = identity> 772753f127fSDimitry Andric requires mergeable<I1, I2, O, Comp, Proj1, Proj2> 773753f127fSDimitry Andric constexpr set_intersection_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O> 774753f127fSDimitry Andric set_intersection(R1&& r1, R2&& r2, O result, 775753f127fSDimitry Andric Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 776753f127fSDimitry Andric 777753f127fSDimitry Andric template <class _InIter, class _OutIter> 778753f127fSDimitry Andric using reverse_copy_result = in_out_result<_InIter, _OutIter>; // since C++20 779753f127fSDimitry Andric 780753f127fSDimitry Andric template<bidirectional_iterator I, sentinel_for<I> S, weakly_incrementable O> 781753f127fSDimitry Andric requires indirectly_copyable<I, O> 782753f127fSDimitry Andric constexpr ranges::reverse_copy_result<I, O> 783753f127fSDimitry Andric ranges::reverse_copy(I first, S last, O result); // since C++20 784753f127fSDimitry Andric 785753f127fSDimitry Andric template<bidirectional_range R, weakly_incrementable O> 786753f127fSDimitry Andric requires indirectly_copyable<iterator_t<R>, O> 787753f127fSDimitry Andric constexpr ranges::reverse_copy_result<borrowed_iterator_t<R>, O> 788753f127fSDimitry Andric ranges::reverse_copy(R&& r, O result); // since C++20 789753f127fSDimitry Andric 79061cfbce3SDimitry Andric template<permutable I, sentinel_for<I> S> 79161cfbce3SDimitry Andric constexpr subrange<I> rotate(I first, I middle, S last); // since C++20 79261cfbce3SDimitry Andric 79361cfbce3SDimitry Andric template<forward_range R> 79461cfbce3SDimitry Andric requires permutable<iterator_t<R>> 79506c3fb27SDimitry Andric constexpr borrowed_subrange_t<R> rotate(R&& r, iterator_t<R> middle); // since C++20 79661cfbce3SDimitry Andric 797753f127fSDimitry Andric template <class _InIter, class _OutIter> 798753f127fSDimitry Andric using rotate_copy_result = in_out_result<_InIter, _OutIter>; // since C++20 799753f127fSDimitry Andric 800753f127fSDimitry Andric template<forward_iterator I, sentinel_for<I> S, weakly_incrementable O> 801753f127fSDimitry Andric requires indirectly_copyable<I, O> 802753f127fSDimitry Andric constexpr ranges::rotate_copy_result<I, O> 803753f127fSDimitry Andric ranges::rotate_copy(I first, I middle, S last, O result); // since C++20 804753f127fSDimitry Andric 805753f127fSDimitry Andric template<forward_range R, weakly_incrementable O> 806753f127fSDimitry Andric requires indirectly_copyable<iterator_t<R>, O> 807753f127fSDimitry Andric constexpr ranges::rotate_copy_result<borrowed_iterator_t<R>, O> 808753f127fSDimitry Andric ranges::rotate_copy(R&& r, iterator_t<R> middle, O result); // since C++20 809753f127fSDimitry Andric 81061cfbce3SDimitry Andric template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Gen> 81161cfbce3SDimitry Andric requires (forward_iterator<I> || random_access_iterator<O>) && 81261cfbce3SDimitry Andric indirectly_copyable<I, O> && 81361cfbce3SDimitry Andric uniform_random_bit_generator<remove_reference_t<Gen>> 81406c3fb27SDimitry Andric O sample(I first, S last, O out, iter_difference_t<I> n, Gen&& g); // since C++20 81561cfbce3SDimitry Andric 81661cfbce3SDimitry Andric template<input_range R, weakly_incrementable O, class Gen> 81761cfbce3SDimitry Andric requires (forward_range<R> || random_access_iterator<O>) && 81861cfbce3SDimitry Andric indirectly_copyable<iterator_t<R>, O> && 81961cfbce3SDimitry Andric uniform_random_bit_generator<remove_reference_t<Gen>> 82006c3fb27SDimitry Andric O sample(R&& r, O out, range_difference_t<R> n, Gen&& g); // since C++20 82161cfbce3SDimitry Andric 822fcaf7f86SDimitry Andric template<random_access_iterator I, sentinel_for<I> S, class Gen> 823fcaf7f86SDimitry Andric requires permutable<I> && 824fcaf7f86SDimitry Andric uniform_random_bit_generator<remove_reference_t<Gen>> 82506c3fb27SDimitry Andric I shuffle(I first, S last, Gen&& g); // since C++20 826fcaf7f86SDimitry Andric 827fcaf7f86SDimitry Andric template<random_access_range R, class Gen> 828fcaf7f86SDimitry Andric requires permutable<iterator_t<R>> && 829fcaf7f86SDimitry Andric uniform_random_bit_generator<remove_reference_t<Gen>> 83006c3fb27SDimitry Andric borrowed_iterator_t<R> shuffle(R&& r, Gen&& g); // since C++20 831fcaf7f86SDimitry Andric 832753f127fSDimitry Andric template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2, 83361cfbce3SDimitry Andric sentinel_for<I2> S2, class Proj1 = identity, class Proj2 = identity, 83461cfbce3SDimitry Andric indirect_equivalence_relation<projected<I1, Proj1>, 83561cfbce3SDimitry Andric projected<I2, Proj2>> Pred = ranges::equal_to> 83661cfbce3SDimitry Andric constexpr bool ranges::is_permutation(I1 first1, S1 last1, I2 first2, S2 last2, 83761cfbce3SDimitry Andric Pred pred = {}, 83806c3fb27SDimitry Andric Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 83961cfbce3SDimitry Andric 84061cfbce3SDimitry Andric template<forward_range R1, forward_range R2, 84161cfbce3SDimitry Andric class Proj1 = identity, class Proj2 = identity, 84261cfbce3SDimitry Andric indirect_equivalence_relation<projected<iterator_t<R1>, Proj1>, 84361cfbce3SDimitry Andric projected<iterator_t<R2>, Proj2>> Pred = ranges::equal_to> 84461cfbce3SDimitry Andric constexpr bool ranges::is_permutation(R1&& r1, R2&& r2, Pred pred = {}, 84506c3fb27SDimitry Andric Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 84661cfbce3SDimitry Andric 84761cfbce3SDimitry Andric template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2, 848753f127fSDimitry Andric sentinel_for<I2> S2, class Pred = ranges::equal_to, 849753f127fSDimitry Andric class Proj1 = identity, class Proj2 = identity> 850753f127fSDimitry Andric requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2> 851753f127fSDimitry Andric constexpr subrange<I1> 852753f127fSDimitry Andric ranges::search(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, 853753f127fSDimitry Andric Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 854753f127fSDimitry Andric 855753f127fSDimitry Andric template<forward_range R1, forward_range R2, class Pred = ranges::equal_to, 856753f127fSDimitry Andric class Proj1 = identity, class Proj2 = identity> 857753f127fSDimitry Andric requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2> 858753f127fSDimitry Andric constexpr borrowed_subrange_t<R1> 859753f127fSDimitry Andric ranges::search(R1&& r1, R2&& r2, Pred pred = {}, 860753f127fSDimitry Andric Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 861753f127fSDimitry Andric 862753f127fSDimitry Andric template<forward_iterator I, sentinel_for<I> S, class T, 863753f127fSDimitry Andric class Pred = ranges::equal_to, class Proj = identity> 864753f127fSDimitry Andric requires indirectly_comparable<I, const T*, Pred, Proj> 865753f127fSDimitry Andric constexpr subrange<I> 866753f127fSDimitry Andric ranges::search_n(I first, S last, iter_difference_t<I> count, 867753f127fSDimitry Andric const T& value, Pred pred = {}, Proj proj = {}); // since C++20 868753f127fSDimitry Andric 869753f127fSDimitry Andric template<forward_range R, class T, class Pred = ranges::equal_to, 870753f127fSDimitry Andric class Proj = identity> 871753f127fSDimitry Andric requires indirectly_comparable<iterator_t<R>, const T*, Pred, Proj> 872753f127fSDimitry Andric constexpr borrowed_subrange_t<R> 873753f127fSDimitry Andric ranges::search_n(R&& r, range_difference_t<R> count, 874753f127fSDimitry Andric const T& value, Pred pred = {}, Proj proj = {}); // since C++20 875753f127fSDimitry Andric 876753f127fSDimitry Andric template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2, 877753f127fSDimitry Andric class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> 878753f127fSDimitry Andric requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2> 879753f127fSDimitry Andric constexpr subrange<I1> 880753f127fSDimitry Andric ranges::find_end(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, 881753f127fSDimitry Andric Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 882753f127fSDimitry Andric 883753f127fSDimitry Andric template<forward_range R1, forward_range R2, 884753f127fSDimitry Andric class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> 885753f127fSDimitry Andric requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2> 886753f127fSDimitry Andric constexpr borrowed_subrange_t<R1> 887753f127fSDimitry Andric ranges::find_end(R1&& r1, R2&& r2, Pred pred = {}, 888753f127fSDimitry Andric Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 889753f127fSDimitry Andric 890753f127fSDimitry Andric template<class I1, class I2, class O> 891753f127fSDimitry Andric using set_symmetric_difference_result = in_in_out_result<I1, I2, O>; // since C++20 892753f127fSDimitry Andric 893753f127fSDimitry Andric template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, 894753f127fSDimitry Andric weakly_incrementable O, class Comp = ranges::less, 895753f127fSDimitry Andric class Proj1 = identity, class Proj2 = identity> 896753f127fSDimitry Andric requires mergeable<I1, I2, O, Comp, Proj1, Proj2> 897753f127fSDimitry Andric constexpr set_symmetric_difference_result<I1, I2, O> 898753f127fSDimitry Andric set_symmetric_difference(I1 first1, S1 last1, I2 first2, S2 last2, O result, 899753f127fSDimitry Andric Comp comp = {}, Proj1 proj1 = {}, 900753f127fSDimitry Andric Proj2 proj2 = {}); // since C++20 901753f127fSDimitry Andric 902753f127fSDimitry Andric template<input_range R1, input_range R2, weakly_incrementable O, 903753f127fSDimitry Andric class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity> 904753f127fSDimitry Andric requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2> 905753f127fSDimitry Andric constexpr set_symmetric_difference_result<borrowed_iterator_t<R1>, 906753f127fSDimitry Andric borrowed_iterator_t<R2>, O> 907753f127fSDimitry Andric set_symmetric_difference(R1&& r1, R2&& r2, O result, Comp comp = {}, 908753f127fSDimitry Andric Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 90981ad6265SDimitry Andric 910fcaf7f86SDimitry Andric template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity, 911fcaf7f86SDimitry Andric indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less> 912fcaf7f86SDimitry Andric constexpr subrange<I> 913fcaf7f86SDimitry Andric equal_range(I first, S last, const T& value, Comp comp = {}, Proj proj = {}); // since C++20 914fcaf7f86SDimitry Andric 915fcaf7f86SDimitry Andric template<forward_range R, class T, class Proj = identity, 916fcaf7f86SDimitry Andric indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp = 917fcaf7f86SDimitry Andric ranges::less> 918fcaf7f86SDimitry Andric constexpr borrowed_subrange_t<R> 919fcaf7f86SDimitry Andric equal_range(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20 920fcaf7f86SDimitry Andric 921fcaf7f86SDimitry Andric template<class I1, class I2, class O> 922fcaf7f86SDimitry Andric using set_union_result = in_in_out_result<I1, I2, O>; // since C++20 923fcaf7f86SDimitry Andric 924fcaf7f86SDimitry Andric template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, 925fcaf7f86SDimitry Andric weakly_incrementable O, class Comp = ranges::less, 926fcaf7f86SDimitry Andric class Proj1 = identity, class Proj2 = identity> 927fcaf7f86SDimitry Andric requires mergeable<I1, I2, O, Comp, Proj1, Proj2> 928fcaf7f86SDimitry Andric constexpr set_union_result<I1, I2, O> 929fcaf7f86SDimitry Andric set_union(I1 first1, S1 last1, I2 first2, S2 last2, O result, Comp comp = {}, 930fcaf7f86SDimitry Andric Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 931fcaf7f86SDimitry Andric 932fcaf7f86SDimitry Andric template<input_range R1, input_range R2, weakly_incrementable O, 933fcaf7f86SDimitry Andric class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity> 934fcaf7f86SDimitry Andric requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2> 935fcaf7f86SDimitry Andric constexpr set_union_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O> 936fcaf7f86SDimitry Andric set_union(R1&& r1, R2&& r2, O result, Comp comp = {}, 937fcaf7f86SDimitry Andric Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 938fcaf7f86SDimitry Andric 939fcaf7f86SDimitry Andric template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, 940fcaf7f86SDimitry Andric class Proj1 = identity, class Proj2 = identity, 941fcaf7f86SDimitry Andric indirect_strict_weak_order<projected<I1, Proj1>, projected<I2, Proj2>> Comp = 942fcaf7f86SDimitry Andric ranges::less> 943fcaf7f86SDimitry Andric constexpr bool includes(I1 first1, S1 last1, I2 first2, S2 last2, Comp comp = {}, 94406c3fb27SDimitry Andric Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 945fcaf7f86SDimitry Andric 946fcaf7f86SDimitry Andric template<input_range R1, input_range R2, class Proj1 = identity, 947fcaf7f86SDimitry Andric class Proj2 = identity, 948fcaf7f86SDimitry Andric indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>, 949fcaf7f86SDimitry Andric projected<iterator_t<R2>, Proj2>> Comp = ranges::less> 950fcaf7f86SDimitry Andric constexpr bool includes(R1&& r1, R2&& r2, Comp comp = {}, 95106c3fb27SDimitry Andric Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 95261cfbce3SDimitry Andric 95361cfbce3SDimitry Andric template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less, 95461cfbce3SDimitry Andric class Proj = identity> 95561cfbce3SDimitry Andric requires sortable<I, Comp, Proj> 95606c3fb27SDimitry Andric I inplace_merge(I first, I middle, S last, Comp comp = {}, Proj proj = {}); // since C++20 95761cfbce3SDimitry Andric 95861cfbce3SDimitry Andric template<bidirectional_range R, class Comp = ranges::less, class Proj = identity> 95961cfbce3SDimitry Andric requires sortable<iterator_t<R>, Comp, Proj> 96061cfbce3SDimitry Andric borrowed_iterator_t<R> 96161cfbce3SDimitry Andric inplace_merge(R&& r, iterator_t<R> middle, Comp comp = {}, 96206c3fb27SDimitry Andric Proj proj = {}); // since C++20 96361cfbce3SDimitry Andric 96461cfbce3SDimitry Andric template<permutable I, sentinel_for<I> S, class Proj = identity, 96561cfbce3SDimitry Andric indirect_equivalence_relation<projected<I, Proj>> C = ranges::equal_to> 96606c3fb27SDimitry Andric constexpr subrange<I> unique(I first, S last, C comp = {}, Proj proj = {}); // since C++20 96761cfbce3SDimitry Andric 96861cfbce3SDimitry Andric template<forward_range R, class Proj = identity, 96961cfbce3SDimitry Andric indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to> 97061cfbce3SDimitry Andric requires permutable<iterator_t<R>> 97161cfbce3SDimitry Andric constexpr borrowed_subrange_t<R> 97206c3fb27SDimitry Andric unique(R&& r, C comp = {}, Proj proj = {}); // since C++20 97361cfbce3SDimitry Andric 97461cfbce3SDimitry Andric template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Proj = identity, 97561cfbce3SDimitry Andric indirect_equivalence_relation<projected<I, Proj>> C = ranges::equal_to> 97661cfbce3SDimitry Andric requires indirectly_copyable<I, O> && 97761cfbce3SDimitry Andric (forward_iterator<I> || 97861cfbce3SDimitry Andric (input_iterator<O> && same_as<iter_value_t<I>, iter_value_t<O>>) || 97961cfbce3SDimitry Andric indirectly_copyable_storable<I, O>) 98061cfbce3SDimitry Andric constexpr unique_copy_result<I, O> 98106c3fb27SDimitry Andric unique_copy(I first, S last, O result, C comp = {}, Proj proj = {}); // since C++20 98261cfbce3SDimitry Andric 98361cfbce3SDimitry Andric template<input_range R, weakly_incrementable O, class Proj = identity, 98461cfbce3SDimitry Andric indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to> 98561cfbce3SDimitry Andric requires indirectly_copyable<iterator_t<R>, O> && 98661cfbce3SDimitry Andric (forward_iterator<iterator_t<R>> || 98761cfbce3SDimitry Andric (input_iterator<O> && same_as<range_value_t<R>, iter_value_t<O>>) || 98861cfbce3SDimitry Andric indirectly_copyable_storable<iterator_t<R>, O>) 98961cfbce3SDimitry Andric constexpr unique_copy_result<borrowed_iterator_t<R>, O> 99006c3fb27SDimitry Andric unique_copy(R&& r, O result, C comp = {}, Proj proj = {}); // since C++20 99161cfbce3SDimitry Andric 99261cfbce3SDimitry Andric template<class I, class O> 99306c3fb27SDimitry Andric using remove_copy_result = in_out_result<I, O>; // since C++20 99461cfbce3SDimitry Andric 99561cfbce3SDimitry Andric template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class T, 99661cfbce3SDimitry Andric class Proj = identity> 99761cfbce3SDimitry Andric indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*> 99861cfbce3SDimitry Andric constexpr remove_copy_result<I, O> 99906c3fb27SDimitry Andric remove_copy(I first, S last, O result, const T& value, Proj proj = {}); // since C++20 100061cfbce3SDimitry Andric 100161cfbce3SDimitry Andric template<input_range R, weakly_incrementable O, class T, class Proj = identity> 100261cfbce3SDimitry Andric requires indirectly_copyable<iterator_t<R>, O> && 100361cfbce3SDimitry Andric indirect_binary_predicate<ranges::equal_to, 100461cfbce3SDimitry Andric projected<iterator_t<R>, Proj>, const T*> 100561cfbce3SDimitry Andric constexpr remove_copy_result<borrowed_iterator_t<R>, O> 100606c3fb27SDimitry Andric remove_copy(R&& r, O result, const T& value, Proj proj = {}); // since C++20 100761cfbce3SDimitry Andric 100861cfbce3SDimitry Andric template<class I, class O> 100906c3fb27SDimitry Andric using remove_copy_if_result = in_out_result<I, O>; // since C++20 101061cfbce3SDimitry Andric 101161cfbce3SDimitry Andric template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, 101261cfbce3SDimitry Andric class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred> 101361cfbce3SDimitry Andric requires indirectly_copyable<I, O> 101461cfbce3SDimitry Andric constexpr remove_copy_if_result<I, O> 101506c3fb27SDimitry Andric remove_copy_if(I first, S last, O result, Pred pred, Proj proj = {}); // since C++20 101661cfbce3SDimitry Andric 101761cfbce3SDimitry Andric template<input_range R, weakly_incrementable O, class Proj = identity, 101861cfbce3SDimitry Andric indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> 101961cfbce3SDimitry Andric requires indirectly_copyable<iterator_t<R>, O> 102061cfbce3SDimitry Andric constexpr remove_copy_if_result<borrowed_iterator_t<R>, O> 102106c3fb27SDimitry Andric remove_copy_if(R&& r, O result, Pred pred, Proj proj = {}); // since C++20 102261cfbce3SDimitry Andric 102361cfbce3SDimitry Andric template<class I, class O> 102406c3fb27SDimitry Andric using replace_copy_result = in_out_result<I, O>; // since C++20 102561cfbce3SDimitry Andric 102661cfbce3SDimitry Andric template<input_iterator I, sentinel_for<I> S, class T1, class T2, 102761cfbce3SDimitry Andric output_iterator<const T2&> O, class Proj = identity> 102861cfbce3SDimitry Andric requires indirectly_copyable<I, O> && 102961cfbce3SDimitry Andric indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*> 103061cfbce3SDimitry Andric constexpr replace_copy_result<I, O> 103161cfbce3SDimitry Andric replace_copy(I first, S last, O result, const T1& old_value, const T2& new_value, 103206c3fb27SDimitry Andric Proj proj = {}); // since C++20 103361cfbce3SDimitry Andric 103461cfbce3SDimitry Andric template<input_range R, class T1, class T2, output_iterator<const T2&> O, 103561cfbce3SDimitry Andric class Proj = identity> 103661cfbce3SDimitry Andric requires indirectly_copyable<iterator_t<R>, O> && 103761cfbce3SDimitry Andric indirect_binary_predicate<ranges::equal_to, 103861cfbce3SDimitry Andric projected<iterator_t<R>, Proj>, const T1*> 103961cfbce3SDimitry Andric constexpr replace_copy_result<borrowed_iterator_t<R>, O> 104061cfbce3SDimitry Andric replace_copy(R&& r, O result, const T1& old_value, const T2& new_value, 104106c3fb27SDimitry Andric Proj proj = {}); // since C++20 104261cfbce3SDimitry Andric 104361cfbce3SDimitry Andric template<class I, class O> 104406c3fb27SDimitry Andric using replace_copy_if_result = in_out_result<I, O>; // since C++20 104561cfbce3SDimitry Andric 104661cfbce3SDimitry Andric template<input_iterator I, sentinel_for<I> S, class T, output_iterator<const T&> O, 104761cfbce3SDimitry Andric class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred> 104861cfbce3SDimitry Andric requires indirectly_copyable<I, O> 104961cfbce3SDimitry Andric constexpr replace_copy_if_result<I, O> 105061cfbce3SDimitry Andric replace_copy_if(I first, S last, O result, Pred pred, const T& new_value, 105106c3fb27SDimitry Andric Proj proj = {}); // since C++20 105261cfbce3SDimitry Andric 105361cfbce3SDimitry Andric template<input_range R, class T, output_iterator<const T&> O, class Proj = identity, 105461cfbce3SDimitry Andric indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> 105561cfbce3SDimitry Andric requires indirectly_copyable<iterator_t<R>, O> 105661cfbce3SDimitry Andric constexpr replace_copy_if_result<borrowed_iterator_t<R>, O> 105761cfbce3SDimitry Andric replace_copy_if(R&& r, O result, Pred pred, const T& new_value, 105806c3fb27SDimitry Andric Proj proj = {}); // since C++20 105961cfbce3SDimitry Andric 106061cfbce3SDimitry Andric template<class I> 106106c3fb27SDimitry Andric using prev_permutation_result = in_found_result<I>; // since C++20 106261cfbce3SDimitry Andric 106361cfbce3SDimitry Andric template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less, 106461cfbce3SDimitry Andric class Proj = identity> 106561cfbce3SDimitry Andric requires sortable<I, Comp, Proj> 106661cfbce3SDimitry Andric constexpr ranges::prev_permutation_result<I> 106706c3fb27SDimitry Andric ranges::prev_permutation(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 106861cfbce3SDimitry Andric 106961cfbce3SDimitry Andric template<bidirectional_range R, class Comp = ranges::less, 107061cfbce3SDimitry Andric class Proj = identity> 107161cfbce3SDimitry Andric requires sortable<iterator_t<R>, Comp, Proj> 107261cfbce3SDimitry Andric constexpr ranges::prev_permutation_result<borrowed_iterator_t<R>> 107306c3fb27SDimitry Andric ranges::prev_permutation(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 107461cfbce3SDimitry Andric 107561cfbce3SDimitry Andric template<class I> 107606c3fb27SDimitry Andric using next_permutation_result = in_found_result<I>; // since C++20 107761cfbce3SDimitry Andric 107861cfbce3SDimitry Andric template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less, 107961cfbce3SDimitry Andric class Proj = identity> 108061cfbce3SDimitry Andric requires sortable<I, Comp, Proj> 108161cfbce3SDimitry Andric constexpr ranges::next_permutation_result<I> 108206c3fb27SDimitry Andric ranges::next_permutation(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 108361cfbce3SDimitry Andric 108461cfbce3SDimitry Andric template<bidirectional_range R, class Comp = ranges::less, 108561cfbce3SDimitry Andric class Proj = identity> 108661cfbce3SDimitry Andric requires sortable<iterator_t<R>, Comp, Proj> 108761cfbce3SDimitry Andric constexpr ranges::next_permutation_result<borrowed_iterator_t<R>> 108806c3fb27SDimitry Andric ranges::next_permutation(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 108961cfbce3SDimitry Andric 109004eeddc0SDimitry Andric} 109104eeddc0SDimitry Andric 109261cfbce3SDimitry Andrictemplate <class InputIterator, class Predicate> 10930b57cec5SDimitry Andric constexpr bool // constexpr in C++20 10940b57cec5SDimitry Andric all_of(InputIterator first, InputIterator last, Predicate pred); 10950b57cec5SDimitry Andric 10960b57cec5SDimitry Andrictemplate <class InputIterator, class Predicate> 10970b57cec5SDimitry Andric constexpr bool // constexpr in C++20 10980b57cec5SDimitry Andric any_of(InputIterator first, InputIterator last, Predicate pred); 10990b57cec5SDimitry Andric 11000b57cec5SDimitry Andrictemplate <class InputIterator, class Predicate> 11010b57cec5SDimitry Andric constexpr bool // constexpr in C++20 11020b57cec5SDimitry Andric none_of(InputIterator first, InputIterator last, Predicate pred); 11030b57cec5SDimitry Andric 11040b57cec5SDimitry Andrictemplate <class InputIterator, class Function> 11050b57cec5SDimitry Andric constexpr Function // constexpr in C++20 11060b57cec5SDimitry Andric for_each(InputIterator first, InputIterator last, Function f); 11070b57cec5SDimitry Andric 11080b57cec5SDimitry Andrictemplate<class InputIterator, class Size, class Function> 11090b57cec5SDimitry Andric constexpr InputIterator // constexpr in C++20 11100b57cec5SDimitry Andric for_each_n(InputIterator first, Size n, Function f); // C++17 11110b57cec5SDimitry Andric 11120b57cec5SDimitry Andrictemplate <class InputIterator, class T> 11130b57cec5SDimitry Andric constexpr InputIterator // constexpr in C++20 11140b57cec5SDimitry Andric find(InputIterator first, InputIterator last, const T& value); 11150b57cec5SDimitry Andric 11160b57cec5SDimitry Andrictemplate <class InputIterator, class Predicate> 11170b57cec5SDimitry Andric constexpr InputIterator // constexpr in C++20 11180b57cec5SDimitry Andric find_if(InputIterator first, InputIterator last, Predicate pred); 11190b57cec5SDimitry Andric 11200b57cec5SDimitry Andrictemplate<class InputIterator, class Predicate> 1121e8d8bef9SDimitry Andric constexpr InputIterator // constexpr in C++20 11220b57cec5SDimitry Andric find_if_not(InputIterator first, InputIterator last, Predicate pred); 11230b57cec5SDimitry Andric 11240b57cec5SDimitry Andrictemplate <class ForwardIterator1, class ForwardIterator2> 1125e8d8bef9SDimitry Andric constexpr ForwardIterator1 // constexpr in C++20 11260b57cec5SDimitry Andric find_end(ForwardIterator1 first1, ForwardIterator1 last1, 11270b57cec5SDimitry Andric ForwardIterator2 first2, ForwardIterator2 last2); 11280b57cec5SDimitry Andric 11290b57cec5SDimitry Andrictemplate <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate> 1130e8d8bef9SDimitry Andric constexpr ForwardIterator1 // constexpr in C++20 11310b57cec5SDimitry Andric find_end(ForwardIterator1 first1, ForwardIterator1 last1, 11320b57cec5SDimitry Andric ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred); 11330b57cec5SDimitry Andric 11340b57cec5SDimitry Andrictemplate <class ForwardIterator1, class ForwardIterator2> 11350b57cec5SDimitry Andric constexpr ForwardIterator1 // constexpr in C++20 11360b57cec5SDimitry Andric find_first_of(ForwardIterator1 first1, ForwardIterator1 last1, 11370b57cec5SDimitry Andric ForwardIterator2 first2, ForwardIterator2 last2); 11380b57cec5SDimitry Andric 11390b57cec5SDimitry Andrictemplate <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate> 11400b57cec5SDimitry Andric constexpr ForwardIterator1 // constexpr in C++20 11410b57cec5SDimitry Andric find_first_of(ForwardIterator1 first1, ForwardIterator1 last1, 11420b57cec5SDimitry Andric ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred); 11430b57cec5SDimitry Andric 11440b57cec5SDimitry Andrictemplate <class ForwardIterator> 11450b57cec5SDimitry Andric constexpr ForwardIterator // constexpr in C++20 11460b57cec5SDimitry Andric adjacent_find(ForwardIterator first, ForwardIterator last); 11470b57cec5SDimitry Andric 11480b57cec5SDimitry Andrictemplate <class ForwardIterator, class BinaryPredicate> 11490b57cec5SDimitry Andric constexpr ForwardIterator // constexpr in C++20 11500b57cec5SDimitry Andric adjacent_find(ForwardIterator first, ForwardIterator last, BinaryPredicate pred); 11510b57cec5SDimitry Andric 11520b57cec5SDimitry Andrictemplate <class InputIterator, class T> 11530b57cec5SDimitry Andric constexpr typename iterator_traits<InputIterator>::difference_type // constexpr in C++20 11540b57cec5SDimitry Andric count(InputIterator first, InputIterator last, const T& value); 11550b57cec5SDimitry Andric 11560b57cec5SDimitry Andrictemplate <class InputIterator, class Predicate> 11570b57cec5SDimitry Andric constexpr typename iterator_traits<InputIterator>::difference_type // constexpr in C++20 11580b57cec5SDimitry Andric count_if(InputIterator first, InputIterator last, Predicate pred); 11590b57cec5SDimitry Andric 11600b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2> 11610b57cec5SDimitry Andric constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20 11620b57cec5SDimitry Andric mismatch(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2); 11630b57cec5SDimitry Andric 11640b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2> 11650b57cec5SDimitry Andric constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20 11660b57cec5SDimitry Andric mismatch(InputIterator1 first1, InputIterator1 last1, 11670b57cec5SDimitry Andric InputIterator2 first2, InputIterator2 last2); // **C++14** 11680b57cec5SDimitry Andric 11690b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class BinaryPredicate> 11700b57cec5SDimitry Andric constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20 11710b57cec5SDimitry Andric mismatch(InputIterator1 first1, InputIterator1 last1, 11720b57cec5SDimitry Andric InputIterator2 first2, BinaryPredicate pred); 11730b57cec5SDimitry Andric 11740b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class BinaryPredicate> 11750b57cec5SDimitry Andric constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20 11760b57cec5SDimitry Andric mismatch(InputIterator1 first1, InputIterator1 last1, 11770b57cec5SDimitry Andric InputIterator2 first2, InputIterator2 last2, 11780b57cec5SDimitry Andric BinaryPredicate pred); // **C++14** 11790b57cec5SDimitry Andric 11800b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2> 11810b57cec5SDimitry Andric constexpr bool // constexpr in C++20 11820b57cec5SDimitry Andric equal(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2); 11830b57cec5SDimitry Andric 11840b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2> 11850b57cec5SDimitry Andric constexpr bool // constexpr in C++20 11860b57cec5SDimitry Andric equal(InputIterator1 first1, InputIterator1 last1, 11870b57cec5SDimitry Andric InputIterator2 first2, InputIterator2 last2); // **C++14** 11880b57cec5SDimitry Andric 11890b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class BinaryPredicate> 11900b57cec5SDimitry Andric constexpr bool // constexpr in C++20 11910b57cec5SDimitry Andric equal(InputIterator1 first1, InputIterator1 last1, 11920b57cec5SDimitry Andric InputIterator2 first2, BinaryPredicate pred); 11930b57cec5SDimitry Andric 11940b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class BinaryPredicate> 11950b57cec5SDimitry Andric constexpr bool // constexpr in C++20 11960b57cec5SDimitry Andric equal(InputIterator1 first1, InputIterator1 last1, 11970b57cec5SDimitry Andric InputIterator2 first2, InputIterator2 last2, 11980b57cec5SDimitry Andric BinaryPredicate pred); // **C++14** 11990b57cec5SDimitry Andric 12000b57cec5SDimitry Andrictemplate<class ForwardIterator1, class ForwardIterator2> 12010b57cec5SDimitry Andric constexpr bool // constexpr in C++20 12020b57cec5SDimitry Andric is_permutation(ForwardIterator1 first1, ForwardIterator1 last1, 12030b57cec5SDimitry Andric ForwardIterator2 first2); 12040b57cec5SDimitry Andric 12050b57cec5SDimitry Andrictemplate<class ForwardIterator1, class ForwardIterator2> 12060b57cec5SDimitry Andric constexpr bool // constexpr in C++20 12070b57cec5SDimitry Andric is_permutation(ForwardIterator1 first1, ForwardIterator1 last1, 12080b57cec5SDimitry Andric ForwardIterator2 first2, ForwardIterator2 last2); // **C++14** 12090b57cec5SDimitry Andric 12100b57cec5SDimitry Andrictemplate<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate> 12110b57cec5SDimitry Andric constexpr bool // constexpr in C++20 12120b57cec5SDimitry Andric is_permutation(ForwardIterator1 first1, ForwardIterator1 last1, 12130b57cec5SDimitry Andric ForwardIterator2 first2, BinaryPredicate pred); 12140b57cec5SDimitry Andric 12150b57cec5SDimitry Andrictemplate<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate> 12160b57cec5SDimitry Andric constexpr bool // constexpr in C++20 12170b57cec5SDimitry Andric is_permutation(ForwardIterator1 first1, ForwardIterator1 last1, 12180b57cec5SDimitry Andric ForwardIterator2 first2, ForwardIterator2 last2, 12190b57cec5SDimitry Andric BinaryPredicate pred); // **C++14** 12200b57cec5SDimitry Andric 12210b57cec5SDimitry Andrictemplate <class ForwardIterator1, class ForwardIterator2> 12220b57cec5SDimitry Andric constexpr ForwardIterator1 // constexpr in C++20 12230b57cec5SDimitry Andric search(ForwardIterator1 first1, ForwardIterator1 last1, 12240b57cec5SDimitry Andric ForwardIterator2 first2, ForwardIterator2 last2); 12250b57cec5SDimitry Andric 12260b57cec5SDimitry Andrictemplate <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate> 12270b57cec5SDimitry Andric constexpr ForwardIterator1 // constexpr in C++20 12280b57cec5SDimitry Andric search(ForwardIterator1 first1, ForwardIterator1 last1, 12290b57cec5SDimitry Andric ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred); 12300b57cec5SDimitry Andric 12310b57cec5SDimitry Andrictemplate <class ForwardIterator, class Size, class T> 12320b57cec5SDimitry Andric constexpr ForwardIterator // constexpr in C++20 12330b57cec5SDimitry Andric search_n(ForwardIterator first, ForwardIterator last, Size count, const T& value); 12340b57cec5SDimitry Andric 12350b57cec5SDimitry Andrictemplate <class ForwardIterator, class Size, class T, class BinaryPredicate> 12360b57cec5SDimitry Andric constexpr ForwardIterator // constexpr in C++20 12370b57cec5SDimitry Andric search_n(ForwardIterator first, ForwardIterator last, 12380b57cec5SDimitry Andric Size count, const T& value, BinaryPredicate pred); 12390b57cec5SDimitry Andric 12400b57cec5SDimitry Andrictemplate <class InputIterator, class OutputIterator> 1241480093f4SDimitry Andric constexpr OutputIterator // constexpr in C++20 12420b57cec5SDimitry Andric copy(InputIterator first, InputIterator last, OutputIterator result); 12430b57cec5SDimitry Andric 12440b57cec5SDimitry Andrictemplate<class InputIterator, class OutputIterator, class Predicate> 1245480093f4SDimitry Andric constexpr OutputIterator // constexpr in C++20 12460b57cec5SDimitry Andric copy_if(InputIterator first, InputIterator last, 12470b57cec5SDimitry Andric OutputIterator result, Predicate pred); 12480b57cec5SDimitry Andric 12490b57cec5SDimitry Andrictemplate<class InputIterator, class Size, class OutputIterator> 1250480093f4SDimitry Andric constexpr OutputIterator // constexpr in C++20 12510b57cec5SDimitry Andric copy_n(InputIterator first, Size n, OutputIterator result); 12520b57cec5SDimitry Andric 12530b57cec5SDimitry Andrictemplate <class BidirectionalIterator1, class BidirectionalIterator2> 1254480093f4SDimitry Andric constexpr BidirectionalIterator2 // constexpr in C++20 12550b57cec5SDimitry Andric copy_backward(BidirectionalIterator1 first, BidirectionalIterator1 last, 12560b57cec5SDimitry Andric BidirectionalIterator2 result); 12570b57cec5SDimitry Andric 125881ad6265SDimitry Andric// [alg.move], move 125981ad6265SDimitry Andrictemplate<class InputIterator, class OutputIterator> 126081ad6265SDimitry Andric constexpr OutputIterator move(InputIterator first, InputIterator last, 126181ad6265SDimitry Andric OutputIterator result); 126281ad6265SDimitry Andric 126381ad6265SDimitry Andrictemplate<class BidirectionalIterator1, class BidirectionalIterator2> 126481ad6265SDimitry Andric constexpr BidirectionalIterator2 126581ad6265SDimitry Andric move_backward(BidirectionalIterator1 first, BidirectionalIterator1 last, 126681ad6265SDimitry Andric BidirectionalIterator2 result); 126781ad6265SDimitry Andric 12680b57cec5SDimitry Andrictemplate <class ForwardIterator1, class ForwardIterator2> 1269e8d8bef9SDimitry Andric constexpr ForwardIterator2 // constexpr in C++20 12700b57cec5SDimitry Andric swap_ranges(ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2); 12710b57cec5SDimitry Andric 127281ad6265SDimitry Andricnamespace ranges { 127381ad6265SDimitry Andric template<class I1, class I2> 127481ad6265SDimitry Andric using swap_ranges_result = in_in_result<I1, I2>; 127581ad6265SDimitry Andric 127681ad6265SDimitry Andrictemplate<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2> 127781ad6265SDimitry Andric requires indirectly_swappable<I1, I2> 127881ad6265SDimitry Andric constexpr ranges::swap_ranges_result<I1, I2> 127981ad6265SDimitry Andric swap_ranges(I1 first1, S1 last1, I2 first2, S2 last2); 128081ad6265SDimitry Andric 128181ad6265SDimitry Andrictemplate<input_range R1, input_range R2> 128281ad6265SDimitry Andric requires indirectly_swappable<iterator_t<R1>, iterator_t<R2>> 128381ad6265SDimitry Andric constexpr ranges::swap_ranges_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>> 128481ad6265SDimitry Andric swap_ranges(R1&& r1, R2&& r2); 128581ad6265SDimitry Andric} 128681ad6265SDimitry Andric 12870b57cec5SDimitry Andrictemplate <class ForwardIterator1, class ForwardIterator2> 1288e8d8bef9SDimitry Andric constexpr void // constexpr in C++20 12890b57cec5SDimitry Andric iter_swap(ForwardIterator1 a, ForwardIterator2 b); 12900b57cec5SDimitry Andric 12910b57cec5SDimitry Andrictemplate <class InputIterator, class OutputIterator, class UnaryOperation> 12920b57cec5SDimitry Andric constexpr OutputIterator // constexpr in C++20 12930b57cec5SDimitry Andric transform(InputIterator first, InputIterator last, OutputIterator result, UnaryOperation op); 12940b57cec5SDimitry Andric 12950b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator, class BinaryOperation> 12960b57cec5SDimitry Andric constexpr OutputIterator // constexpr in C++20 12970b57cec5SDimitry Andric transform(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, 12980b57cec5SDimitry Andric OutputIterator result, BinaryOperation binary_op); 12990b57cec5SDimitry Andric 13000b57cec5SDimitry Andrictemplate <class ForwardIterator, class T> 13010b57cec5SDimitry Andric constexpr void // constexpr in C++20 13020b57cec5SDimitry Andric replace(ForwardIterator first, ForwardIterator last, const T& old_value, const T& new_value); 13030b57cec5SDimitry Andric 13040b57cec5SDimitry Andrictemplate <class ForwardIterator, class Predicate, class T> 13050b57cec5SDimitry Andric constexpr void // constexpr in C++20 13060b57cec5SDimitry Andric replace_if(ForwardIterator first, ForwardIterator last, Predicate pred, const T& new_value); 13070b57cec5SDimitry Andric 13080b57cec5SDimitry Andrictemplate <class InputIterator, class OutputIterator, class T> 13090b57cec5SDimitry Andric constexpr OutputIterator // constexpr in C++20 13100b57cec5SDimitry Andric replace_copy(InputIterator first, InputIterator last, OutputIterator result, 13110b57cec5SDimitry Andric const T& old_value, const T& new_value); 13120b57cec5SDimitry Andric 13130b57cec5SDimitry Andrictemplate <class InputIterator, class OutputIterator, class Predicate, class T> 13140b57cec5SDimitry Andric constexpr OutputIterator // constexpr in C++20 13150b57cec5SDimitry Andric replace_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred, const T& new_value); 13160b57cec5SDimitry Andric 13170b57cec5SDimitry Andrictemplate <class ForwardIterator, class T> 13180b57cec5SDimitry Andric constexpr void // constexpr in C++20 13190b57cec5SDimitry Andric fill(ForwardIterator first, ForwardIterator last, const T& value); 13200b57cec5SDimitry Andric 13210b57cec5SDimitry Andrictemplate <class OutputIterator, class Size, class T> 13220b57cec5SDimitry Andric constexpr OutputIterator // constexpr in C++20 13230b57cec5SDimitry Andric fill_n(OutputIterator first, Size n, const T& value); 13240b57cec5SDimitry Andric 13250b57cec5SDimitry Andrictemplate <class ForwardIterator, class Generator> 13260b57cec5SDimitry Andric constexpr void // constexpr in C++20 13270b57cec5SDimitry Andric generate(ForwardIterator first, ForwardIterator last, Generator gen); 13280b57cec5SDimitry Andric 13290b57cec5SDimitry Andrictemplate <class OutputIterator, class Size, class Generator> 13300b57cec5SDimitry Andric constexpr OutputIterator // constexpr in C++20 13310b57cec5SDimitry Andric generate_n(OutputIterator first, Size n, Generator gen); 13320b57cec5SDimitry Andric 13330b57cec5SDimitry Andrictemplate <class ForwardIterator, class T> 13340b57cec5SDimitry Andric constexpr ForwardIterator // constexpr in C++20 13350b57cec5SDimitry Andric remove(ForwardIterator first, ForwardIterator last, const T& value); 13360b57cec5SDimitry Andric 13370b57cec5SDimitry Andrictemplate <class ForwardIterator, class Predicate> 13380b57cec5SDimitry Andric constexpr ForwardIterator // constexpr in C++20 13390b57cec5SDimitry Andric remove_if(ForwardIterator first, ForwardIterator last, Predicate pred); 13400b57cec5SDimitry Andric 13410b57cec5SDimitry Andrictemplate <class InputIterator, class OutputIterator, class T> 13420b57cec5SDimitry Andric constexpr OutputIterator // constexpr in C++20 13430b57cec5SDimitry Andric remove_copy(InputIterator first, InputIterator last, OutputIterator result, const T& value); 13440b57cec5SDimitry Andric 13450b57cec5SDimitry Andrictemplate <class InputIterator, class OutputIterator, class Predicate> 13460b57cec5SDimitry Andric constexpr OutputIterator // constexpr in C++20 13470b57cec5SDimitry Andric remove_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred); 13480b57cec5SDimitry Andric 13490b57cec5SDimitry Andrictemplate <class ForwardIterator> 1350e8d8bef9SDimitry Andric constexpr ForwardIterator // constexpr in C++20 13510b57cec5SDimitry Andric unique(ForwardIterator first, ForwardIterator last); 13520b57cec5SDimitry Andric 13530b57cec5SDimitry Andrictemplate <class ForwardIterator, class BinaryPredicate> 1354e8d8bef9SDimitry Andric constexpr ForwardIterator // constexpr in C++20 13550b57cec5SDimitry Andric unique(ForwardIterator first, ForwardIterator last, BinaryPredicate pred); 13560b57cec5SDimitry Andric 13570b57cec5SDimitry Andrictemplate <class InputIterator, class OutputIterator> 1358e8d8bef9SDimitry Andric constexpr OutputIterator // constexpr in C++20 13590b57cec5SDimitry Andric unique_copy(InputIterator first, InputIterator last, OutputIterator result); 13600b57cec5SDimitry Andric 13610b57cec5SDimitry Andrictemplate <class InputIterator, class OutputIterator, class BinaryPredicate> 1362e8d8bef9SDimitry Andric constexpr OutputIterator // constexpr in C++20 13630b57cec5SDimitry Andric unique_copy(InputIterator first, InputIterator last, OutputIterator result, BinaryPredicate pred); 13640b57cec5SDimitry Andric 13650b57cec5SDimitry Andrictemplate <class BidirectionalIterator> 1366e8d8bef9SDimitry Andric constexpr void // constexpr in C++20 13670b57cec5SDimitry Andric reverse(BidirectionalIterator first, BidirectionalIterator last); 13680b57cec5SDimitry Andric 13690b57cec5SDimitry Andrictemplate <class BidirectionalIterator, class OutputIterator> 13700b57cec5SDimitry Andric constexpr OutputIterator // constexpr in C++20 13710b57cec5SDimitry Andric reverse_copy(BidirectionalIterator first, BidirectionalIterator last, OutputIterator result); 13720b57cec5SDimitry Andric 13730b57cec5SDimitry Andrictemplate <class ForwardIterator> 1374e8d8bef9SDimitry Andric constexpr ForwardIterator // constexpr in C++20 13750b57cec5SDimitry Andric rotate(ForwardIterator first, ForwardIterator middle, ForwardIterator last); 13760b57cec5SDimitry Andric 13770b57cec5SDimitry Andrictemplate <class ForwardIterator, class OutputIterator> 1378e8d8bef9SDimitry Andric constexpr OutputIterator // constexpr in C++20 13790b57cec5SDimitry Andric rotate_copy(ForwardIterator first, ForwardIterator middle, ForwardIterator last, OutputIterator result); 13800b57cec5SDimitry Andric 13810b57cec5SDimitry Andrictemplate <class RandomAccessIterator> 13820b57cec5SDimitry Andric void 13830b57cec5SDimitry Andric random_shuffle(RandomAccessIterator first, RandomAccessIterator last); // deprecated in C++14, removed in C++17 13840b57cec5SDimitry Andric 13850b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class RandomNumberGenerator> 13860b57cec5SDimitry Andric void 13870b57cec5SDimitry Andric random_shuffle(RandomAccessIterator first, RandomAccessIterator last, 13880b57cec5SDimitry Andric RandomNumberGenerator& rand); // deprecated in C++14, removed in C++17 13890b57cec5SDimitry Andric 13900b57cec5SDimitry Andrictemplate<class PopulationIterator, class SampleIterator, 13910b57cec5SDimitry Andric class Distance, class UniformRandomBitGenerator> 13920b57cec5SDimitry Andric SampleIterator sample(PopulationIterator first, PopulationIterator last, 13930b57cec5SDimitry Andric SampleIterator out, Distance n, 13940b57cec5SDimitry Andric UniformRandomBitGenerator&& g); // C++17 13950b57cec5SDimitry Andric 13960b57cec5SDimitry Andrictemplate<class RandomAccessIterator, class UniformRandomNumberGenerator> 13970b57cec5SDimitry Andric void shuffle(RandomAccessIterator first, RandomAccessIterator last, 13980b57cec5SDimitry Andric UniformRandomNumberGenerator&& g); 13990b57cec5SDimitry Andric 1400e8d8bef9SDimitry Andrictemplate<class ForwardIterator> 1401e8d8bef9SDimitry Andric constexpr ForwardIterator 1402e8d8bef9SDimitry Andric shift_left(ForwardIterator first, ForwardIterator last, 1403e8d8bef9SDimitry Andric typename iterator_traits<ForwardIterator>::difference_type n); // C++20 1404e8d8bef9SDimitry Andric 1405e8d8bef9SDimitry Andrictemplate<class ForwardIterator> 1406e8d8bef9SDimitry Andric constexpr ForwardIterator 1407e8d8bef9SDimitry Andric shift_right(ForwardIterator first, ForwardIterator last, 1408e8d8bef9SDimitry Andric typename iterator_traits<ForwardIterator>::difference_type n); // C++20 1409e8d8bef9SDimitry Andric 14100b57cec5SDimitry Andrictemplate <class InputIterator, class Predicate> 14110b57cec5SDimitry Andric constexpr bool // constexpr in C++20 14120b57cec5SDimitry Andric is_partitioned(InputIterator first, InputIterator last, Predicate pred); 14130b57cec5SDimitry Andric 14140b57cec5SDimitry Andrictemplate <class ForwardIterator, class Predicate> 1415e8d8bef9SDimitry Andric constexpr ForwardIterator // constexpr in C++20 14160b57cec5SDimitry Andric partition(ForwardIterator first, ForwardIterator last, Predicate pred); 14170b57cec5SDimitry Andric 14180b57cec5SDimitry Andrictemplate <class InputIterator, class OutputIterator1, 14190b57cec5SDimitry Andric class OutputIterator2, class Predicate> 14200b57cec5SDimitry Andric constexpr pair<OutputIterator1, OutputIterator2> // constexpr in C++20 14210b57cec5SDimitry Andric partition_copy(InputIterator first, InputIterator last, 14220b57cec5SDimitry Andric OutputIterator1 out_true, OutputIterator2 out_false, 14230b57cec5SDimitry Andric Predicate pred); 14240b57cec5SDimitry Andric 14250b57cec5SDimitry Andrictemplate <class ForwardIterator, class Predicate> 14260b57cec5SDimitry Andric ForwardIterator 14270b57cec5SDimitry Andric stable_partition(ForwardIterator first, ForwardIterator last, Predicate pred); 14280b57cec5SDimitry Andric 14290b57cec5SDimitry Andrictemplate<class ForwardIterator, class Predicate> 14300b57cec5SDimitry Andric constexpr ForwardIterator // constexpr in C++20 14310b57cec5SDimitry Andric partition_point(ForwardIterator first, ForwardIterator last, Predicate pred); 14320b57cec5SDimitry Andric 14330b57cec5SDimitry Andrictemplate <class ForwardIterator> 14340b57cec5SDimitry Andric constexpr bool // constexpr in C++20 14350b57cec5SDimitry Andric is_sorted(ForwardIterator first, ForwardIterator last); 14360b57cec5SDimitry Andric 14370b57cec5SDimitry Andrictemplate <class ForwardIterator, class Compare> 1438e8d8bef9SDimitry Andric constexpr bool // constexpr in C++20 14390b57cec5SDimitry Andric is_sorted(ForwardIterator first, ForwardIterator last, Compare comp); 14400b57cec5SDimitry Andric 14410b57cec5SDimitry Andrictemplate<class ForwardIterator> 14420b57cec5SDimitry Andric constexpr ForwardIterator // constexpr in C++20 14430b57cec5SDimitry Andric is_sorted_until(ForwardIterator first, ForwardIterator last); 14440b57cec5SDimitry Andric 14450b57cec5SDimitry Andrictemplate <class ForwardIterator, class Compare> 14460b57cec5SDimitry Andric constexpr ForwardIterator // constexpr in C++20 14470b57cec5SDimitry Andric is_sorted_until(ForwardIterator first, ForwardIterator last, Compare comp); 14480b57cec5SDimitry Andric 14490b57cec5SDimitry Andrictemplate <class RandomAccessIterator> 1450fe6060f1SDimitry Andric constexpr void // constexpr in C++20 14510b57cec5SDimitry Andric sort(RandomAccessIterator first, RandomAccessIterator last); 14520b57cec5SDimitry Andric 14530b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class Compare> 1454fe6060f1SDimitry Andric constexpr void // constexpr in C++20 14550b57cec5SDimitry Andric sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp); 14560b57cec5SDimitry Andric 14570b57cec5SDimitry Andrictemplate <class RandomAccessIterator> 14580b57cec5SDimitry Andric void 14590b57cec5SDimitry Andric stable_sort(RandomAccessIterator first, RandomAccessIterator last); 14600b57cec5SDimitry Andric 14610b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class Compare> 14620b57cec5SDimitry Andric void 14630b57cec5SDimitry Andric stable_sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp); 14640b57cec5SDimitry Andric 14650b57cec5SDimitry Andrictemplate <class RandomAccessIterator> 1466fe6060f1SDimitry Andric constexpr void // constexpr in C++20 14670b57cec5SDimitry Andric partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last); 14680b57cec5SDimitry Andric 14690b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class Compare> 1470fe6060f1SDimitry Andric constexpr void // constexpr in C++20 14710b57cec5SDimitry Andric partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last, Compare comp); 14720b57cec5SDimitry Andric 14730b57cec5SDimitry Andrictemplate <class InputIterator, class RandomAccessIterator> 1474fe6060f1SDimitry Andric constexpr RandomAccessIterator // constexpr in C++20 14750b57cec5SDimitry Andric partial_sort_copy(InputIterator first, InputIterator last, 14760b57cec5SDimitry Andric RandomAccessIterator result_first, RandomAccessIterator result_last); 14770b57cec5SDimitry Andric 14780b57cec5SDimitry Andrictemplate <class InputIterator, class RandomAccessIterator, class Compare> 1479fe6060f1SDimitry Andric constexpr RandomAccessIterator // constexpr in C++20 14800b57cec5SDimitry Andric partial_sort_copy(InputIterator first, InputIterator last, 14810b57cec5SDimitry Andric RandomAccessIterator result_first, RandomAccessIterator result_last, Compare comp); 14820b57cec5SDimitry Andric 14830b57cec5SDimitry Andrictemplate <class RandomAccessIterator> 1484fe6060f1SDimitry Andric constexpr void // constexpr in C++20 14850b57cec5SDimitry Andric nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last); 14860b57cec5SDimitry Andric 14870b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class Compare> 1488fe6060f1SDimitry Andric constexpr void // constexpr in C++20 14890b57cec5SDimitry Andric nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last, Compare comp); 14900b57cec5SDimitry Andric 14910b57cec5SDimitry Andrictemplate <class ForwardIterator, class T> 14920b57cec5SDimitry Andric constexpr ForwardIterator // constexpr in C++20 14930b57cec5SDimitry Andric lower_bound(ForwardIterator first, ForwardIterator last, const T& value); 14940b57cec5SDimitry Andric 14950b57cec5SDimitry Andrictemplate <class ForwardIterator, class T, class Compare> 14960b57cec5SDimitry Andric constexpr ForwardIterator // constexpr in C++20 14970b57cec5SDimitry Andric lower_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp); 14980b57cec5SDimitry Andric 14990b57cec5SDimitry Andrictemplate <class ForwardIterator, class T> 15000b57cec5SDimitry Andric constexpr ForwardIterator // constexpr in C++20 15010b57cec5SDimitry Andric upper_bound(ForwardIterator first, ForwardIterator last, const T& value); 15020b57cec5SDimitry Andric 15030b57cec5SDimitry Andrictemplate <class ForwardIterator, class T, class Compare> 15040b57cec5SDimitry Andric constexpr ForwardIterator // constexpr in C++20 15050b57cec5SDimitry Andric upper_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp); 15060b57cec5SDimitry Andric 15070b57cec5SDimitry Andrictemplate <class ForwardIterator, class T> 15080b57cec5SDimitry Andric constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++20 15090b57cec5SDimitry Andric equal_range(ForwardIterator first, ForwardIterator last, const T& value); 15100b57cec5SDimitry Andric 15110b57cec5SDimitry Andrictemplate <class ForwardIterator, class T, class Compare> 15120b57cec5SDimitry Andric constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++20 15130b57cec5SDimitry Andric equal_range(ForwardIterator first, ForwardIterator last, const T& value, Compare comp); 15140b57cec5SDimitry Andric 15150b57cec5SDimitry Andrictemplate <class ForwardIterator, class T> 15160b57cec5SDimitry Andric constexpr bool // constexpr in C++20 15170b57cec5SDimitry Andric binary_search(ForwardIterator first, ForwardIterator last, const T& value); 15180b57cec5SDimitry Andric 15190b57cec5SDimitry Andrictemplate <class ForwardIterator, class T, class Compare> 15200b57cec5SDimitry Andric constexpr bool // constexpr in C++20 15210b57cec5SDimitry Andric binary_search(ForwardIterator first, ForwardIterator last, const T& value, Compare comp); 15220b57cec5SDimitry Andric 15230b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator> 1524e8d8bef9SDimitry Andric constexpr OutputIterator // constexpr in C++20 15250b57cec5SDimitry Andric merge(InputIterator1 first1, InputIterator1 last1, 15260b57cec5SDimitry Andric InputIterator2 first2, InputIterator2 last2, OutputIterator result); 15270b57cec5SDimitry Andric 15280b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator, class Compare> 1529e8d8bef9SDimitry Andric constexpr OutputIterator // constexpr in C++20 15300b57cec5SDimitry Andric merge(InputIterator1 first1, InputIterator1 last1, 15310b57cec5SDimitry Andric InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp); 15320b57cec5SDimitry Andric 15330b57cec5SDimitry Andrictemplate <class BidirectionalIterator> 15340b57cec5SDimitry Andric void 15350b57cec5SDimitry Andric inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last); 15360b57cec5SDimitry Andric 15370b57cec5SDimitry Andrictemplate <class BidirectionalIterator, class Compare> 15380b57cec5SDimitry Andric void 15390b57cec5SDimitry Andric inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last, Compare comp); 15400b57cec5SDimitry Andric 15410b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2> 15420b57cec5SDimitry Andric constexpr bool // constexpr in C++20 15430b57cec5SDimitry Andric includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2); 15440b57cec5SDimitry Andric 15450b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class Compare> 15460b57cec5SDimitry Andric constexpr bool // constexpr in C++20 15470b57cec5SDimitry Andric includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, Compare comp); 15480b57cec5SDimitry Andric 15490b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator> 1550e8d8bef9SDimitry Andric constexpr OutputIterator // constexpr in C++20 15510b57cec5SDimitry Andric set_union(InputIterator1 first1, InputIterator1 last1, 15520b57cec5SDimitry Andric InputIterator2 first2, InputIterator2 last2, OutputIterator result); 15530b57cec5SDimitry Andric 15540b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator, class Compare> 1555e8d8bef9SDimitry Andric constexpr OutputIterator // constexpr in C++20 15560b57cec5SDimitry Andric set_union(InputIterator1 first1, InputIterator1 last1, 15570b57cec5SDimitry Andric InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp); 15580b57cec5SDimitry Andric 15590b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator> 15600b57cec5SDimitry Andric constexpr OutputIterator // constexpr in C++20 15610b57cec5SDimitry Andric set_intersection(InputIterator1 first1, InputIterator1 last1, 15620b57cec5SDimitry Andric InputIterator2 first2, InputIterator2 last2, OutputIterator result); 15630b57cec5SDimitry Andric 15640b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator, class Compare> 15650b57cec5SDimitry Andric constexpr OutputIterator // constexpr in C++20 15660b57cec5SDimitry Andric set_intersection(InputIterator1 first1, InputIterator1 last1, 15670b57cec5SDimitry Andric InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp); 15680b57cec5SDimitry Andric 15690b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator> 1570e8d8bef9SDimitry Andric constexpr OutputIterator // constexpr in C++20 15710b57cec5SDimitry Andric set_difference(InputIterator1 first1, InputIterator1 last1, 15720b57cec5SDimitry Andric InputIterator2 first2, InputIterator2 last2, OutputIterator result); 15730b57cec5SDimitry Andric 15740b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator, class Compare> 1575e8d8bef9SDimitry Andric constexpr OutputIterator // constexpr in C++20 15760b57cec5SDimitry Andric set_difference(InputIterator1 first1, InputIterator1 last1, 15770b57cec5SDimitry Andric InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp); 15780b57cec5SDimitry Andric 15790b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator> 1580e8d8bef9SDimitry Andric constexpr OutputIterator // constexpr in C++20 15810b57cec5SDimitry Andric set_symmetric_difference(InputIterator1 first1, InputIterator1 last1, 15820b57cec5SDimitry Andric InputIterator2 first2, InputIterator2 last2, OutputIterator result); 15830b57cec5SDimitry Andric 15840b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator, class Compare> 1585e8d8bef9SDimitry Andric constexpr OutputIterator // constexpr in C++20 15860b57cec5SDimitry Andric set_symmetric_difference(InputIterator1 first1, InputIterator1 last1, 15870b57cec5SDimitry Andric InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp); 15880b57cec5SDimitry Andric 15890b57cec5SDimitry Andrictemplate <class RandomAccessIterator> 1590fe6060f1SDimitry Andric constexpr void // constexpr in C++20 15910b57cec5SDimitry Andric push_heap(RandomAccessIterator first, RandomAccessIterator last); 15920b57cec5SDimitry Andric 15930b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class Compare> 1594fe6060f1SDimitry Andric constexpr void // constexpr in C++20 15950b57cec5SDimitry Andric push_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp); 15960b57cec5SDimitry Andric 15970b57cec5SDimitry Andrictemplate <class RandomAccessIterator> 1598fe6060f1SDimitry Andric constexpr void // constexpr in C++20 15990b57cec5SDimitry Andric pop_heap(RandomAccessIterator first, RandomAccessIterator last); 16000b57cec5SDimitry Andric 16010b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class Compare> 1602fe6060f1SDimitry Andric constexpr void // constexpr in C++20 16030b57cec5SDimitry Andric pop_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp); 16040b57cec5SDimitry Andric 16050b57cec5SDimitry Andrictemplate <class RandomAccessIterator> 1606fe6060f1SDimitry Andric constexpr void // constexpr in C++20 16070b57cec5SDimitry Andric make_heap(RandomAccessIterator first, RandomAccessIterator last); 16080b57cec5SDimitry Andric 16090b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class Compare> 1610fe6060f1SDimitry Andric constexpr void // constexpr in C++20 16110b57cec5SDimitry Andric make_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp); 16120b57cec5SDimitry Andric 16130b57cec5SDimitry Andrictemplate <class RandomAccessIterator> 1614fe6060f1SDimitry Andric constexpr void // constexpr in C++20 16150b57cec5SDimitry Andric sort_heap(RandomAccessIterator first, RandomAccessIterator last); 16160b57cec5SDimitry Andric 16170b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class Compare> 1618fe6060f1SDimitry Andric constexpr void // constexpr in C++20 16190b57cec5SDimitry Andric sort_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp); 16200b57cec5SDimitry Andric 16210b57cec5SDimitry Andrictemplate <class RandomAccessIterator> 16220b57cec5SDimitry Andric constexpr bool // constexpr in C++20 16230b57cec5SDimitry Andric is_heap(RandomAccessIterator first, RandomAccessiterator last); 16240b57cec5SDimitry Andric 16250b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class Compare> 16260b57cec5SDimitry Andric constexpr bool // constexpr in C++20 16270b57cec5SDimitry Andric is_heap(RandomAccessIterator first, RandomAccessiterator last, Compare comp); 16280b57cec5SDimitry Andric 16290b57cec5SDimitry Andrictemplate <class RandomAccessIterator> 16300b57cec5SDimitry Andric constexpr RandomAccessIterator // constexpr in C++20 16310b57cec5SDimitry Andric is_heap_until(RandomAccessIterator first, RandomAccessiterator last); 16320b57cec5SDimitry Andric 16330b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class Compare> 16340b57cec5SDimitry Andric constexpr RandomAccessIterator // constexpr in C++20 16350b57cec5SDimitry Andric is_heap_until(RandomAccessIterator first, RandomAccessiterator last, Compare comp); 16360b57cec5SDimitry Andric 16370b57cec5SDimitry Andrictemplate <class ForwardIterator> 1638e8d8bef9SDimitry Andric constexpr ForwardIterator // constexpr in C++14 1639e8d8bef9SDimitry Andric min_element(ForwardIterator first, ForwardIterator last); 16400b57cec5SDimitry Andric 16410b57cec5SDimitry Andrictemplate <class ForwardIterator, class Compare> 1642e8d8bef9SDimitry Andric constexpr ForwardIterator // constexpr in C++14 1643e8d8bef9SDimitry Andric min_element(ForwardIterator first, ForwardIterator last, Compare comp); 16440b57cec5SDimitry Andric 16450b57cec5SDimitry Andrictemplate <class T> 1646e8d8bef9SDimitry Andric constexpr const T& // constexpr in C++14 1647e8d8bef9SDimitry Andric min(const T& a, const T& b); 16480b57cec5SDimitry Andric 16490b57cec5SDimitry Andrictemplate <class T, class Compare> 1650e8d8bef9SDimitry Andric constexpr const T& // constexpr in C++14 1651e8d8bef9SDimitry Andric min(const T& a, const T& b, Compare comp); 16520b57cec5SDimitry Andric 16530b57cec5SDimitry Andrictemplate<class T> 1654e8d8bef9SDimitry Andric constexpr T // constexpr in C++14 1655e8d8bef9SDimitry Andric min(initializer_list<T> t); 16560b57cec5SDimitry Andric 16570b57cec5SDimitry Andrictemplate<class T, class Compare> 1658e8d8bef9SDimitry Andric constexpr T // constexpr in C++14 1659e8d8bef9SDimitry Andric min(initializer_list<T> t, Compare comp); 16600b57cec5SDimitry Andric 16610b57cec5SDimitry Andrictemplate<class T> 16620b57cec5SDimitry Andric constexpr const T& clamp(const T& v, const T& lo, const T& hi); // C++17 16630b57cec5SDimitry Andric 16640b57cec5SDimitry Andrictemplate<class T, class Compare> 16650b57cec5SDimitry Andric constexpr const T& clamp(const T& v, const T& lo, const T& hi, Compare comp); // C++17 16660b57cec5SDimitry Andric 16670b57cec5SDimitry Andrictemplate <class ForwardIterator> 1668e8d8bef9SDimitry Andric constexpr ForwardIterator // constexpr in C++14 1669e8d8bef9SDimitry Andric max_element(ForwardIterator first, ForwardIterator last); 16700b57cec5SDimitry Andric 16710b57cec5SDimitry Andrictemplate <class ForwardIterator, class Compare> 1672e8d8bef9SDimitry Andric constexpr ForwardIterator // constexpr in C++14 1673e8d8bef9SDimitry Andric max_element(ForwardIterator first, ForwardIterator last, Compare comp); 16740b57cec5SDimitry Andric 16750b57cec5SDimitry Andrictemplate <class T> 1676e8d8bef9SDimitry Andric constexpr const T& // constexpr in C++14 1677e8d8bef9SDimitry Andric max(const T& a, const T& b); 16780b57cec5SDimitry Andric 16790b57cec5SDimitry Andrictemplate <class T, class Compare> 1680e8d8bef9SDimitry Andric constexpr const T& // constexpr in C++14 1681e8d8bef9SDimitry Andric max(const T& a, const T& b, Compare comp); 16820b57cec5SDimitry Andric 16830b57cec5SDimitry Andrictemplate<class T> 1684e8d8bef9SDimitry Andric constexpr T // constexpr in C++14 1685e8d8bef9SDimitry Andric max(initializer_list<T> t); 16860b57cec5SDimitry Andric 16870b57cec5SDimitry Andrictemplate<class T, class Compare> 1688e8d8bef9SDimitry Andric constexpr T // constexpr in C++14 1689e8d8bef9SDimitry Andric max(initializer_list<T> t, Compare comp); 16900b57cec5SDimitry Andric 16910b57cec5SDimitry Andrictemplate<class ForwardIterator> 1692e8d8bef9SDimitry Andric constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++14 1693e8d8bef9SDimitry Andric minmax_element(ForwardIterator first, ForwardIterator last); 16940b57cec5SDimitry Andric 16950b57cec5SDimitry Andrictemplate<class ForwardIterator, class Compare> 1696e8d8bef9SDimitry Andric constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++14 1697e8d8bef9SDimitry Andric minmax_element(ForwardIterator first, ForwardIterator last, Compare comp); 16980b57cec5SDimitry Andric 16990b57cec5SDimitry Andrictemplate<class T> 1700e8d8bef9SDimitry Andric constexpr pair<const T&, const T&> // constexpr in C++14 1701e8d8bef9SDimitry Andric minmax(const T& a, const T& b); 17020b57cec5SDimitry Andric 17030b57cec5SDimitry Andrictemplate<class T, class Compare> 1704e8d8bef9SDimitry Andric constexpr pair<const T&, const T&> // constexpr in C++14 1705e8d8bef9SDimitry Andric minmax(const T& a, const T& b, Compare comp); 17060b57cec5SDimitry Andric 17070b57cec5SDimitry Andrictemplate<class T> 1708e8d8bef9SDimitry Andric constexpr pair<T, T> // constexpr in C++14 1709e8d8bef9SDimitry Andric minmax(initializer_list<T> t); 17100b57cec5SDimitry Andric 17110b57cec5SDimitry Andrictemplate<class T, class Compare> 1712e8d8bef9SDimitry Andric constexpr pair<T, T> // constexpr in C++14 1713e8d8bef9SDimitry Andric minmax(initializer_list<T> t, Compare comp); 17140b57cec5SDimitry Andric 17150b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2> 17160b57cec5SDimitry Andric constexpr bool // constexpr in C++20 17170b57cec5SDimitry Andric lexicographical_compare(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2); 17180b57cec5SDimitry Andric 17190b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class Compare> 17200b57cec5SDimitry Andric constexpr bool // constexpr in C++20 17210b57cec5SDimitry Andric lexicographical_compare(InputIterator1 first1, InputIterator1 last1, 17220b57cec5SDimitry Andric InputIterator2 first2, InputIterator2 last2, Compare comp); 17230b57cec5SDimitry Andric 172406c3fb27SDimitry Andrictemplate<class InputIterator1, class InputIterator2, class Cmp> 172506c3fb27SDimitry Andric constexpr auto 172606c3fb27SDimitry Andric lexicographical_compare_three_way(InputIterator1 first1, InputIterator1 last1, 172706c3fb27SDimitry Andric InputIterator2 first2, InputIterator2 last2, 172806c3fb27SDimitry Andric Cmp comp) 172906c3fb27SDimitry Andric -> decltype(comp(*b1, *b2)); // since C++20 173006c3fb27SDimitry Andric 173106c3fb27SDimitry Andrictemplate<class InputIterator1, class InputIterator2> 173206c3fb27SDimitry Andric constexpr auto 173306c3fb27SDimitry Andric lexicographical_compare_three_way(InputIterator1 first1, InputIterator1 last1, 173406c3fb27SDimitry Andric InputIterator2 first2, InputIterator2 last2); // since C++20 173506c3fb27SDimitry Andric 17360b57cec5SDimitry Andrictemplate <class BidirectionalIterator> 1737e8d8bef9SDimitry Andric constexpr bool // constexpr in C++20 17380b57cec5SDimitry Andric next_permutation(BidirectionalIterator first, BidirectionalIterator last); 17390b57cec5SDimitry Andric 17400b57cec5SDimitry Andrictemplate <class BidirectionalIterator, class Compare> 1741e8d8bef9SDimitry Andric constexpr bool // constexpr in C++20 17420b57cec5SDimitry Andric next_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp); 17430b57cec5SDimitry Andric 17440b57cec5SDimitry Andrictemplate <class BidirectionalIterator> 1745e8d8bef9SDimitry Andric constexpr bool // constexpr in C++20 17460b57cec5SDimitry Andric prev_permutation(BidirectionalIterator first, BidirectionalIterator last); 17470b57cec5SDimitry Andric 17480b57cec5SDimitry Andrictemplate <class BidirectionalIterator, class Compare> 1749e8d8bef9SDimitry Andric constexpr bool // constexpr in C++20 17500b57cec5SDimitry Andric prev_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp); 17510b57cec5SDimitry Andric} // std 17520b57cec5SDimitry Andric 17530b57cec5SDimitry Andric*/ 17540b57cec5SDimitry Andric 175581ad6265SDimitry Andric#include <__assert> // all public C++ headers provide the assertion handler 17560b57cec5SDimitry Andric#include <__config> 17570b57cec5SDimitry Andric#include <version> 17580b57cec5SDimitry Andric 1759fe6060f1SDimitry Andric#include <__algorithm/adjacent_find.h> 1760fe6060f1SDimitry Andric#include <__algorithm/all_of.h> 1761fe6060f1SDimitry Andric#include <__algorithm/any_of.h> 1762fe6060f1SDimitry Andric#include <__algorithm/binary_search.h> 1763fe6060f1SDimitry Andric#include <__algorithm/clamp.h> 1764fe6060f1SDimitry Andric#include <__algorithm/comp.h> 1765fe6060f1SDimitry Andric#include <__algorithm/comp_ref_type.h> 1766fe6060f1SDimitry Andric#include <__algorithm/copy.h> 1767fe6060f1SDimitry Andric#include <__algorithm/copy_backward.h> 1768fe6060f1SDimitry Andric#include <__algorithm/copy_if.h> 1769fe6060f1SDimitry Andric#include <__algorithm/copy_n.h> 1770fe6060f1SDimitry Andric#include <__algorithm/count.h> 1771fe6060f1SDimitry Andric#include <__algorithm/count_if.h> 1772fe6060f1SDimitry Andric#include <__algorithm/equal.h> 1773fe6060f1SDimitry Andric#include <__algorithm/equal_range.h> 1774fe6060f1SDimitry Andric#include <__algorithm/fill.h> 177504eeddc0SDimitry Andric#include <__algorithm/fill_n.h> 1776fe6060f1SDimitry Andric#include <__algorithm/find.h> 1777fe6060f1SDimitry Andric#include <__algorithm/find_end.h> 1778fe6060f1SDimitry Andric#include <__algorithm/find_first_of.h> 1779fe6060f1SDimitry Andric#include <__algorithm/find_if.h> 1780fe6060f1SDimitry Andric#include <__algorithm/find_if_not.h> 1781fe6060f1SDimitry Andric#include <__algorithm/for_each.h> 1782fe6060f1SDimitry Andric#include <__algorithm/for_each_n.h> 1783fe6060f1SDimitry Andric#include <__algorithm/generate.h> 178404eeddc0SDimitry Andric#include <__algorithm/generate_n.h> 1785fe6060f1SDimitry Andric#include <__algorithm/half_positive.h> 178681ad6265SDimitry Andric#include <__algorithm/in_found_result.h> 178781ad6265SDimitry Andric#include <__algorithm/in_fun_result.h> 17881fd87a68SDimitry Andric#include <__algorithm/in_in_out_result.h> 178904eeddc0SDimitry Andric#include <__algorithm/in_in_result.h> 179081ad6265SDimitry Andric#include <__algorithm/in_out_out_result.h> 179104eeddc0SDimitry Andric#include <__algorithm/in_out_result.h> 1792fe6060f1SDimitry Andric#include <__algorithm/includes.h> 1793fe6060f1SDimitry Andric#include <__algorithm/inplace_merge.h> 1794fe6060f1SDimitry Andric#include <__algorithm/is_heap.h> 1795fe6060f1SDimitry Andric#include <__algorithm/is_heap_until.h> 1796fe6060f1SDimitry Andric#include <__algorithm/is_partitioned.h> 1797fe6060f1SDimitry Andric#include <__algorithm/is_permutation.h> 1798fe6060f1SDimitry Andric#include <__algorithm/is_sorted.h> 1799fe6060f1SDimitry Andric#include <__algorithm/is_sorted_until.h> 1800fe6060f1SDimitry Andric#include <__algorithm/iter_swap.h> 1801fe6060f1SDimitry Andric#include <__algorithm/lexicographical_compare.h> 180206c3fb27SDimitry Andric#include <__algorithm/lexicographical_compare_three_way.h> 1803fe6060f1SDimitry Andric#include <__algorithm/lower_bound.h> 1804fe6060f1SDimitry Andric#include <__algorithm/make_heap.h> 1805fe6060f1SDimitry Andric#include <__algorithm/max.h> 1806fe6060f1SDimitry Andric#include <__algorithm/max_element.h> 1807fe6060f1SDimitry Andric#include <__algorithm/merge.h> 1808fe6060f1SDimitry Andric#include <__algorithm/min.h> 1809fe6060f1SDimitry Andric#include <__algorithm/min_element.h> 181081ad6265SDimitry Andric#include <__algorithm/min_max_result.h> 1811fe6060f1SDimitry Andric#include <__algorithm/minmax.h> 1812fe6060f1SDimitry Andric#include <__algorithm/minmax_element.h> 1813fe6060f1SDimitry Andric#include <__algorithm/mismatch.h> 1814fe6060f1SDimitry Andric#include <__algorithm/move.h> 1815fe6060f1SDimitry Andric#include <__algorithm/move_backward.h> 1816fe6060f1SDimitry Andric#include <__algorithm/next_permutation.h> 1817fe6060f1SDimitry Andric#include <__algorithm/none_of.h> 1818fe6060f1SDimitry Andric#include <__algorithm/nth_element.h> 1819fe6060f1SDimitry Andric#include <__algorithm/partial_sort.h> 1820fe6060f1SDimitry Andric#include <__algorithm/partial_sort_copy.h> 1821fe6060f1SDimitry Andric#include <__algorithm/partition.h> 1822fe6060f1SDimitry Andric#include <__algorithm/partition_copy.h> 1823fe6060f1SDimitry Andric#include <__algorithm/partition_point.h> 1824fe6060f1SDimitry Andric#include <__algorithm/pop_heap.h> 1825fe6060f1SDimitry Andric#include <__algorithm/prev_permutation.h> 182606c3fb27SDimitry Andric#include <__algorithm/pstl_any_all_none_of.h> 182706c3fb27SDimitry Andric#include <__algorithm/pstl_copy.h> 182806c3fb27SDimitry Andric#include <__algorithm/pstl_count.h> 1829*5f757f3fSDimitry Andric#include <__algorithm/pstl_equal.h> 183006c3fb27SDimitry Andric#include <__algorithm/pstl_fill.h> 183106c3fb27SDimitry Andric#include <__algorithm/pstl_find.h> 183206c3fb27SDimitry Andric#include <__algorithm/pstl_for_each.h> 183306c3fb27SDimitry Andric#include <__algorithm/pstl_generate.h> 183406c3fb27SDimitry Andric#include <__algorithm/pstl_is_partitioned.h> 183506c3fb27SDimitry Andric#include <__algorithm/pstl_merge.h> 1836*5f757f3fSDimitry Andric#include <__algorithm/pstl_move.h> 183706c3fb27SDimitry Andric#include <__algorithm/pstl_replace.h> 1838*5f757f3fSDimitry Andric#include <__algorithm/pstl_rotate_copy.h> 183906c3fb27SDimitry Andric#include <__algorithm/pstl_sort.h> 184006c3fb27SDimitry Andric#include <__algorithm/pstl_stable_sort.h> 184106c3fb27SDimitry Andric#include <__algorithm/pstl_transform.h> 1842fe6060f1SDimitry Andric#include <__algorithm/push_heap.h> 184381ad6265SDimitry Andric#include <__algorithm/ranges_adjacent_find.h> 184481ad6265SDimitry Andric#include <__algorithm/ranges_all_of.h> 184581ad6265SDimitry Andric#include <__algorithm/ranges_any_of.h> 184681ad6265SDimitry Andric#include <__algorithm/ranges_binary_search.h> 184761cfbce3SDimitry Andric#include <__algorithm/ranges_clamp.h> 184881ad6265SDimitry Andric#include <__algorithm/ranges_copy.h> 184981ad6265SDimitry Andric#include <__algorithm/ranges_copy_backward.h> 185081ad6265SDimitry Andric#include <__algorithm/ranges_copy_if.h> 185181ad6265SDimitry Andric#include <__algorithm/ranges_copy_n.h> 185281ad6265SDimitry Andric#include <__algorithm/ranges_count.h> 185381ad6265SDimitry Andric#include <__algorithm/ranges_count_if.h> 1854*5f757f3fSDimitry Andric#include <__algorithm/ranges_ends_with.h> 185581ad6265SDimitry Andric#include <__algorithm/ranges_equal.h> 1856fcaf7f86SDimitry Andric#include <__algorithm/ranges_equal_range.h> 185781ad6265SDimitry Andric#include <__algorithm/ranges_fill.h> 185881ad6265SDimitry Andric#include <__algorithm/ranges_fill_n.h> 185981ad6265SDimitry Andric#include <__algorithm/ranges_find.h> 1860753f127fSDimitry Andric#include <__algorithm/ranges_find_end.h> 186181ad6265SDimitry Andric#include <__algorithm/ranges_find_first_of.h> 186281ad6265SDimitry Andric#include <__algorithm/ranges_find_if.h> 186381ad6265SDimitry Andric#include <__algorithm/ranges_find_if_not.h> 186481ad6265SDimitry Andric#include <__algorithm/ranges_for_each.h> 186581ad6265SDimitry Andric#include <__algorithm/ranges_for_each_n.h> 1866972a253aSDimitry Andric#include <__algorithm/ranges_generate.h> 1867972a253aSDimitry Andric#include <__algorithm/ranges_generate_n.h> 1868fcaf7f86SDimitry Andric#include <__algorithm/ranges_includes.h> 186961cfbce3SDimitry Andric#include <__algorithm/ranges_inplace_merge.h> 1870972a253aSDimitry Andric#include <__algorithm/ranges_is_heap.h> 1871972a253aSDimitry Andric#include <__algorithm/ranges_is_heap_until.h> 187281ad6265SDimitry Andric#include <__algorithm/ranges_is_partitioned.h> 187361cfbce3SDimitry Andric#include <__algorithm/ranges_is_permutation.h> 187481ad6265SDimitry Andric#include <__algorithm/ranges_is_sorted.h> 187581ad6265SDimitry Andric#include <__algorithm/ranges_is_sorted_until.h> 187681ad6265SDimitry Andric#include <__algorithm/ranges_lexicographical_compare.h> 187781ad6265SDimitry Andric#include <__algorithm/ranges_lower_bound.h> 1878753f127fSDimitry Andric#include <__algorithm/ranges_make_heap.h> 187981ad6265SDimitry Andric#include <__algorithm/ranges_max.h> 188081ad6265SDimitry Andric#include <__algorithm/ranges_max_element.h> 1881753f127fSDimitry Andric#include <__algorithm/ranges_merge.h> 188281ad6265SDimitry Andric#include <__algorithm/ranges_min.h> 188381ad6265SDimitry Andric#include <__algorithm/ranges_min_element.h> 188481ad6265SDimitry Andric#include <__algorithm/ranges_minmax.h> 188581ad6265SDimitry Andric#include <__algorithm/ranges_minmax_element.h> 188681ad6265SDimitry Andric#include <__algorithm/ranges_mismatch.h> 188781ad6265SDimitry Andric#include <__algorithm/ranges_move.h> 188881ad6265SDimitry Andric#include <__algorithm/ranges_move_backward.h> 188961cfbce3SDimitry Andric#include <__algorithm/ranges_next_permutation.h> 189081ad6265SDimitry Andric#include <__algorithm/ranges_none_of.h> 1891753f127fSDimitry Andric#include <__algorithm/ranges_nth_element.h> 1892fcaf7f86SDimitry Andric#include <__algorithm/ranges_partial_sort.h> 189361cfbce3SDimitry Andric#include <__algorithm/ranges_partial_sort_copy.h> 1894fcaf7f86SDimitry Andric#include <__algorithm/ranges_partition.h> 1895fcaf7f86SDimitry Andric#include <__algorithm/ranges_partition_copy.h> 1896fcaf7f86SDimitry Andric#include <__algorithm/ranges_partition_point.h> 1897753f127fSDimitry Andric#include <__algorithm/ranges_pop_heap.h> 189861cfbce3SDimitry Andric#include <__algorithm/ranges_prev_permutation.h> 1899753f127fSDimitry Andric#include <__algorithm/ranges_push_heap.h> 1900753f127fSDimitry Andric#include <__algorithm/ranges_remove.h> 190161cfbce3SDimitry Andric#include <__algorithm/ranges_remove_copy.h> 190261cfbce3SDimitry Andric#include <__algorithm/ranges_remove_copy_if.h> 1903753f127fSDimitry Andric#include <__algorithm/ranges_remove_if.h> 190481ad6265SDimitry Andric#include <__algorithm/ranges_replace.h> 190561cfbce3SDimitry Andric#include <__algorithm/ranges_replace_copy.h> 190661cfbce3SDimitry Andric#include <__algorithm/ranges_replace_copy_if.h> 190781ad6265SDimitry Andric#include <__algorithm/ranges_replace_if.h> 190881ad6265SDimitry Andric#include <__algorithm/ranges_reverse.h> 1909753f127fSDimitry Andric#include <__algorithm/ranges_reverse_copy.h> 191061cfbce3SDimitry Andric#include <__algorithm/ranges_rotate.h> 1911753f127fSDimitry Andric#include <__algorithm/ranges_rotate_copy.h> 191261cfbce3SDimitry Andric#include <__algorithm/ranges_sample.h> 1913753f127fSDimitry Andric#include <__algorithm/ranges_search.h> 1914753f127fSDimitry Andric#include <__algorithm/ranges_search_n.h> 1915753f127fSDimitry Andric#include <__algorithm/ranges_set_difference.h> 1916753f127fSDimitry Andric#include <__algorithm/ranges_set_intersection.h> 1917753f127fSDimitry Andric#include <__algorithm/ranges_set_symmetric_difference.h> 1918fcaf7f86SDimitry Andric#include <__algorithm/ranges_set_union.h> 1919fcaf7f86SDimitry Andric#include <__algorithm/ranges_shuffle.h> 192081ad6265SDimitry Andric#include <__algorithm/ranges_sort.h> 1921753f127fSDimitry Andric#include <__algorithm/ranges_sort_heap.h> 1922fcaf7f86SDimitry Andric#include <__algorithm/ranges_stable_partition.h> 192381ad6265SDimitry Andric#include <__algorithm/ranges_stable_sort.h> 192406c3fb27SDimitry Andric#include <__algorithm/ranges_starts_with.h> 192581ad6265SDimitry Andric#include <__algorithm/ranges_swap_ranges.h> 192681ad6265SDimitry Andric#include <__algorithm/ranges_transform.h> 192761cfbce3SDimitry Andric#include <__algorithm/ranges_unique.h> 192861cfbce3SDimitry Andric#include <__algorithm/ranges_unique_copy.h> 192981ad6265SDimitry Andric#include <__algorithm/ranges_upper_bound.h> 1930fe6060f1SDimitry Andric#include <__algorithm/remove.h> 1931fe6060f1SDimitry Andric#include <__algorithm/remove_copy.h> 1932fe6060f1SDimitry Andric#include <__algorithm/remove_copy_if.h> 1933fe6060f1SDimitry Andric#include <__algorithm/remove_if.h> 1934fe6060f1SDimitry Andric#include <__algorithm/replace.h> 1935fe6060f1SDimitry Andric#include <__algorithm/replace_copy.h> 1936fe6060f1SDimitry Andric#include <__algorithm/replace_copy_if.h> 1937fe6060f1SDimitry Andric#include <__algorithm/replace_if.h> 1938fe6060f1SDimitry Andric#include <__algorithm/reverse.h> 1939fe6060f1SDimitry Andric#include <__algorithm/reverse_copy.h> 1940fe6060f1SDimitry Andric#include <__algorithm/rotate.h> 1941fe6060f1SDimitry Andric#include <__algorithm/rotate_copy.h> 1942fe6060f1SDimitry Andric#include <__algorithm/sample.h> 1943fe6060f1SDimitry Andric#include <__algorithm/search.h> 1944fe6060f1SDimitry Andric#include <__algorithm/search_n.h> 1945fe6060f1SDimitry Andric#include <__algorithm/set_difference.h> 1946fe6060f1SDimitry Andric#include <__algorithm/set_intersection.h> 1947fe6060f1SDimitry Andric#include <__algorithm/set_symmetric_difference.h> 1948fe6060f1SDimitry Andric#include <__algorithm/set_union.h> 1949fe6060f1SDimitry Andric#include <__algorithm/shift_left.h> 1950fe6060f1SDimitry Andric#include <__algorithm/shift_right.h> 1951fe6060f1SDimitry Andric#include <__algorithm/shuffle.h> 1952fe6060f1SDimitry Andric#include <__algorithm/sift_down.h> 1953fe6060f1SDimitry Andric#include <__algorithm/sort.h> 1954fe6060f1SDimitry Andric#include <__algorithm/sort_heap.h> 1955fe6060f1SDimitry Andric#include <__algorithm/stable_partition.h> 1956fe6060f1SDimitry Andric#include <__algorithm/stable_sort.h> 1957fe6060f1SDimitry Andric#include <__algorithm/swap_ranges.h> 1958fe6060f1SDimitry Andric#include <__algorithm/transform.h> 1959fe6060f1SDimitry Andric#include <__algorithm/unique.h> 196004eeddc0SDimitry Andric#include <__algorithm/unique_copy.h> 1961fe6060f1SDimitry Andric#include <__algorithm/unwrap_iter.h> 1962fe6060f1SDimitry Andric#include <__algorithm/upper_bound.h> 19630b57cec5SDimitry Andric 196481ad6265SDimitry Andric// standard-mandated includes 1965bdd1243dSDimitry Andric 1966bdd1243dSDimitry Andric// [algorithm.syn] 196781ad6265SDimitry Andric#include <initializer_list> 196881ad6265SDimitry Andric 19690b57cec5SDimitry Andric#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 19700b57cec5SDimitry Andric# pragma GCC system_header 19710b57cec5SDimitry Andric#endif 19720b57cec5SDimitry Andric 1973bdd1243dSDimitry Andric#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 1974bdd1243dSDimitry Andric# include <atomic> 197506c3fb27SDimitry Andric# include <bit> 1976bdd1243dSDimitry Andric# include <concepts> 197706c3fb27SDimitry Andric# include <cstdlib> 1978bdd1243dSDimitry Andric# include <cstring> 1979bdd1243dSDimitry Andric# include <iterator> 1980bdd1243dSDimitry Andric# include <memory> 1981bdd1243dSDimitry Andric# include <stdexcept> 198206c3fb27SDimitry Andric# include <type_traits> 1983bdd1243dSDimitry Andric# include <utility> 1984bdd1243dSDimitry Andric#endif 1985bdd1243dSDimitry Andric 19860b57cec5SDimitry Andric#endif // _LIBCPP_ALGORITHM 1987