1*0b57cec5SDimitry Andric// -*- C++ -*- 2349cc55cSDimitry Andric//===----------------------------------------------------------------------===// 3*0b57cec5SDimitry Andric// 4*0b57cec5SDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 5*0b57cec5SDimitry Andric// See https://llvm.org/LICENSE.txt for license information. 6*0b57cec5SDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 7*0b57cec5SDimitry Andric// 8*0b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 9*0b57cec5SDimitry Andric 10*0b57cec5SDimitry Andric#ifndef _LIBCPP_ALGORITHM 11*0b57cec5SDimitry Andric#define _LIBCPP_ALGORITHM 12*0b57cec5SDimitry Andric 13*0b57cec5SDimitry Andric/* 14*0b57cec5SDimitry Andric algorithm synopsis 15*0b57cec5SDimitry Andric 16*0b57cec5SDimitry Andric#include <initializer_list> 17*0b57cec5SDimitry Andric 18*0b57cec5SDimitry Andricnamespace std 19*0b57cec5SDimitry Andric{ 20*0b57cec5SDimitry 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> 6781ad6265SDimitry Andric constexpr mismatch_result<_I1, _I2> 6881ad6265SDimitry Andric mismatch()(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}) // since C++20 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> 336972a253aSDimitry 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> 340972a253aSDimitry 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> 344972a253aSDimitry 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> 349972a253aSDimitry 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&>> 402972a253aSDimitry Andric constexpr O generate(O first, S last, F gen); // Since C++20 403972a253aSDimitry Andric 404972a253aSDimitry Andric template<class R, copy_constructible F> 405972a253aSDimitry Andric requires invocable<F&> && output_range<R, invoke_result_t<F&>> 406972a253aSDimitry Andric constexpr borrowed_iterator_t<R> generate(R&& r, F gen); // Since C++20 407972a253aSDimitry Andric 408972a253aSDimitry Andric template<input_or_output_iterator O, copy_constructible F> 409972a253aSDimitry Andric requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>> 410972a253aSDimitry Andric constexpr O generate_n(O first, iter_difference_t<O> n, F gen); // Since C++20 411972a253aSDimitry Andric 41281ad6265SDimitry Andric template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, 41381ad6265SDimitry Andric class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> 41481ad6265SDimitry Andric requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2> 41581ad6265SDimitry Andric constexpr bool ranges::equal(I1 first1, S1 last1, I2 first2, S2 last2, 41681ad6265SDimitry Andric Pred pred = {}, 41781ad6265SDimitry Andric Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 41881ad6265SDimitry Andric 41981ad6265SDimitry Andric template<input_range R1, input_range R2, class Pred = ranges::equal_to, 42081ad6265SDimitry Andric class Proj1 = identity, class Proj2 = identity> 42181ad6265SDimitry Andric requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2> 42281ad6265SDimitry Andric constexpr bool ranges::equal(R1&& r1, R2&& r2, Pred pred = {}, 42381ad6265SDimitry Andric Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 42481ad6265SDimitry Andric 42581ad6265SDimitry Andric template<input_iterator I, sentinel_for<I> S, class Proj = identity, 42681ad6265SDimitry Andric indirect_unary_predicate<projected<I, Proj>> Pred> 42781ad6265SDimitry Andric constexpr bool ranges::all_of(I first, S last, Pred pred, Proj proj = {}); // since C++20 42881ad6265SDimitry Andric 42981ad6265SDimitry Andric template<input_range R, class Proj = identity, 43081ad6265SDimitry Andric indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> 43181ad6265SDimitry Andric constexpr bool ranges::all_of(R&& r, Pred pred, Proj proj = {}); // since C++20 43281ad6265SDimitry Andric 43381ad6265SDimitry Andric template<input_iterator I, sentinel_for<I> S, class Proj = identity, 43481ad6265SDimitry Andric indirect_unary_predicate<projected<I, Proj>> Pred> 43581ad6265SDimitry Andric constexpr bool ranges::any_of(I first, S last, Pred pred, Proj proj = {}); // since C++20 43681ad6265SDimitry Andric 43781ad6265SDimitry Andric template<input_range R, class Proj = identity, 43881ad6265SDimitry Andric indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> 43981ad6265SDimitry Andric constexpr bool ranges::any_of(R&& r, Pred pred, Proj proj = {}); // since C++20 44081ad6265SDimitry Andric 44181ad6265SDimitry Andric template<input_iterator I, sentinel_for<I> S, class Proj = identity, 44281ad6265SDimitry Andric indirect_unary_predicate<projected<I, Proj>> Pred> 44381ad6265SDimitry Andric constexpr bool ranges::none_of(I first, S last, Pred pred, Proj proj = {}); // since C++20 44481ad6265SDimitry Andric 44581ad6265SDimitry Andric template<input_range R, class Proj = identity, 44681ad6265SDimitry Andric indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> 44781ad6265SDimitry Andric constexpr bool ranges::none_of(R&& r, Pred pred, Proj proj = {}); // since C++20 44881ad6265SDimitry Andric 44961cfbce3SDimitry Andric template<input_iterator I1, sentinel_for<I1> S1, 45061cfbce3SDimitry Andric random_access_iterator I2, sentinel_for<I2> S2, 45161cfbce3SDimitry Andric class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity> 45261cfbce3SDimitry Andric requires indirectly_copyable<I1, I2> && sortable<I2, Comp, Proj2> && 45361cfbce3SDimitry Andric indirect_strict_weak_order<Comp, projected<I1, Proj1>, projected<I2, Proj2>> 45461cfbce3SDimitry Andric constexpr partial_sort_copy_result<I1, I2> 45561cfbce3SDimitry Andric partial_sort_copy(I1 first, S1 last, I2 result_first, S2 result_last, 45661cfbce3SDimitry Andric Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // Since C++20 45761cfbce3SDimitry Andric 45861cfbce3SDimitry Andric template<input_range R1, random_access_range R2, class Comp = ranges::less, 45961cfbce3SDimitry Andric class Proj1 = identity, class Proj2 = identity> 46061cfbce3SDimitry Andric requires indirectly_copyable<iterator_t<R1>, iterator_t<R2>> && 46161cfbce3SDimitry Andric sortable<iterator_t<R2>, Comp, Proj2> && 46261cfbce3SDimitry Andric indirect_strict_weak_order<Comp, projected<iterator_t<R1>, Proj1>, 46361cfbce3SDimitry Andric projected<iterator_t<R2>, Proj2>> 46461cfbce3SDimitry Andric constexpr partial_sort_copy_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>> 46561cfbce3SDimitry Andric partial_sort_copy(R1&& r, R2&& result_r, Comp comp = {}, 46661cfbce3SDimitry Andric Proj1 proj1 = {}, Proj2 proj2 = {}); // Since C++20 46761cfbce3SDimitry Andric 46881ad6265SDimitry Andric template<forward_iterator I, sentinel_for<I> S, class Proj = identity, 46981ad6265SDimitry Andric indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> 47081ad6265SDimitry Andric constexpr bool ranges::is_sorted(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 47181ad6265SDimitry Andric 47281ad6265SDimitry Andric template<forward_range R, class Proj = identity, 47381ad6265SDimitry Andric indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> 47481ad6265SDimitry Andric constexpr bool ranges::is_sorted(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 47581ad6265SDimitry Andric 47681ad6265SDimitry Andric template<forward_iterator I, sentinel_for<I> S, class Proj = identity, 47781ad6265SDimitry Andric indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> 47881ad6265SDimitry Andric constexpr I ranges::is_sorted_until(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 47981ad6265SDimitry Andric 48081ad6265SDimitry Andric template<forward_range R, class Proj = identity, 48181ad6265SDimitry Andric indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> 48281ad6265SDimitry Andric constexpr borrowed_iterator_t<R> 48381ad6265SDimitry Andric ranges::is_sorted_until(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 48481ad6265SDimitry Andric 485753f127fSDimitry Andric template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less, 486753f127fSDimitry Andric class Proj = identity> 487753f127fSDimitry Andric requires sortable<I, Comp, Proj> 488753f127fSDimitry Andric constexpr I 489753f127fSDimitry Andric ranges::nth_element(I first, I nth, S last, Comp comp = {}, Proj proj = {}); // since C++20 490753f127fSDimitry Andric 491753f127fSDimitry Andric template<random_access_range R, class Comp = ranges::less, class Proj = identity> 492753f127fSDimitry Andric requires sortable<iterator_t<R>, Comp, Proj> 493753f127fSDimitry Andric constexpr borrowed_iterator_t<R> 494753f127fSDimitry Andric ranges::nth_element(R&& r, iterator_t<R> nth, Comp comp = {}, Proj proj = {}); // since C++20 495753f127fSDimitry Andric 49681ad6265SDimitry Andric template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity, 49781ad6265SDimitry Andric indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less> 49881ad6265SDimitry Andric constexpr I upper_bound(I first, S last, const T& value, Comp comp = {}, Proj proj = {}); // since C++20 49981ad6265SDimitry Andric 50081ad6265SDimitry Andric template<forward_range R, class T, class Proj = identity, 50181ad6265SDimitry Andric indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp = 50281ad6265SDimitry Andric ranges::less> 50381ad6265SDimitry Andric constexpr borrowed_iterator_t<R> 50481ad6265SDimitry Andric upper_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20 50581ad6265SDimitry Andric 50681ad6265SDimitry Andric template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity, 50781ad6265SDimitry Andric indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less> 50881ad6265SDimitry Andric constexpr I lower_bound(I first, S last, const T& value, Comp comp = {}, 50981ad6265SDimitry Andric Proj proj = {}); // since C++20 51081ad6265SDimitry Andric template<forward_range R, class T, class Proj = identity, 51181ad6265SDimitry Andric indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp = 51281ad6265SDimitry Andric ranges::less> 51381ad6265SDimitry Andric constexpr borrowed_iterator_t<R> 51481ad6265SDimitry Andric lower_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20 51581ad6265SDimitry Andric 51681ad6265SDimitry Andric template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity, 51781ad6265SDimitry Andric indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less> 51881ad6265SDimitry Andric constexpr bool binary_search(I first, S last, const T& value, Comp comp = {}, 51981ad6265SDimitry Andric Proj proj = {}); // since C++20 52081ad6265SDimitry Andric 52181ad6265SDimitry Andric template<forward_range R, class T, class Proj = identity, 52281ad6265SDimitry Andric indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp = 52381ad6265SDimitry Andric ranges::less> 52481ad6265SDimitry Andric constexpr bool binary_search(R&& r, const T& value, Comp comp = {}, 52581ad6265SDimitry Andric Proj proj = {}); // since C++20 526fcaf7f86SDimitry Andric 527fcaf7f86SDimitry Andric template<permutable I, sentinel_for<I> S, class Proj = identity, 528fcaf7f86SDimitry Andric indirect_unary_predicate<projected<I, Proj>> Pred> 529fcaf7f86SDimitry Andric constexpr subrange<I> 530fcaf7f86SDimitry Andric partition(I first, S last, Pred pred, Proj proj = {}); // Since C++20 531fcaf7f86SDimitry Andric 532fcaf7f86SDimitry Andric template<forward_range R, class Proj = identity, 533fcaf7f86SDimitry Andric indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> 534fcaf7f86SDimitry Andric requires permutable<iterator_t<R>> 535fcaf7f86SDimitry Andric constexpr borrowed_subrange_t<R> 536fcaf7f86SDimitry Andric partition(R&& r, Pred pred, Proj proj = {}); // Since C++20 537fcaf7f86SDimitry Andric 538fcaf7f86SDimitry Andric template<bidirectional_iterator I, sentinel_for<I> S, class Proj = identity, 539fcaf7f86SDimitry Andric indirect_unary_predicate<projected<I, Proj>> Pred> 540fcaf7f86SDimitry Andric requires permutable<I> 541fcaf7f86SDimitry Andric subrange<I> stable_partition(I first, S last, Pred pred, Proj proj = {}); // Since C++20 542fcaf7f86SDimitry Andric 543fcaf7f86SDimitry Andric template<bidirectional_range R, class Proj = identity, 544fcaf7f86SDimitry Andric indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> 545fcaf7f86SDimitry Andric requires permutable<iterator_t<R>> 546fcaf7f86SDimitry Andric borrowed_subrange_t<R> stable_partition(R&& r, Pred pred, Proj proj = {}); // Since C++20 547fcaf7f86SDimitry Andric 54881ad6265SDimitry Andric template<input_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2, 54981ad6265SDimitry Andric class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> 55081ad6265SDimitry Andric requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2> 55181ad6265SDimitry Andric constexpr I1 ranges::find_first_of(I1 first1, S1 last1, I2 first2, S2 last2, 55281ad6265SDimitry Andric Pred pred = {}, 55381ad6265SDimitry Andric Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 55481ad6265SDimitry Andric 55581ad6265SDimitry Andric template<input_range R1, forward_range R2, 55681ad6265SDimitry Andric class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> 55781ad6265SDimitry Andric requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2> 55881ad6265SDimitry Andric constexpr borrowed_iterator_t<R1> 55981ad6265SDimitry Andric ranges::find_first_of(R1&& r1, R2&& r2, 56081ad6265SDimitry Andric Pred pred = {}, 56181ad6265SDimitry Andric Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 56281ad6265SDimitry Andric 56381ad6265SDimitry Andric template<forward_iterator I, sentinel_for<I> S, class Proj = identity, 56481ad6265SDimitry Andric indirect_binary_predicate<projected<I, Proj>, 56581ad6265SDimitry Andric projected<I, Proj>> Pred = ranges::equal_to> 56681ad6265SDimitry Andric constexpr I ranges::adjacent_find(I first, S last, Pred pred = {}, Proj proj = {}); // since C+20 56781ad6265SDimitry Andric 56881ad6265SDimitry Andric template<forward_range R, class Proj = identity, 56981ad6265SDimitry Andric indirect_binary_predicate<projected<iterator_t<R>, Proj>, 57081ad6265SDimitry Andric projected<iterator_t<R>, Proj>> Pred = ranges::equal_to> 57181ad6265SDimitry Andric constexpr borrowed_iterator_t<R> ranges::adjacent_find(R&& r, Pred pred = {}, Proj proj = {}); // since C++20 57281ad6265SDimitry Andric 57381ad6265SDimitry Andric template<input_iterator I, sentinel_for<I> S, class T1, class T2, class Proj = identity> 57481ad6265SDimitry Andric requires indirectly_writable<I, const T2&> && 57581ad6265SDimitry Andric indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*> 57681ad6265SDimitry Andric constexpr I 57781ad6265SDimitry Andric ranges::replace(I first, S last, const T1& old_value, const T2& new_value, Proj proj = {}); // since C++20 57881ad6265SDimitry Andric 57981ad6265SDimitry Andric template<input_range R, class T1, class T2, class Proj = identity> 58081ad6265SDimitry Andric requires indirectly_writable<iterator_t<R>, const T2&> && 58181ad6265SDimitry Andric indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T1*> 58281ad6265SDimitry Andric constexpr borrowed_iterator_t<R> 58381ad6265SDimitry Andric ranges::replace(R&& r, const T1& old_value, const T2& new_value, Proj proj = {}); // since C++20 58481ad6265SDimitry Andric 58581ad6265SDimitry Andric template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity, 58681ad6265SDimitry Andric indirect_unary_predicate<projected<I, Proj>> Pred> 58781ad6265SDimitry Andric requires indirectly_writable<I, const T&> 58881ad6265SDimitry Andric constexpr I ranges::replace_if(I first, S last, Pred pred, const T& new_value, Proj proj = {}); // since C++20 58981ad6265SDimitry Andric 59081ad6265SDimitry Andric template<input_range R, class T, class Proj = identity, 59181ad6265SDimitry Andric indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> 59281ad6265SDimitry Andric requires indirectly_writable<iterator_t<R>, const T&> 59381ad6265SDimitry Andric constexpr borrowed_iterator_t<R> 59481ad6265SDimitry Andric ranges::replace_if(R&& r, Pred pred, const T& new_value, Proj proj = {}); // since C++20 59581ad6265SDimitry Andric 59661cfbce3SDimitry Andric template<class T, class Proj = identity, 59761cfbce3SDimitry Andric indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less> 59861cfbce3SDimitry Andric constexpr const T& 59961cfbce3SDimitry Andric ranges::clamp(const T& v, const T& lo, const T& hi, Comp comp = {}, Proj proj = {}); // since C++20 60061cfbce3SDimitry Andric 60181ad6265SDimitry Andric template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, 60281ad6265SDimitry Andric class Proj1 = identity, class Proj2 = identity, 60381ad6265SDimitry Andric indirect_strict_weak_order<projected<I1, Proj1>, 60481ad6265SDimitry Andric projected<I2, Proj2>> Comp = ranges::less> 60581ad6265SDimitry Andric constexpr bool 60681ad6265SDimitry Andric ranges::lexicographical_compare(I1 first1, S1 last1, I2 first2, S2 last2, 60781ad6265SDimitry Andric Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 60881ad6265SDimitry Andric 60981ad6265SDimitry Andric template<input_range R1, input_range R2, class Proj1 = identity, 61081ad6265SDimitry Andric class Proj2 = identity, 61181ad6265SDimitry Andric indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>, 61281ad6265SDimitry Andric projected<iterator_t<R2>, Proj2>> Comp = ranges::less> 61381ad6265SDimitry Andric constexpr bool 61481ad6265SDimitry Andric ranges::lexicographical_compare(R1&& r1, R2&& r2, Comp comp = {}, 61581ad6265SDimitry Andric Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 61681ad6265SDimitry Andric 61781ad6265SDimitry Andric template<bidirectional_iterator I1, sentinel_for<I1> S1, bidirectional_iterator I2> 61881ad6265SDimitry Andric requires indirectly_movable<I1, I2> 61981ad6265SDimitry Andric constexpr ranges::move_backward_result<I1, I2> 62081ad6265SDimitry Andric ranges::move_backward(I1 first, S1 last, I2 result); // since C++20 62181ad6265SDimitry Andric 62281ad6265SDimitry Andric template<bidirectional_range R, bidirectional_iterator I> 62381ad6265SDimitry Andric requires indirectly_movable<iterator_t<R>, I> 62481ad6265SDimitry Andric constexpr ranges::move_backward_result<borrowed_iterator_t<R>, I> 62581ad6265SDimitry Andric ranges::move_backward(R&& r, I result); // since C++20 62681ad6265SDimitry Andric 62781ad6265SDimitry Andric template<input_iterator I, sentinel_for<I> S, weakly_incrementable O> 62881ad6265SDimitry Andric requires indirectly_movable<I, O> 62981ad6265SDimitry Andric constexpr ranges::move_result<I, O> 63081ad6265SDimitry Andric ranges::move(I first, S last, O result); // since C++20 63181ad6265SDimitry Andric 63281ad6265SDimitry Andric template<input_range R, weakly_incrementable O> 63381ad6265SDimitry Andric requires indirectly_movable<iterator_t<R>, O> 63481ad6265SDimitry Andric constexpr ranges::move_result<borrowed_iterator_t<R>, O> 63581ad6265SDimitry Andric ranges::move(R&& r, O result); // since C++20 63681ad6265SDimitry Andric 637fcaf7f86SDimitry Andric template<class I, class O1, class O2> 638fcaf7f86SDimitry Andric using partition_copy_result = in_out_out_result<I, O1, O2>; // since C++20 639fcaf7f86SDimitry Andric 640fcaf7f86SDimitry Andric template<input_iterator I, sentinel_for<I> S, 641fcaf7f86SDimitry Andric weakly_incrementable O1, weakly_incrementable O2, 642fcaf7f86SDimitry Andric class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred> 643fcaf7f86SDimitry Andric requires indirectly_copyable<I, O1> && indirectly_copyable<I, O2> 644fcaf7f86SDimitry Andric constexpr partition_copy_result<I, O1, O2> 645fcaf7f86SDimitry Andric partition_copy(I first, S last, O1 out_true, O2 out_false, Pred pred, 646fcaf7f86SDimitry Andric Proj proj = {}); // Since C++20 647fcaf7f86SDimitry Andric 648fcaf7f86SDimitry Andric template<input_range R, weakly_incrementable O1, weakly_incrementable O2, 649fcaf7f86SDimitry Andric class Proj = identity, 650fcaf7f86SDimitry Andric indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> 651fcaf7f86SDimitry Andric requires indirectly_copyable<iterator_t<R>, O1> && 652fcaf7f86SDimitry Andric indirectly_copyable<iterator_t<R>, O2> 653fcaf7f86SDimitry Andric constexpr partition_copy_result<borrowed_iterator_t<R>, O1, O2> 654fcaf7f86SDimitry Andric partition_copy(R&& r, O1 out_true, O2 out_false, Pred pred, Proj proj = {}); // Since C++20 655fcaf7f86SDimitry Andric 656fcaf7f86SDimitry Andric template<forward_iterator I, sentinel_for<I> S, class Proj = identity, 657fcaf7f86SDimitry Andric indirect_unary_predicate<projected<I, Proj>> Pred> 658fcaf7f86SDimitry Andric constexpr I partition_point(I first, S last, Pred pred, Proj proj = {}); // Since C++20 659fcaf7f86SDimitry Andric 660fcaf7f86SDimitry Andric template<forward_range R, class Proj = identity, 661fcaf7f86SDimitry Andric indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> 662fcaf7f86SDimitry Andric constexpr borrowed_iterator_t<R> 663fcaf7f86SDimitry Andric partition_point(R&& r, Pred pred, Proj proj = {}); // Since C++20 664fcaf7f86SDimitry Andric 665753f127fSDimitry Andric template<class I1, class I2, class O> 666753f127fSDimitry Andric using merge_result = in_in_out_result<I1, I2, O>; // since C++20 667753f127fSDimitry Andric 668753f127fSDimitry Andric template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, 669753f127fSDimitry Andric weakly_incrementable O, class Comp = ranges::less, class Proj1 = identity, 670753f127fSDimitry Andric class Proj2 = identity> 671753f127fSDimitry Andric requires mergeable<I1, I2, O, Comp, Proj1, Proj2> 672753f127fSDimitry Andric constexpr merge_result<I1, I2, O> 673753f127fSDimitry Andric merge(I1 first1, S1 last1, I2 first2, S2 last2, O result, 674753f127fSDimitry Andric Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 675753f127fSDimitry Andric 676753f127fSDimitry Andric template<input_range R1, input_range R2, weakly_incrementable O, class Comp = ranges::less, 677753f127fSDimitry Andric class Proj1 = identity, class Proj2 = identity> 678753f127fSDimitry Andric requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2> 679753f127fSDimitry Andric constexpr merge_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O> 680753f127fSDimitry Andric merge(R1&& r1, R2&& r2, O result, 681753f127fSDimitry Andric Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 682753f127fSDimitry Andric 683753f127fSDimitry Andric template<permutable I, sentinel_for<I> S, class T, class Proj = identity> 684753f127fSDimitry Andric requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*> 685753f127fSDimitry Andric constexpr subrange<I> ranges::remove(I first, S last, const T& value, Proj proj = {}); // since C++20 686753f127fSDimitry Andric 687753f127fSDimitry Andric template<forward_range R, class T, class Proj = identity> 688753f127fSDimitry Andric requires permutable<iterator_t<R>> && 689753f127fSDimitry Andric indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*> 690753f127fSDimitry Andric constexpr borrowed_subrange_t<R> 691753f127fSDimitry Andric ranges::remove(R&& r, const T& value, Proj proj = {}); // since C++20 692753f127fSDimitry Andric 693753f127fSDimitry Andric template<permutable I, sentinel_for<I> S, class Proj = identity, 694753f127fSDimitry Andric indirect_unary_predicate<projected<I, Proj>> Pred> 695753f127fSDimitry Andric constexpr subrange<I> ranges::remove_if(I first, S last, Pred pred, Proj proj = {}); // since C++20 696753f127fSDimitry Andric 697753f127fSDimitry Andric template<forward_range R, class Proj = identity, 698753f127fSDimitry Andric indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> 699753f127fSDimitry Andric requires permutable<iterator_t<R>> 700753f127fSDimitry Andric constexpr borrowed_subrange_t<R> 701753f127fSDimitry Andric ranges::remove_if(R&& r, Pred pred, Proj proj = {}); // since C++20 702753f127fSDimitry Andric 703753f127fSDimitry Andric template<class I, class O> 704753f127fSDimitry Andric using set_difference_result = in_out_result<I, O>; // since C++20 705753f127fSDimitry Andric 706753f127fSDimitry Andric template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, 707753f127fSDimitry Andric weakly_incrementable O, class Comp = ranges::less, 708753f127fSDimitry Andric class Proj1 = identity, class Proj2 = identity> 709753f127fSDimitry Andric requires mergeable<I1, I2, O, Comp, Proj1, Proj2> 710753f127fSDimitry Andric constexpr set_difference_result<I1, O> 711753f127fSDimitry Andric set_difference(I1 first1, S1 last1, I2 first2, S2 last2, O result, 712753f127fSDimitry Andric Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 713753f127fSDimitry Andric 714753f127fSDimitry Andric template<input_range R1, input_range R2, weakly_incrementable O, 715753f127fSDimitry Andric class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity> 716753f127fSDimitry Andric requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2> 717753f127fSDimitry Andric constexpr set_difference_result<borrowed_iterator_t<R1>, O> 718753f127fSDimitry Andric set_difference(R1&& r1, R2&& r2, O result, 719753f127fSDimitry Andric Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 720753f127fSDimitry Andric 721753f127fSDimitry Andric template<class I1, class I2, class O> 722753f127fSDimitry Andric using set_intersection_result = in_in_out_result<I1, I2, O>; // since C++20 723753f127fSDimitry Andric 724753f127fSDimitry Andric template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, 725753f127fSDimitry Andric weakly_incrementable O, class Comp = ranges::less, 726753f127fSDimitry Andric class Proj1 = identity, class Proj2 = identity> 727753f127fSDimitry Andric requires mergeable<I1, I2, O, Comp, Proj1, Proj2> 728753f127fSDimitry Andric constexpr set_intersection_result<I1, I2, O> 729753f127fSDimitry Andric set_intersection(I1 first1, S1 last1, I2 first2, S2 last2, O result, 730753f127fSDimitry Andric Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 731753f127fSDimitry Andric 732753f127fSDimitry Andric template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, 733753f127fSDimitry Andric weakly_incrementable O, class Comp = ranges::less, 734753f127fSDimitry Andric class Proj1 = identity, class Proj2 = identity> 735753f127fSDimitry Andric requires mergeable<I1, I2, O, Comp, Proj1, Proj2> 736753f127fSDimitry Andric constexpr set_intersection_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O> 737753f127fSDimitry Andric set_intersection(R1&& r1, R2&& r2, O result, 738753f127fSDimitry Andric Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 739753f127fSDimitry Andric 740753f127fSDimitry Andric template <class _InIter, class _OutIter> 741753f127fSDimitry Andric using reverse_copy_result = in_out_result<_InIter, _OutIter>; // since C++20 742753f127fSDimitry Andric 743753f127fSDimitry Andric template<bidirectional_iterator I, sentinel_for<I> S, weakly_incrementable O> 744753f127fSDimitry Andric requires indirectly_copyable<I, O> 745753f127fSDimitry Andric constexpr ranges::reverse_copy_result<I, O> 746753f127fSDimitry Andric ranges::reverse_copy(I first, S last, O result); // since C++20 747753f127fSDimitry Andric 748753f127fSDimitry Andric template<bidirectional_range R, weakly_incrementable O> 749753f127fSDimitry Andric requires indirectly_copyable<iterator_t<R>, O> 750753f127fSDimitry Andric constexpr ranges::reverse_copy_result<borrowed_iterator_t<R>, O> 751753f127fSDimitry Andric ranges::reverse_copy(R&& r, O result); // since C++20 752753f127fSDimitry Andric 75361cfbce3SDimitry Andric template<permutable I, sentinel_for<I> S> 75461cfbce3SDimitry Andric constexpr subrange<I> rotate(I first, I middle, S last); // since C++20 75561cfbce3SDimitry Andric 75661cfbce3SDimitry Andric template<forward_range R> 75761cfbce3SDimitry Andric requires permutable<iterator_t<R>> 75861cfbce3SDimitry Andric constexpr borrowed_subrange_t<R> rotate(R&& r, iterator_t<R> middle); // Since C++20 75961cfbce3SDimitry Andric 760753f127fSDimitry Andric template <class _InIter, class _OutIter> 761753f127fSDimitry Andric using rotate_copy_result = in_out_result<_InIter, _OutIter>; // since C++20 762753f127fSDimitry Andric 763753f127fSDimitry Andric template<forward_iterator I, sentinel_for<I> S, weakly_incrementable O> 764753f127fSDimitry Andric requires indirectly_copyable<I, O> 765753f127fSDimitry Andric constexpr ranges::rotate_copy_result<I, O> 766753f127fSDimitry Andric ranges::rotate_copy(I first, I middle, S last, O result); // since C++20 767753f127fSDimitry Andric 768753f127fSDimitry Andric template<forward_range R, weakly_incrementable O> 769753f127fSDimitry Andric requires indirectly_copyable<iterator_t<R>, O> 770753f127fSDimitry Andric constexpr ranges::rotate_copy_result<borrowed_iterator_t<R>, O> 771753f127fSDimitry Andric ranges::rotate_copy(R&& r, iterator_t<R> middle, O result); // since C++20 772753f127fSDimitry Andric 77361cfbce3SDimitry Andric template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Gen> 77461cfbce3SDimitry Andric requires (forward_iterator<I> || random_access_iterator<O>) && 77561cfbce3SDimitry Andric indirectly_copyable<I, O> && 77661cfbce3SDimitry Andric uniform_random_bit_generator<remove_reference_t<Gen>> 77761cfbce3SDimitry Andric O sample(I first, S last, O out, iter_difference_t<I> n, Gen&& g); // Since C++20 77861cfbce3SDimitry Andric 77961cfbce3SDimitry Andric template<input_range R, weakly_incrementable O, class Gen> 78061cfbce3SDimitry Andric requires (forward_range<R> || random_access_iterator<O>) && 78161cfbce3SDimitry Andric indirectly_copyable<iterator_t<R>, O> && 78261cfbce3SDimitry Andric uniform_random_bit_generator<remove_reference_t<Gen>> 78361cfbce3SDimitry Andric O sample(R&& r, O out, range_difference_t<R> n, Gen&& g); // Since C++20 78461cfbce3SDimitry Andric 785fcaf7f86SDimitry Andric template<random_access_iterator I, sentinel_for<I> S, class Gen> 786fcaf7f86SDimitry Andric requires permutable<I> && 787fcaf7f86SDimitry Andric uniform_random_bit_generator<remove_reference_t<Gen>> 788fcaf7f86SDimitry Andric I shuffle(I first, S last, Gen&& g); // Since C++20 789fcaf7f86SDimitry Andric 790fcaf7f86SDimitry Andric template<random_access_range R, class Gen> 791fcaf7f86SDimitry Andric requires permutable<iterator_t<R>> && 792fcaf7f86SDimitry Andric uniform_random_bit_generator<remove_reference_t<Gen>> 793fcaf7f86SDimitry Andric borrowed_iterator_t<R> shuffle(R&& r, Gen&& g); // Since C++20 794fcaf7f86SDimitry Andric 795753f127fSDimitry Andric template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2, 79661cfbce3SDimitry Andric sentinel_for<I2> S2, class Proj1 = identity, class Proj2 = identity, 79761cfbce3SDimitry Andric indirect_equivalence_relation<projected<I1, Proj1>, 79861cfbce3SDimitry Andric projected<I2, Proj2>> Pred = ranges::equal_to> 79961cfbce3SDimitry Andric constexpr bool ranges::is_permutation(I1 first1, S1 last1, I2 first2, S2 last2, 80061cfbce3SDimitry Andric Pred pred = {}, 80161cfbce3SDimitry Andric Proj1 proj1 = {}, Proj2 proj2 = {}); // Since C++20 80261cfbce3SDimitry Andric 80361cfbce3SDimitry Andric template<forward_range R1, forward_range R2, 80461cfbce3SDimitry Andric class Proj1 = identity, class Proj2 = identity, 80561cfbce3SDimitry Andric indirect_equivalence_relation<projected<iterator_t<R1>, Proj1>, 80661cfbce3SDimitry Andric projected<iterator_t<R2>, Proj2>> Pred = ranges::equal_to> 80761cfbce3SDimitry Andric constexpr bool ranges::is_permutation(R1&& r1, R2&& r2, Pred pred = {}, 80861cfbce3SDimitry Andric Proj1 proj1 = {}, Proj2 proj2 = {}); // Since C++20 80961cfbce3SDimitry Andric 81061cfbce3SDimitry Andric template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2, 811753f127fSDimitry Andric sentinel_for<I2> S2, class Pred = ranges::equal_to, 812753f127fSDimitry Andric class Proj1 = identity, class Proj2 = identity> 813753f127fSDimitry Andric requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2> 814753f127fSDimitry Andric constexpr subrange<I1> 815753f127fSDimitry Andric ranges::search(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, 816753f127fSDimitry Andric Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 817753f127fSDimitry Andric 818753f127fSDimitry Andric template<forward_range R1, forward_range R2, class Pred = ranges::equal_to, 819753f127fSDimitry Andric class Proj1 = identity, class Proj2 = identity> 820753f127fSDimitry Andric requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2> 821753f127fSDimitry Andric constexpr borrowed_subrange_t<R1> 822753f127fSDimitry Andric ranges::search(R1&& r1, R2&& r2, Pred pred = {}, 823753f127fSDimitry Andric Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 824753f127fSDimitry Andric 825753f127fSDimitry Andric template<forward_iterator I, sentinel_for<I> S, class T, 826753f127fSDimitry Andric class Pred = ranges::equal_to, class Proj = identity> 827753f127fSDimitry Andric requires indirectly_comparable<I, const T*, Pred, Proj> 828753f127fSDimitry Andric constexpr subrange<I> 829753f127fSDimitry Andric ranges::search_n(I first, S last, iter_difference_t<I> count, 830753f127fSDimitry Andric const T& value, Pred pred = {}, Proj proj = {}); // since C++20 831753f127fSDimitry Andric 832753f127fSDimitry Andric template<forward_range R, class T, class Pred = ranges::equal_to, 833753f127fSDimitry Andric class Proj = identity> 834753f127fSDimitry Andric requires indirectly_comparable<iterator_t<R>, const T*, Pred, Proj> 835753f127fSDimitry Andric constexpr borrowed_subrange_t<R> 836753f127fSDimitry Andric ranges::search_n(R&& r, range_difference_t<R> count, 837753f127fSDimitry Andric const T& value, Pred pred = {}, Proj proj = {}); // since C++20 838753f127fSDimitry Andric 839753f127fSDimitry Andric template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2, 840753f127fSDimitry Andric class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> 841753f127fSDimitry Andric requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2> 842753f127fSDimitry Andric constexpr subrange<I1> 843753f127fSDimitry Andric ranges::find_end(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, 844753f127fSDimitry Andric Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 845753f127fSDimitry Andric 846753f127fSDimitry Andric template<forward_range R1, forward_range R2, 847753f127fSDimitry Andric class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> 848753f127fSDimitry Andric requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2> 849753f127fSDimitry Andric constexpr borrowed_subrange_t<R1> 850753f127fSDimitry Andric ranges::find_end(R1&& r1, R2&& r2, Pred pred = {}, 851753f127fSDimitry Andric Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 852753f127fSDimitry Andric 853753f127fSDimitry Andric template<class I1, class I2, class O> 854753f127fSDimitry Andric using set_symmetric_difference_result = in_in_out_result<I1, I2, O>; // since C++20 855753f127fSDimitry Andric 856753f127fSDimitry Andric template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, 857753f127fSDimitry Andric weakly_incrementable O, class Comp = ranges::less, 858753f127fSDimitry Andric class Proj1 = identity, class Proj2 = identity> 859753f127fSDimitry Andric requires mergeable<I1, I2, O, Comp, Proj1, Proj2> 860753f127fSDimitry Andric constexpr set_symmetric_difference_result<I1, I2, O> 861753f127fSDimitry Andric set_symmetric_difference(I1 first1, S1 last1, I2 first2, S2 last2, O result, 862753f127fSDimitry Andric Comp comp = {}, Proj1 proj1 = {}, 863753f127fSDimitry Andric Proj2 proj2 = {}); // since C++20 864753f127fSDimitry Andric 865753f127fSDimitry Andric template<input_range R1, input_range R2, weakly_incrementable O, 866753f127fSDimitry Andric class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity> 867753f127fSDimitry Andric requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2> 868753f127fSDimitry Andric constexpr set_symmetric_difference_result<borrowed_iterator_t<R1>, 869753f127fSDimitry Andric borrowed_iterator_t<R2>, O> 870753f127fSDimitry Andric set_symmetric_difference(R1&& r1, R2&& r2, O result, Comp comp = {}, 871753f127fSDimitry Andric Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 87281ad6265SDimitry Andric 873fcaf7f86SDimitry Andric template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity, 874fcaf7f86SDimitry Andric indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less> 875fcaf7f86SDimitry Andric constexpr subrange<I> 876fcaf7f86SDimitry Andric equal_range(I first, S last, const T& value, Comp comp = {}, Proj proj = {}); // since C++20 877fcaf7f86SDimitry Andric 878fcaf7f86SDimitry Andric template<forward_range R, class T, class Proj = identity, 879fcaf7f86SDimitry Andric indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp = 880fcaf7f86SDimitry Andric ranges::less> 881fcaf7f86SDimitry Andric constexpr borrowed_subrange_t<R> 882fcaf7f86SDimitry Andric equal_range(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20 883fcaf7f86SDimitry Andric 884fcaf7f86SDimitry Andric template<class I1, class I2, class O> 885fcaf7f86SDimitry Andric using set_union_result = in_in_out_result<I1, I2, O>; // since C++20 886fcaf7f86SDimitry Andric 887fcaf7f86SDimitry Andric template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, 888fcaf7f86SDimitry Andric weakly_incrementable O, class Comp = ranges::less, 889fcaf7f86SDimitry Andric class Proj1 = identity, class Proj2 = identity> 890fcaf7f86SDimitry Andric requires mergeable<I1, I2, O, Comp, Proj1, Proj2> 891fcaf7f86SDimitry Andric constexpr set_union_result<I1, I2, O> 892fcaf7f86SDimitry Andric set_union(I1 first1, S1 last1, I2 first2, S2 last2, O result, Comp comp = {}, 893fcaf7f86SDimitry Andric Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 894fcaf7f86SDimitry Andric 895fcaf7f86SDimitry Andric template<input_range R1, input_range R2, weakly_incrementable O, 896fcaf7f86SDimitry Andric class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity> 897fcaf7f86SDimitry Andric requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2> 898fcaf7f86SDimitry Andric constexpr set_union_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O> 899fcaf7f86SDimitry Andric set_union(R1&& r1, R2&& r2, O result, Comp comp = {}, 900fcaf7f86SDimitry Andric Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 901fcaf7f86SDimitry Andric 902fcaf7f86SDimitry Andric template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, 903fcaf7f86SDimitry Andric class Proj1 = identity, class Proj2 = identity, 904fcaf7f86SDimitry Andric indirect_strict_weak_order<projected<I1, Proj1>, projected<I2, Proj2>> Comp = 905fcaf7f86SDimitry Andric ranges::less> 906fcaf7f86SDimitry Andric constexpr bool includes(I1 first1, S1 last1, I2 first2, S2 last2, Comp comp = {}, 907fcaf7f86SDimitry Andric Proj1 proj1 = {}, Proj2 proj2 = {}); // Since C++20 908fcaf7f86SDimitry Andric 909fcaf7f86SDimitry Andric template<input_range R1, input_range R2, class Proj1 = identity, 910fcaf7f86SDimitry Andric class Proj2 = identity, 911fcaf7f86SDimitry Andric indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>, 912fcaf7f86SDimitry Andric projected<iterator_t<R2>, Proj2>> Comp = ranges::less> 913fcaf7f86SDimitry Andric constexpr bool includes(R1&& r1, R2&& r2, Comp comp = {}, 914fcaf7f86SDimitry Andric Proj1 proj1 = {}, Proj2 proj2 = {}); // Since C++20 91561cfbce3SDimitry Andric 91661cfbce3SDimitry Andric template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less, 91761cfbce3SDimitry Andric class Proj = identity> 91861cfbce3SDimitry Andric requires sortable<I, Comp, Proj> 91961cfbce3SDimitry Andric I inplace_merge(I first, I middle, S last, Comp comp = {}, Proj proj = {}); // Since C++20 92061cfbce3SDimitry Andric 92161cfbce3SDimitry Andric template<bidirectional_range R, class Comp = ranges::less, class Proj = identity> 92261cfbce3SDimitry Andric requires sortable<iterator_t<R>, Comp, Proj> 92361cfbce3SDimitry Andric borrowed_iterator_t<R> 92461cfbce3SDimitry Andric inplace_merge(R&& r, iterator_t<R> middle, Comp comp = {}, 92561cfbce3SDimitry Andric Proj proj = {}); // Since C++20 92661cfbce3SDimitry Andric 92761cfbce3SDimitry Andric template<permutable I, sentinel_for<I> S, class Proj = identity, 92861cfbce3SDimitry Andric indirect_equivalence_relation<projected<I, Proj>> C = ranges::equal_to> 92961cfbce3SDimitry Andric constexpr subrange<I> unique(I first, S last, C comp = {}, Proj proj = {}); // Since C++20 93061cfbce3SDimitry Andric 93161cfbce3SDimitry Andric template<forward_range R, class Proj = identity, 93261cfbce3SDimitry Andric indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to> 93361cfbce3SDimitry Andric requires permutable<iterator_t<R>> 93461cfbce3SDimitry Andric constexpr borrowed_subrange_t<R> 93561cfbce3SDimitry Andric unique(R&& r, C comp = {}, Proj proj = {}); // Since C++20 93661cfbce3SDimitry Andric 93761cfbce3SDimitry Andric template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Proj = identity, 93861cfbce3SDimitry Andric indirect_equivalence_relation<projected<I, Proj>> C = ranges::equal_to> 93961cfbce3SDimitry Andric requires indirectly_copyable<I, O> && 94061cfbce3SDimitry Andric (forward_iterator<I> || 94161cfbce3SDimitry Andric (input_iterator<O> && same_as<iter_value_t<I>, iter_value_t<O>>) || 94261cfbce3SDimitry Andric indirectly_copyable_storable<I, O>) 94361cfbce3SDimitry Andric constexpr unique_copy_result<I, O> 94461cfbce3SDimitry Andric unique_copy(I first, S last, O result, C comp = {}, Proj proj = {}); // Since C++20 94561cfbce3SDimitry Andric 94661cfbce3SDimitry Andric template<input_range R, weakly_incrementable O, class Proj = identity, 94761cfbce3SDimitry Andric indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to> 94861cfbce3SDimitry Andric requires indirectly_copyable<iterator_t<R>, O> && 94961cfbce3SDimitry Andric (forward_iterator<iterator_t<R>> || 95061cfbce3SDimitry Andric (input_iterator<O> && same_as<range_value_t<R>, iter_value_t<O>>) || 95161cfbce3SDimitry Andric indirectly_copyable_storable<iterator_t<R>, O>) 95261cfbce3SDimitry Andric constexpr unique_copy_result<borrowed_iterator_t<R>, O> 95361cfbce3SDimitry Andric unique_copy(R&& r, O result, C comp = {}, Proj proj = {}); // Since C++20 95461cfbce3SDimitry Andric 95561cfbce3SDimitry Andric template<class I, class O> 95661cfbce3SDimitry Andric using remove_copy_result = in_out_result<I, O>; // Since C++20 95761cfbce3SDimitry Andric 95861cfbce3SDimitry Andric template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class T, 95961cfbce3SDimitry Andric class Proj = identity> 96061cfbce3SDimitry Andric indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*> 96161cfbce3SDimitry Andric constexpr remove_copy_result<I, O> 96261cfbce3SDimitry Andric remove_copy(I first, S last, O result, const T& value, Proj proj = {}); // Since C++20 96361cfbce3SDimitry Andric 96461cfbce3SDimitry Andric template<input_range R, weakly_incrementable O, class T, class Proj = identity> 96561cfbce3SDimitry Andric requires indirectly_copyable<iterator_t<R>, O> && 96661cfbce3SDimitry Andric indirect_binary_predicate<ranges::equal_to, 96761cfbce3SDimitry Andric projected<iterator_t<R>, Proj>, const T*> 96861cfbce3SDimitry Andric constexpr remove_copy_result<borrowed_iterator_t<R>, O> 96961cfbce3SDimitry Andric remove_copy(R&& r, O result, const T& value, Proj proj = {}); // Since C++20 97061cfbce3SDimitry Andric 97161cfbce3SDimitry Andric template<class I, class O> 97261cfbce3SDimitry Andric using remove_copy_if_result = in_out_result<I, O>; // Since C++20 97361cfbce3SDimitry Andric 97461cfbce3SDimitry Andric template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, 97561cfbce3SDimitry Andric class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred> 97661cfbce3SDimitry Andric requires indirectly_copyable<I, O> 97761cfbce3SDimitry Andric constexpr remove_copy_if_result<I, O> 97861cfbce3SDimitry Andric remove_copy_if(I first, S last, O result, Pred pred, Proj proj = {}); // Since C++20 97961cfbce3SDimitry Andric 98061cfbce3SDimitry Andric template<input_range R, weakly_incrementable O, class Proj = identity, 98161cfbce3SDimitry Andric indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> 98261cfbce3SDimitry Andric requires indirectly_copyable<iterator_t<R>, O> 98361cfbce3SDimitry Andric constexpr remove_copy_if_result<borrowed_iterator_t<R>, O> 98461cfbce3SDimitry Andric remove_copy_if(R&& r, O result, Pred pred, Proj proj = {}); // Since C++20 98561cfbce3SDimitry Andric 98661cfbce3SDimitry Andric template<class I, class O> 98761cfbce3SDimitry Andric using replace_copy_result = in_out_result<I, O>; // Since C++20 98861cfbce3SDimitry Andric 98961cfbce3SDimitry Andric template<input_iterator I, sentinel_for<I> S, class T1, class T2, 99061cfbce3SDimitry Andric output_iterator<const T2&> O, class Proj = identity> 99161cfbce3SDimitry Andric requires indirectly_copyable<I, O> && 99261cfbce3SDimitry Andric indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*> 99361cfbce3SDimitry Andric constexpr replace_copy_result<I, O> 99461cfbce3SDimitry Andric replace_copy(I first, S last, O result, const T1& old_value, const T2& new_value, 99561cfbce3SDimitry Andric Proj proj = {}); // Since C++20 99661cfbce3SDimitry Andric 99761cfbce3SDimitry Andric template<input_range R, class T1, class T2, output_iterator<const T2&> O, 99861cfbce3SDimitry Andric class Proj = identity> 99961cfbce3SDimitry Andric requires indirectly_copyable<iterator_t<R>, O> && 100061cfbce3SDimitry Andric indirect_binary_predicate<ranges::equal_to, 100161cfbce3SDimitry Andric projected<iterator_t<R>, Proj>, const T1*> 100261cfbce3SDimitry Andric constexpr replace_copy_result<borrowed_iterator_t<R>, O> 100361cfbce3SDimitry Andric replace_copy(R&& r, O result, const T1& old_value, const T2& new_value, 100461cfbce3SDimitry Andric Proj proj = {}); // Since C++20 100561cfbce3SDimitry Andric 100661cfbce3SDimitry Andric template<class I, class O> 100761cfbce3SDimitry Andric using replace_copy_if_result = in_out_result<I, O>; // Since C++20 100861cfbce3SDimitry Andric 100961cfbce3SDimitry Andric template<input_iterator I, sentinel_for<I> S, class T, output_iterator<const T&> O, 101061cfbce3SDimitry Andric class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred> 101161cfbce3SDimitry Andric requires indirectly_copyable<I, O> 101261cfbce3SDimitry Andric constexpr replace_copy_if_result<I, O> 101361cfbce3SDimitry Andric replace_copy_if(I first, S last, O result, Pred pred, const T& new_value, 101461cfbce3SDimitry Andric Proj proj = {}); // Since C++20 101561cfbce3SDimitry Andric 101661cfbce3SDimitry Andric template<input_range R, class T, output_iterator<const T&> O, class Proj = identity, 101761cfbce3SDimitry Andric indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> 101861cfbce3SDimitry Andric requires indirectly_copyable<iterator_t<R>, O> 101961cfbce3SDimitry Andric constexpr replace_copy_if_result<borrowed_iterator_t<R>, O> 102061cfbce3SDimitry Andric replace_copy_if(R&& r, O result, Pred pred, const T& new_value, 102161cfbce3SDimitry Andric Proj proj = {}); // Since C++20 102261cfbce3SDimitry Andric 102361cfbce3SDimitry Andric template<class I> 102461cfbce3SDimitry Andric using prev_permutation_result = in_found_result<I>; // Since C++20 102561cfbce3SDimitry Andric 102661cfbce3SDimitry Andric template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less, 102761cfbce3SDimitry Andric class Proj = identity> 102861cfbce3SDimitry Andric requires sortable<I, Comp, Proj> 102961cfbce3SDimitry Andric constexpr ranges::prev_permutation_result<I> 103061cfbce3SDimitry Andric ranges::prev_permutation(I first, S last, Comp comp = {}, Proj proj = {}); // Since C++20 103161cfbce3SDimitry Andric 103261cfbce3SDimitry Andric template<bidirectional_range R, class Comp = ranges::less, 103361cfbce3SDimitry Andric class Proj = identity> 103461cfbce3SDimitry Andric requires sortable<iterator_t<R>, Comp, Proj> 103561cfbce3SDimitry Andric constexpr ranges::prev_permutation_result<borrowed_iterator_t<R>> 103661cfbce3SDimitry Andric ranges::prev_permutation(R&& r, Comp comp = {}, Proj proj = {}); // Since C++20 103761cfbce3SDimitry Andric 103861cfbce3SDimitry Andric template<class I> 103961cfbce3SDimitry Andric using next_permutation_result = in_found_result<I>; // Since C++20 104061cfbce3SDimitry Andric 104161cfbce3SDimitry Andric template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less, 104261cfbce3SDimitry Andric class Proj = identity> 104361cfbce3SDimitry Andric requires sortable<I, Comp, Proj> 104461cfbce3SDimitry Andric constexpr ranges::next_permutation_result<I> 104561cfbce3SDimitry Andric ranges::next_permutation(I first, S last, Comp comp = {}, Proj proj = {}); // Since C++20 104661cfbce3SDimitry Andric 104761cfbce3SDimitry Andric template<bidirectional_range R, class Comp = ranges::less, 104861cfbce3SDimitry Andric class Proj = identity> 104961cfbce3SDimitry Andric requires sortable<iterator_t<R>, Comp, Proj> 105061cfbce3SDimitry Andric constexpr ranges::next_permutation_result<borrowed_iterator_t<R>> 105161cfbce3SDimitry Andric ranges::next_permutation(R&& r, Comp comp = {}, Proj proj = {}); // Since C++20 105261cfbce3SDimitry Andric 105304eeddc0SDimitry Andric} 105404eeddc0SDimitry Andric 105561cfbce3SDimitry Andrictemplate <class InputIterator, class Predicate> 1056*0b57cec5SDimitry Andric constexpr bool // constexpr in C++20 1057*0b57cec5SDimitry Andric all_of(InputIterator first, InputIterator last, Predicate pred); 1058*0b57cec5SDimitry Andric 1059*0b57cec5SDimitry Andrictemplate <class InputIterator, class Predicate> 1060*0b57cec5SDimitry Andric constexpr bool // constexpr in C++20 1061*0b57cec5SDimitry Andric any_of(InputIterator first, InputIterator last, Predicate pred); 1062*0b57cec5SDimitry Andric 1063*0b57cec5SDimitry Andrictemplate <class InputIterator, class Predicate> 1064*0b57cec5SDimitry Andric constexpr bool // constexpr in C++20 1065*0b57cec5SDimitry Andric none_of(InputIterator first, InputIterator last, Predicate pred); 1066*0b57cec5SDimitry Andric 1067*0b57cec5SDimitry Andrictemplate <class InputIterator, class Function> 1068*0b57cec5SDimitry Andric constexpr Function // constexpr in C++20 1069*0b57cec5SDimitry Andric for_each(InputIterator first, InputIterator last, Function f); 1070*0b57cec5SDimitry Andric 1071*0b57cec5SDimitry Andrictemplate<class InputIterator, class Size, class Function> 1072*0b57cec5SDimitry Andric constexpr InputIterator // constexpr in C++20 1073*0b57cec5SDimitry Andric for_each_n(InputIterator first, Size n, Function f); // C++17 1074*0b57cec5SDimitry Andric 1075*0b57cec5SDimitry Andrictemplate <class InputIterator, class T> 1076*0b57cec5SDimitry Andric constexpr InputIterator // constexpr in C++20 1077*0b57cec5SDimitry Andric find(InputIterator first, InputIterator last, const T& value); 1078*0b57cec5SDimitry Andric 1079*0b57cec5SDimitry Andrictemplate <class InputIterator, class Predicate> 1080*0b57cec5SDimitry Andric constexpr InputIterator // constexpr in C++20 1081*0b57cec5SDimitry Andric find_if(InputIterator first, InputIterator last, Predicate pred); 1082*0b57cec5SDimitry Andric 1083*0b57cec5SDimitry Andrictemplate<class InputIterator, class Predicate> 1084e8d8bef9SDimitry Andric constexpr InputIterator // constexpr in C++20 1085*0b57cec5SDimitry Andric find_if_not(InputIterator first, InputIterator last, Predicate pred); 1086*0b57cec5SDimitry Andric 1087*0b57cec5SDimitry Andrictemplate <class ForwardIterator1, class ForwardIterator2> 1088e8d8bef9SDimitry Andric constexpr ForwardIterator1 // constexpr in C++20 1089*0b57cec5SDimitry Andric find_end(ForwardIterator1 first1, ForwardIterator1 last1, 1090*0b57cec5SDimitry Andric ForwardIterator2 first2, ForwardIterator2 last2); 1091*0b57cec5SDimitry Andric 1092*0b57cec5SDimitry Andrictemplate <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate> 1093e8d8bef9SDimitry Andric constexpr ForwardIterator1 // constexpr in C++20 1094*0b57cec5SDimitry Andric find_end(ForwardIterator1 first1, ForwardIterator1 last1, 1095*0b57cec5SDimitry Andric ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred); 1096*0b57cec5SDimitry Andric 1097*0b57cec5SDimitry Andrictemplate <class ForwardIterator1, class ForwardIterator2> 1098*0b57cec5SDimitry Andric constexpr ForwardIterator1 // constexpr in C++20 1099*0b57cec5SDimitry Andric find_first_of(ForwardIterator1 first1, ForwardIterator1 last1, 1100*0b57cec5SDimitry Andric ForwardIterator2 first2, ForwardIterator2 last2); 1101*0b57cec5SDimitry Andric 1102*0b57cec5SDimitry Andrictemplate <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate> 1103*0b57cec5SDimitry Andric constexpr ForwardIterator1 // constexpr in C++20 1104*0b57cec5SDimitry Andric find_first_of(ForwardIterator1 first1, ForwardIterator1 last1, 1105*0b57cec5SDimitry Andric ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred); 1106*0b57cec5SDimitry Andric 1107*0b57cec5SDimitry Andrictemplate <class ForwardIterator> 1108*0b57cec5SDimitry Andric constexpr ForwardIterator // constexpr in C++20 1109*0b57cec5SDimitry Andric adjacent_find(ForwardIterator first, ForwardIterator last); 1110*0b57cec5SDimitry Andric 1111*0b57cec5SDimitry Andrictemplate <class ForwardIterator, class BinaryPredicate> 1112*0b57cec5SDimitry Andric constexpr ForwardIterator // constexpr in C++20 1113*0b57cec5SDimitry Andric adjacent_find(ForwardIterator first, ForwardIterator last, BinaryPredicate pred); 1114*0b57cec5SDimitry Andric 1115*0b57cec5SDimitry Andrictemplate <class InputIterator, class T> 1116*0b57cec5SDimitry Andric constexpr typename iterator_traits<InputIterator>::difference_type // constexpr in C++20 1117*0b57cec5SDimitry Andric count(InputIterator first, InputIterator last, const T& value); 1118*0b57cec5SDimitry Andric 1119*0b57cec5SDimitry Andrictemplate <class InputIterator, class Predicate> 1120*0b57cec5SDimitry Andric constexpr typename iterator_traits<InputIterator>::difference_type // constexpr in C++20 1121*0b57cec5SDimitry Andric count_if(InputIterator first, InputIterator last, Predicate pred); 1122*0b57cec5SDimitry Andric 1123*0b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2> 1124*0b57cec5SDimitry Andric constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20 1125*0b57cec5SDimitry Andric mismatch(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2); 1126*0b57cec5SDimitry Andric 1127*0b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2> 1128*0b57cec5SDimitry Andric constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20 1129*0b57cec5SDimitry Andric mismatch(InputIterator1 first1, InputIterator1 last1, 1130*0b57cec5SDimitry Andric InputIterator2 first2, InputIterator2 last2); // **C++14** 1131*0b57cec5SDimitry Andric 1132*0b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class BinaryPredicate> 1133*0b57cec5SDimitry Andric constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20 1134*0b57cec5SDimitry Andric mismatch(InputIterator1 first1, InputIterator1 last1, 1135*0b57cec5SDimitry Andric InputIterator2 first2, BinaryPredicate pred); 1136*0b57cec5SDimitry Andric 1137*0b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class BinaryPredicate> 1138*0b57cec5SDimitry Andric constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20 1139*0b57cec5SDimitry Andric mismatch(InputIterator1 first1, InputIterator1 last1, 1140*0b57cec5SDimitry Andric InputIterator2 first2, InputIterator2 last2, 1141*0b57cec5SDimitry Andric BinaryPredicate pred); // **C++14** 1142*0b57cec5SDimitry Andric 1143*0b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2> 1144*0b57cec5SDimitry Andric constexpr bool // constexpr in C++20 1145*0b57cec5SDimitry Andric equal(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2); 1146*0b57cec5SDimitry Andric 1147*0b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2> 1148*0b57cec5SDimitry Andric constexpr bool // constexpr in C++20 1149*0b57cec5SDimitry Andric equal(InputIterator1 first1, InputIterator1 last1, 1150*0b57cec5SDimitry Andric InputIterator2 first2, InputIterator2 last2); // **C++14** 1151*0b57cec5SDimitry Andric 1152*0b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class BinaryPredicate> 1153*0b57cec5SDimitry Andric constexpr bool // constexpr in C++20 1154*0b57cec5SDimitry Andric equal(InputIterator1 first1, InputIterator1 last1, 1155*0b57cec5SDimitry Andric InputIterator2 first2, BinaryPredicate pred); 1156*0b57cec5SDimitry Andric 1157*0b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class BinaryPredicate> 1158*0b57cec5SDimitry Andric constexpr bool // constexpr in C++20 1159*0b57cec5SDimitry Andric equal(InputIterator1 first1, InputIterator1 last1, 1160*0b57cec5SDimitry Andric InputIterator2 first2, InputIterator2 last2, 1161*0b57cec5SDimitry Andric BinaryPredicate pred); // **C++14** 1162*0b57cec5SDimitry Andric 1163*0b57cec5SDimitry Andrictemplate<class ForwardIterator1, class ForwardIterator2> 1164*0b57cec5SDimitry Andric constexpr bool // constexpr in C++20 1165*0b57cec5SDimitry Andric is_permutation(ForwardIterator1 first1, ForwardIterator1 last1, 1166*0b57cec5SDimitry Andric ForwardIterator2 first2); 1167*0b57cec5SDimitry Andric 1168*0b57cec5SDimitry Andrictemplate<class ForwardIterator1, class ForwardIterator2> 1169*0b57cec5SDimitry Andric constexpr bool // constexpr in C++20 1170*0b57cec5SDimitry Andric is_permutation(ForwardIterator1 first1, ForwardIterator1 last1, 1171*0b57cec5SDimitry Andric ForwardIterator2 first2, ForwardIterator2 last2); // **C++14** 1172*0b57cec5SDimitry Andric 1173*0b57cec5SDimitry Andrictemplate<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate> 1174*0b57cec5SDimitry Andric constexpr bool // constexpr in C++20 1175*0b57cec5SDimitry Andric is_permutation(ForwardIterator1 first1, ForwardIterator1 last1, 1176*0b57cec5SDimitry Andric ForwardIterator2 first2, BinaryPredicate pred); 1177*0b57cec5SDimitry Andric 1178*0b57cec5SDimitry Andrictemplate<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate> 1179*0b57cec5SDimitry Andric constexpr bool // constexpr in C++20 1180*0b57cec5SDimitry Andric is_permutation(ForwardIterator1 first1, ForwardIterator1 last1, 1181*0b57cec5SDimitry Andric ForwardIterator2 first2, ForwardIterator2 last2, 1182*0b57cec5SDimitry Andric BinaryPredicate pred); // **C++14** 1183*0b57cec5SDimitry Andric 1184*0b57cec5SDimitry Andrictemplate <class ForwardIterator1, class ForwardIterator2> 1185*0b57cec5SDimitry Andric constexpr ForwardIterator1 // constexpr in C++20 1186*0b57cec5SDimitry Andric search(ForwardIterator1 first1, ForwardIterator1 last1, 1187*0b57cec5SDimitry Andric ForwardIterator2 first2, ForwardIterator2 last2); 1188*0b57cec5SDimitry Andric 1189*0b57cec5SDimitry Andrictemplate <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate> 1190*0b57cec5SDimitry Andric constexpr ForwardIterator1 // constexpr in C++20 1191*0b57cec5SDimitry Andric search(ForwardIterator1 first1, ForwardIterator1 last1, 1192*0b57cec5SDimitry Andric ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred); 1193*0b57cec5SDimitry Andric 1194*0b57cec5SDimitry Andrictemplate <class ForwardIterator, class Size, class T> 1195*0b57cec5SDimitry Andric constexpr ForwardIterator // constexpr in C++20 1196*0b57cec5SDimitry Andric search_n(ForwardIterator first, ForwardIterator last, Size count, const T& value); 1197*0b57cec5SDimitry Andric 1198*0b57cec5SDimitry Andrictemplate <class ForwardIterator, class Size, class T, class BinaryPredicate> 1199*0b57cec5SDimitry Andric constexpr ForwardIterator // constexpr in C++20 1200*0b57cec5SDimitry Andric search_n(ForwardIterator first, ForwardIterator last, 1201*0b57cec5SDimitry Andric Size count, const T& value, BinaryPredicate pred); 1202*0b57cec5SDimitry Andric 1203*0b57cec5SDimitry Andrictemplate <class InputIterator, class OutputIterator> 1204480093f4SDimitry Andric constexpr OutputIterator // constexpr in C++20 1205*0b57cec5SDimitry Andric copy(InputIterator first, InputIterator last, OutputIterator result); 1206*0b57cec5SDimitry Andric 1207*0b57cec5SDimitry Andrictemplate<class InputIterator, class OutputIterator, class Predicate> 1208480093f4SDimitry Andric constexpr OutputIterator // constexpr in C++20 1209*0b57cec5SDimitry Andric copy_if(InputIterator first, InputIterator last, 1210*0b57cec5SDimitry Andric OutputIterator result, Predicate pred); 1211*0b57cec5SDimitry Andric 1212*0b57cec5SDimitry Andrictemplate<class InputIterator, class Size, class OutputIterator> 1213480093f4SDimitry Andric constexpr OutputIterator // constexpr in C++20 1214*0b57cec5SDimitry Andric copy_n(InputIterator first, Size n, OutputIterator result); 1215*0b57cec5SDimitry Andric 1216*0b57cec5SDimitry Andrictemplate <class BidirectionalIterator1, class BidirectionalIterator2> 1217480093f4SDimitry Andric constexpr BidirectionalIterator2 // constexpr in C++20 1218*0b57cec5SDimitry Andric copy_backward(BidirectionalIterator1 first, BidirectionalIterator1 last, 1219*0b57cec5SDimitry Andric BidirectionalIterator2 result); 1220*0b57cec5SDimitry Andric 122181ad6265SDimitry Andric// [alg.move], move 122281ad6265SDimitry Andrictemplate<class InputIterator, class OutputIterator> 122381ad6265SDimitry Andric constexpr OutputIterator move(InputIterator first, InputIterator last, 122481ad6265SDimitry Andric OutputIterator result); 122581ad6265SDimitry Andric 122681ad6265SDimitry Andrictemplate<class BidirectionalIterator1, class BidirectionalIterator2> 122781ad6265SDimitry Andric constexpr BidirectionalIterator2 122881ad6265SDimitry Andric move_backward(BidirectionalIterator1 first, BidirectionalIterator1 last, 122981ad6265SDimitry Andric BidirectionalIterator2 result); 123081ad6265SDimitry Andric 1231*0b57cec5SDimitry Andrictemplate <class ForwardIterator1, class ForwardIterator2> 1232e8d8bef9SDimitry Andric constexpr ForwardIterator2 // constexpr in C++20 1233*0b57cec5SDimitry Andric swap_ranges(ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2); 1234*0b57cec5SDimitry Andric 123581ad6265SDimitry Andricnamespace ranges { 123681ad6265SDimitry Andric template<class I1, class I2> 123781ad6265SDimitry Andric using swap_ranges_result = in_in_result<I1, I2>; 123881ad6265SDimitry Andric 123981ad6265SDimitry Andrictemplate<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2> 124081ad6265SDimitry Andric requires indirectly_swappable<I1, I2> 124181ad6265SDimitry Andric constexpr ranges::swap_ranges_result<I1, I2> 124281ad6265SDimitry Andric swap_ranges(I1 first1, S1 last1, I2 first2, S2 last2); 124381ad6265SDimitry Andric 124481ad6265SDimitry Andrictemplate<input_range R1, input_range R2> 124581ad6265SDimitry Andric requires indirectly_swappable<iterator_t<R1>, iterator_t<R2>> 124681ad6265SDimitry Andric constexpr ranges::swap_ranges_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>> 124781ad6265SDimitry Andric swap_ranges(R1&& r1, R2&& r2); 124881ad6265SDimitry Andric} 124981ad6265SDimitry Andric 1250*0b57cec5SDimitry Andrictemplate <class ForwardIterator1, class ForwardIterator2> 1251e8d8bef9SDimitry Andric constexpr void // constexpr in C++20 1252*0b57cec5SDimitry Andric iter_swap(ForwardIterator1 a, ForwardIterator2 b); 1253*0b57cec5SDimitry Andric 1254*0b57cec5SDimitry Andrictemplate <class InputIterator, class OutputIterator, class UnaryOperation> 1255*0b57cec5SDimitry Andric constexpr OutputIterator // constexpr in C++20 1256*0b57cec5SDimitry Andric transform(InputIterator first, InputIterator last, OutputIterator result, UnaryOperation op); 1257*0b57cec5SDimitry Andric 1258*0b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator, class BinaryOperation> 1259*0b57cec5SDimitry Andric constexpr OutputIterator // constexpr in C++20 1260*0b57cec5SDimitry Andric transform(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, 1261*0b57cec5SDimitry Andric OutputIterator result, BinaryOperation binary_op); 1262*0b57cec5SDimitry Andric 1263*0b57cec5SDimitry Andrictemplate <class ForwardIterator, class T> 1264*0b57cec5SDimitry Andric constexpr void // constexpr in C++20 1265*0b57cec5SDimitry Andric replace(ForwardIterator first, ForwardIterator last, const T& old_value, const T& new_value); 1266*0b57cec5SDimitry Andric 1267*0b57cec5SDimitry Andrictemplate <class ForwardIterator, class Predicate, class T> 1268*0b57cec5SDimitry Andric constexpr void // constexpr in C++20 1269*0b57cec5SDimitry Andric replace_if(ForwardIterator first, ForwardIterator last, Predicate pred, const T& new_value); 1270*0b57cec5SDimitry Andric 1271*0b57cec5SDimitry Andrictemplate <class InputIterator, class OutputIterator, class T> 1272*0b57cec5SDimitry Andric constexpr OutputIterator // constexpr in C++20 1273*0b57cec5SDimitry Andric replace_copy(InputIterator first, InputIterator last, OutputIterator result, 1274*0b57cec5SDimitry Andric const T& old_value, const T& new_value); 1275*0b57cec5SDimitry Andric 1276*0b57cec5SDimitry Andrictemplate <class InputIterator, class OutputIterator, class Predicate, class T> 1277*0b57cec5SDimitry Andric constexpr OutputIterator // constexpr in C++20 1278*0b57cec5SDimitry Andric replace_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred, const T& new_value); 1279*0b57cec5SDimitry Andric 1280*0b57cec5SDimitry Andrictemplate <class ForwardIterator, class T> 1281*0b57cec5SDimitry Andric constexpr void // constexpr in C++20 1282*0b57cec5SDimitry Andric fill(ForwardIterator first, ForwardIterator last, const T& value); 1283*0b57cec5SDimitry Andric 1284*0b57cec5SDimitry Andrictemplate <class OutputIterator, class Size, class T> 1285*0b57cec5SDimitry Andric constexpr OutputIterator // constexpr in C++20 1286*0b57cec5SDimitry Andric fill_n(OutputIterator first, Size n, const T& value); 1287*0b57cec5SDimitry Andric 1288*0b57cec5SDimitry Andrictemplate <class ForwardIterator, class Generator> 1289*0b57cec5SDimitry Andric constexpr void // constexpr in C++20 1290*0b57cec5SDimitry Andric generate(ForwardIterator first, ForwardIterator last, Generator gen); 1291*0b57cec5SDimitry Andric 1292*0b57cec5SDimitry Andrictemplate <class OutputIterator, class Size, class Generator> 1293*0b57cec5SDimitry Andric constexpr OutputIterator // constexpr in C++20 1294*0b57cec5SDimitry Andric generate_n(OutputIterator first, Size n, Generator gen); 1295*0b57cec5SDimitry Andric 1296*0b57cec5SDimitry Andrictemplate <class ForwardIterator, class T> 1297*0b57cec5SDimitry Andric constexpr ForwardIterator // constexpr in C++20 1298*0b57cec5SDimitry Andric remove(ForwardIterator first, ForwardIterator last, const T& value); 1299*0b57cec5SDimitry Andric 1300*0b57cec5SDimitry Andrictemplate <class ForwardIterator, class Predicate> 1301*0b57cec5SDimitry Andric constexpr ForwardIterator // constexpr in C++20 1302*0b57cec5SDimitry Andric remove_if(ForwardIterator first, ForwardIterator last, Predicate pred); 1303*0b57cec5SDimitry Andric 1304*0b57cec5SDimitry Andrictemplate <class InputIterator, class OutputIterator, class T> 1305*0b57cec5SDimitry Andric constexpr OutputIterator // constexpr in C++20 1306*0b57cec5SDimitry Andric remove_copy(InputIterator first, InputIterator last, OutputIterator result, const T& value); 1307*0b57cec5SDimitry Andric 1308*0b57cec5SDimitry Andrictemplate <class InputIterator, class OutputIterator, class Predicate> 1309*0b57cec5SDimitry Andric constexpr OutputIterator // constexpr in C++20 1310*0b57cec5SDimitry Andric remove_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred); 1311*0b57cec5SDimitry Andric 1312*0b57cec5SDimitry Andrictemplate <class ForwardIterator> 1313e8d8bef9SDimitry Andric constexpr ForwardIterator // constexpr in C++20 1314*0b57cec5SDimitry Andric unique(ForwardIterator first, ForwardIterator last); 1315*0b57cec5SDimitry Andric 1316*0b57cec5SDimitry Andrictemplate <class ForwardIterator, class BinaryPredicate> 1317e8d8bef9SDimitry Andric constexpr ForwardIterator // constexpr in C++20 1318*0b57cec5SDimitry Andric unique(ForwardIterator first, ForwardIterator last, BinaryPredicate pred); 1319*0b57cec5SDimitry Andric 1320*0b57cec5SDimitry Andrictemplate <class InputIterator, class OutputIterator> 1321e8d8bef9SDimitry Andric constexpr OutputIterator // constexpr in C++20 1322*0b57cec5SDimitry Andric unique_copy(InputIterator first, InputIterator last, OutputIterator result); 1323*0b57cec5SDimitry Andric 1324*0b57cec5SDimitry Andrictemplate <class InputIterator, class OutputIterator, class BinaryPredicate> 1325e8d8bef9SDimitry Andric constexpr OutputIterator // constexpr in C++20 1326*0b57cec5SDimitry Andric unique_copy(InputIterator first, InputIterator last, OutputIterator result, BinaryPredicate pred); 1327*0b57cec5SDimitry Andric 1328*0b57cec5SDimitry Andrictemplate <class BidirectionalIterator> 1329e8d8bef9SDimitry Andric constexpr void // constexpr in C++20 1330*0b57cec5SDimitry Andric reverse(BidirectionalIterator first, BidirectionalIterator last); 1331*0b57cec5SDimitry Andric 1332*0b57cec5SDimitry Andrictemplate <class BidirectionalIterator, class OutputIterator> 1333*0b57cec5SDimitry Andric constexpr OutputIterator // constexpr in C++20 1334*0b57cec5SDimitry Andric reverse_copy(BidirectionalIterator first, BidirectionalIterator last, OutputIterator result); 1335*0b57cec5SDimitry Andric 1336*0b57cec5SDimitry Andrictemplate <class ForwardIterator> 1337e8d8bef9SDimitry Andric constexpr ForwardIterator // constexpr in C++20 1338*0b57cec5SDimitry Andric rotate(ForwardIterator first, ForwardIterator middle, ForwardIterator last); 1339*0b57cec5SDimitry Andric 1340*0b57cec5SDimitry Andrictemplate <class ForwardIterator, class OutputIterator> 1341e8d8bef9SDimitry Andric constexpr OutputIterator // constexpr in C++20 1342*0b57cec5SDimitry Andric rotate_copy(ForwardIterator first, ForwardIterator middle, ForwardIterator last, OutputIterator result); 1343*0b57cec5SDimitry Andric 1344*0b57cec5SDimitry Andrictemplate <class RandomAccessIterator> 1345*0b57cec5SDimitry Andric void 1346*0b57cec5SDimitry Andric random_shuffle(RandomAccessIterator first, RandomAccessIterator last); // deprecated in C++14, removed in C++17 1347*0b57cec5SDimitry Andric 1348*0b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class RandomNumberGenerator> 1349*0b57cec5SDimitry Andric void 1350*0b57cec5SDimitry Andric random_shuffle(RandomAccessIterator first, RandomAccessIterator last, 1351*0b57cec5SDimitry Andric RandomNumberGenerator& rand); // deprecated in C++14, removed in C++17 1352*0b57cec5SDimitry Andric 1353*0b57cec5SDimitry Andrictemplate<class PopulationIterator, class SampleIterator, 1354*0b57cec5SDimitry Andric class Distance, class UniformRandomBitGenerator> 1355*0b57cec5SDimitry Andric SampleIterator sample(PopulationIterator first, PopulationIterator last, 1356*0b57cec5SDimitry Andric SampleIterator out, Distance n, 1357*0b57cec5SDimitry Andric UniformRandomBitGenerator&& g); // C++17 1358*0b57cec5SDimitry Andric 1359*0b57cec5SDimitry Andrictemplate<class RandomAccessIterator, class UniformRandomNumberGenerator> 1360*0b57cec5SDimitry Andric void shuffle(RandomAccessIterator first, RandomAccessIterator last, 1361*0b57cec5SDimitry Andric UniformRandomNumberGenerator&& g); 1362*0b57cec5SDimitry Andric 1363e8d8bef9SDimitry Andrictemplate<class ForwardIterator> 1364e8d8bef9SDimitry Andric constexpr ForwardIterator 1365e8d8bef9SDimitry Andric shift_left(ForwardIterator first, ForwardIterator last, 1366e8d8bef9SDimitry Andric typename iterator_traits<ForwardIterator>::difference_type n); // C++20 1367e8d8bef9SDimitry Andric 1368e8d8bef9SDimitry Andrictemplate<class ForwardIterator> 1369e8d8bef9SDimitry Andric constexpr ForwardIterator 1370e8d8bef9SDimitry Andric shift_right(ForwardIterator first, ForwardIterator last, 1371e8d8bef9SDimitry Andric typename iterator_traits<ForwardIterator>::difference_type n); // C++20 1372e8d8bef9SDimitry Andric 1373*0b57cec5SDimitry Andrictemplate <class InputIterator, class Predicate> 1374*0b57cec5SDimitry Andric constexpr bool // constexpr in C++20 1375*0b57cec5SDimitry Andric is_partitioned(InputIterator first, InputIterator last, Predicate pred); 1376*0b57cec5SDimitry Andric 1377*0b57cec5SDimitry Andrictemplate <class ForwardIterator, class Predicate> 1378e8d8bef9SDimitry Andric constexpr ForwardIterator // constexpr in C++20 1379*0b57cec5SDimitry Andric partition(ForwardIterator first, ForwardIterator last, Predicate pred); 1380*0b57cec5SDimitry Andric 1381*0b57cec5SDimitry Andrictemplate <class InputIterator, class OutputIterator1, 1382*0b57cec5SDimitry Andric class OutputIterator2, class Predicate> 1383*0b57cec5SDimitry Andric constexpr pair<OutputIterator1, OutputIterator2> // constexpr in C++20 1384*0b57cec5SDimitry Andric partition_copy(InputIterator first, InputIterator last, 1385*0b57cec5SDimitry Andric OutputIterator1 out_true, OutputIterator2 out_false, 1386*0b57cec5SDimitry Andric Predicate pred); 1387*0b57cec5SDimitry Andric 1388*0b57cec5SDimitry Andrictemplate <class ForwardIterator, class Predicate> 1389*0b57cec5SDimitry Andric ForwardIterator 1390*0b57cec5SDimitry Andric stable_partition(ForwardIterator first, ForwardIterator last, Predicate pred); 1391*0b57cec5SDimitry Andric 1392*0b57cec5SDimitry Andrictemplate<class ForwardIterator, class Predicate> 1393*0b57cec5SDimitry Andric constexpr ForwardIterator // constexpr in C++20 1394*0b57cec5SDimitry Andric partition_point(ForwardIterator first, ForwardIterator last, Predicate pred); 1395*0b57cec5SDimitry Andric 1396*0b57cec5SDimitry Andrictemplate <class ForwardIterator> 1397*0b57cec5SDimitry Andric constexpr bool // constexpr in C++20 1398*0b57cec5SDimitry Andric is_sorted(ForwardIterator first, ForwardIterator last); 1399*0b57cec5SDimitry Andric 1400*0b57cec5SDimitry Andrictemplate <class ForwardIterator, class Compare> 1401e8d8bef9SDimitry Andric constexpr bool // constexpr in C++20 1402*0b57cec5SDimitry Andric is_sorted(ForwardIterator first, ForwardIterator last, Compare comp); 1403*0b57cec5SDimitry Andric 1404*0b57cec5SDimitry Andrictemplate<class ForwardIterator> 1405*0b57cec5SDimitry Andric constexpr ForwardIterator // constexpr in C++20 1406*0b57cec5SDimitry Andric is_sorted_until(ForwardIterator first, ForwardIterator last); 1407*0b57cec5SDimitry Andric 1408*0b57cec5SDimitry Andrictemplate <class ForwardIterator, class Compare> 1409*0b57cec5SDimitry Andric constexpr ForwardIterator // constexpr in C++20 1410*0b57cec5SDimitry Andric is_sorted_until(ForwardIterator first, ForwardIterator last, Compare comp); 1411*0b57cec5SDimitry Andric 1412*0b57cec5SDimitry Andrictemplate <class RandomAccessIterator> 1413fe6060f1SDimitry Andric constexpr void // constexpr in C++20 1414*0b57cec5SDimitry Andric sort(RandomAccessIterator first, RandomAccessIterator last); 1415*0b57cec5SDimitry Andric 1416*0b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class Compare> 1417fe6060f1SDimitry Andric constexpr void // constexpr in C++20 1418*0b57cec5SDimitry Andric sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp); 1419*0b57cec5SDimitry Andric 1420*0b57cec5SDimitry Andrictemplate <class RandomAccessIterator> 1421*0b57cec5SDimitry Andric void 1422*0b57cec5SDimitry Andric stable_sort(RandomAccessIterator first, RandomAccessIterator last); 1423*0b57cec5SDimitry Andric 1424*0b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class Compare> 1425*0b57cec5SDimitry Andric void 1426*0b57cec5SDimitry Andric stable_sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp); 1427*0b57cec5SDimitry Andric 1428*0b57cec5SDimitry Andrictemplate <class RandomAccessIterator> 1429fe6060f1SDimitry Andric constexpr void // constexpr in C++20 1430*0b57cec5SDimitry Andric partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last); 1431*0b57cec5SDimitry Andric 1432*0b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class Compare> 1433fe6060f1SDimitry Andric constexpr void // constexpr in C++20 1434*0b57cec5SDimitry Andric partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last, Compare comp); 1435*0b57cec5SDimitry Andric 1436*0b57cec5SDimitry Andrictemplate <class InputIterator, class RandomAccessIterator> 1437fe6060f1SDimitry Andric constexpr RandomAccessIterator // constexpr in C++20 1438*0b57cec5SDimitry Andric partial_sort_copy(InputIterator first, InputIterator last, 1439*0b57cec5SDimitry Andric RandomAccessIterator result_first, RandomAccessIterator result_last); 1440*0b57cec5SDimitry Andric 1441*0b57cec5SDimitry Andrictemplate <class InputIterator, class RandomAccessIterator, class Compare> 1442fe6060f1SDimitry Andric constexpr RandomAccessIterator // constexpr in C++20 1443*0b57cec5SDimitry Andric partial_sort_copy(InputIterator first, InputIterator last, 1444*0b57cec5SDimitry Andric RandomAccessIterator result_first, RandomAccessIterator result_last, Compare comp); 1445*0b57cec5SDimitry Andric 1446*0b57cec5SDimitry Andrictemplate <class RandomAccessIterator> 1447fe6060f1SDimitry Andric constexpr void // constexpr in C++20 1448*0b57cec5SDimitry Andric nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last); 1449*0b57cec5SDimitry Andric 1450*0b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class Compare> 1451fe6060f1SDimitry Andric constexpr void // constexpr in C++20 1452*0b57cec5SDimitry Andric nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last, Compare comp); 1453*0b57cec5SDimitry Andric 1454*0b57cec5SDimitry Andrictemplate <class ForwardIterator, class T> 1455*0b57cec5SDimitry Andric constexpr ForwardIterator // constexpr in C++20 1456*0b57cec5SDimitry Andric lower_bound(ForwardIterator first, ForwardIterator last, const T& value); 1457*0b57cec5SDimitry Andric 1458*0b57cec5SDimitry Andrictemplate <class ForwardIterator, class T, class Compare> 1459*0b57cec5SDimitry Andric constexpr ForwardIterator // constexpr in C++20 1460*0b57cec5SDimitry Andric lower_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp); 1461*0b57cec5SDimitry Andric 1462*0b57cec5SDimitry Andrictemplate <class ForwardIterator, class T> 1463*0b57cec5SDimitry Andric constexpr ForwardIterator // constexpr in C++20 1464*0b57cec5SDimitry Andric upper_bound(ForwardIterator first, ForwardIterator last, const T& value); 1465*0b57cec5SDimitry Andric 1466*0b57cec5SDimitry Andrictemplate <class ForwardIterator, class T, class Compare> 1467*0b57cec5SDimitry Andric constexpr ForwardIterator // constexpr in C++20 1468*0b57cec5SDimitry Andric upper_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp); 1469*0b57cec5SDimitry Andric 1470*0b57cec5SDimitry Andrictemplate <class ForwardIterator, class T> 1471*0b57cec5SDimitry Andric constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++20 1472*0b57cec5SDimitry Andric equal_range(ForwardIterator first, ForwardIterator last, const T& value); 1473*0b57cec5SDimitry Andric 1474*0b57cec5SDimitry Andrictemplate <class ForwardIterator, class T, class Compare> 1475*0b57cec5SDimitry Andric constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++20 1476*0b57cec5SDimitry Andric equal_range(ForwardIterator first, ForwardIterator last, const T& value, Compare comp); 1477*0b57cec5SDimitry Andric 1478*0b57cec5SDimitry Andrictemplate <class ForwardIterator, class T> 1479*0b57cec5SDimitry Andric constexpr bool // constexpr in C++20 1480*0b57cec5SDimitry Andric binary_search(ForwardIterator first, ForwardIterator last, const T& value); 1481*0b57cec5SDimitry Andric 1482*0b57cec5SDimitry Andrictemplate <class ForwardIterator, class T, class Compare> 1483*0b57cec5SDimitry Andric constexpr bool // constexpr in C++20 1484*0b57cec5SDimitry Andric binary_search(ForwardIterator first, ForwardIterator last, const T& value, Compare comp); 1485*0b57cec5SDimitry Andric 1486*0b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator> 1487e8d8bef9SDimitry Andric constexpr OutputIterator // constexpr in C++20 1488*0b57cec5SDimitry Andric merge(InputIterator1 first1, InputIterator1 last1, 1489*0b57cec5SDimitry Andric InputIterator2 first2, InputIterator2 last2, OutputIterator result); 1490*0b57cec5SDimitry Andric 1491*0b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator, class Compare> 1492e8d8bef9SDimitry Andric constexpr OutputIterator // constexpr in C++20 1493*0b57cec5SDimitry Andric merge(InputIterator1 first1, InputIterator1 last1, 1494*0b57cec5SDimitry Andric InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp); 1495*0b57cec5SDimitry Andric 1496*0b57cec5SDimitry Andrictemplate <class BidirectionalIterator> 1497*0b57cec5SDimitry Andric void 1498*0b57cec5SDimitry Andric inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last); 1499*0b57cec5SDimitry Andric 1500*0b57cec5SDimitry Andrictemplate <class BidirectionalIterator, class Compare> 1501*0b57cec5SDimitry Andric void 1502*0b57cec5SDimitry Andric inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last, Compare comp); 1503*0b57cec5SDimitry Andric 1504*0b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2> 1505*0b57cec5SDimitry Andric constexpr bool // constexpr in C++20 1506*0b57cec5SDimitry Andric includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2); 1507*0b57cec5SDimitry Andric 1508*0b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class Compare> 1509*0b57cec5SDimitry Andric constexpr bool // constexpr in C++20 1510*0b57cec5SDimitry Andric includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, Compare comp); 1511*0b57cec5SDimitry Andric 1512*0b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator> 1513e8d8bef9SDimitry Andric constexpr OutputIterator // constexpr in C++20 1514*0b57cec5SDimitry Andric set_union(InputIterator1 first1, InputIterator1 last1, 1515*0b57cec5SDimitry Andric InputIterator2 first2, InputIterator2 last2, OutputIterator result); 1516*0b57cec5SDimitry Andric 1517*0b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator, class Compare> 1518e8d8bef9SDimitry Andric constexpr OutputIterator // constexpr in C++20 1519*0b57cec5SDimitry Andric set_union(InputIterator1 first1, InputIterator1 last1, 1520*0b57cec5SDimitry Andric InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp); 1521*0b57cec5SDimitry Andric 1522*0b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator> 1523*0b57cec5SDimitry Andric constexpr OutputIterator // constexpr in C++20 1524*0b57cec5SDimitry Andric set_intersection(InputIterator1 first1, InputIterator1 last1, 1525*0b57cec5SDimitry Andric InputIterator2 first2, InputIterator2 last2, OutputIterator result); 1526*0b57cec5SDimitry Andric 1527*0b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator, class Compare> 1528*0b57cec5SDimitry Andric constexpr OutputIterator // constexpr in C++20 1529*0b57cec5SDimitry Andric set_intersection(InputIterator1 first1, InputIterator1 last1, 1530*0b57cec5SDimitry Andric InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp); 1531*0b57cec5SDimitry Andric 1532*0b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator> 1533e8d8bef9SDimitry Andric constexpr OutputIterator // constexpr in C++20 1534*0b57cec5SDimitry Andric set_difference(InputIterator1 first1, InputIterator1 last1, 1535*0b57cec5SDimitry Andric InputIterator2 first2, InputIterator2 last2, OutputIterator result); 1536*0b57cec5SDimitry Andric 1537*0b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator, class Compare> 1538e8d8bef9SDimitry Andric constexpr OutputIterator // constexpr in C++20 1539*0b57cec5SDimitry Andric set_difference(InputIterator1 first1, InputIterator1 last1, 1540*0b57cec5SDimitry Andric InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp); 1541*0b57cec5SDimitry Andric 1542*0b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator> 1543e8d8bef9SDimitry Andric constexpr OutputIterator // constexpr in C++20 1544*0b57cec5SDimitry Andric set_symmetric_difference(InputIterator1 first1, InputIterator1 last1, 1545*0b57cec5SDimitry Andric InputIterator2 first2, InputIterator2 last2, OutputIterator result); 1546*0b57cec5SDimitry Andric 1547*0b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator, class Compare> 1548e8d8bef9SDimitry Andric constexpr OutputIterator // constexpr in C++20 1549*0b57cec5SDimitry Andric set_symmetric_difference(InputIterator1 first1, InputIterator1 last1, 1550*0b57cec5SDimitry Andric InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp); 1551*0b57cec5SDimitry Andric 1552*0b57cec5SDimitry Andrictemplate <class RandomAccessIterator> 1553fe6060f1SDimitry Andric constexpr void // constexpr in C++20 1554*0b57cec5SDimitry Andric push_heap(RandomAccessIterator first, RandomAccessIterator last); 1555*0b57cec5SDimitry Andric 1556*0b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class Compare> 1557fe6060f1SDimitry Andric constexpr void // constexpr in C++20 1558*0b57cec5SDimitry Andric push_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp); 1559*0b57cec5SDimitry Andric 1560*0b57cec5SDimitry Andrictemplate <class RandomAccessIterator> 1561fe6060f1SDimitry Andric constexpr void // constexpr in C++20 1562*0b57cec5SDimitry Andric pop_heap(RandomAccessIterator first, RandomAccessIterator last); 1563*0b57cec5SDimitry Andric 1564*0b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class Compare> 1565fe6060f1SDimitry Andric constexpr void // constexpr in C++20 1566*0b57cec5SDimitry Andric pop_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp); 1567*0b57cec5SDimitry Andric 1568*0b57cec5SDimitry Andrictemplate <class RandomAccessIterator> 1569fe6060f1SDimitry Andric constexpr void // constexpr in C++20 1570*0b57cec5SDimitry Andric make_heap(RandomAccessIterator first, RandomAccessIterator last); 1571*0b57cec5SDimitry Andric 1572*0b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class Compare> 1573fe6060f1SDimitry Andric constexpr void // constexpr in C++20 1574*0b57cec5SDimitry Andric make_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp); 1575*0b57cec5SDimitry Andric 1576*0b57cec5SDimitry Andrictemplate <class RandomAccessIterator> 1577fe6060f1SDimitry Andric constexpr void // constexpr in C++20 1578*0b57cec5SDimitry Andric sort_heap(RandomAccessIterator first, RandomAccessIterator last); 1579*0b57cec5SDimitry Andric 1580*0b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class Compare> 1581fe6060f1SDimitry Andric constexpr void // constexpr in C++20 1582*0b57cec5SDimitry Andric sort_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp); 1583*0b57cec5SDimitry Andric 1584*0b57cec5SDimitry Andrictemplate <class RandomAccessIterator> 1585*0b57cec5SDimitry Andric constexpr bool // constexpr in C++20 1586*0b57cec5SDimitry Andric is_heap(RandomAccessIterator first, RandomAccessiterator last); 1587*0b57cec5SDimitry Andric 1588*0b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class Compare> 1589*0b57cec5SDimitry Andric constexpr bool // constexpr in C++20 1590*0b57cec5SDimitry Andric is_heap(RandomAccessIterator first, RandomAccessiterator last, Compare comp); 1591*0b57cec5SDimitry Andric 1592*0b57cec5SDimitry Andrictemplate <class RandomAccessIterator> 1593*0b57cec5SDimitry Andric constexpr RandomAccessIterator // constexpr in C++20 1594*0b57cec5SDimitry Andric is_heap_until(RandomAccessIterator first, RandomAccessiterator last); 1595*0b57cec5SDimitry Andric 1596*0b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class Compare> 1597*0b57cec5SDimitry Andric constexpr RandomAccessIterator // constexpr in C++20 1598*0b57cec5SDimitry Andric is_heap_until(RandomAccessIterator first, RandomAccessiterator last, Compare comp); 1599*0b57cec5SDimitry Andric 1600*0b57cec5SDimitry Andrictemplate <class ForwardIterator> 1601e8d8bef9SDimitry Andric constexpr ForwardIterator // constexpr in C++14 1602e8d8bef9SDimitry Andric min_element(ForwardIterator first, ForwardIterator last); 1603*0b57cec5SDimitry Andric 1604*0b57cec5SDimitry Andrictemplate <class ForwardIterator, class Compare> 1605e8d8bef9SDimitry Andric constexpr ForwardIterator // constexpr in C++14 1606e8d8bef9SDimitry Andric min_element(ForwardIterator first, ForwardIterator last, Compare comp); 1607*0b57cec5SDimitry Andric 1608*0b57cec5SDimitry Andrictemplate <class T> 1609e8d8bef9SDimitry Andric constexpr const T& // constexpr in C++14 1610e8d8bef9SDimitry Andric min(const T& a, const T& b); 1611*0b57cec5SDimitry Andric 1612*0b57cec5SDimitry Andrictemplate <class T, class Compare> 1613e8d8bef9SDimitry Andric constexpr const T& // constexpr in C++14 1614e8d8bef9SDimitry Andric min(const T& a, const T& b, Compare comp); 1615*0b57cec5SDimitry Andric 1616*0b57cec5SDimitry Andrictemplate<class T> 1617e8d8bef9SDimitry Andric constexpr T // constexpr in C++14 1618e8d8bef9SDimitry Andric min(initializer_list<T> t); 1619*0b57cec5SDimitry Andric 1620*0b57cec5SDimitry Andrictemplate<class T, class Compare> 1621e8d8bef9SDimitry Andric constexpr T // constexpr in C++14 1622e8d8bef9SDimitry Andric min(initializer_list<T> t, Compare comp); 1623*0b57cec5SDimitry Andric 1624*0b57cec5SDimitry Andrictemplate<class T> 1625*0b57cec5SDimitry Andric constexpr const T& clamp(const T& v, const T& lo, const T& hi); // C++17 1626*0b57cec5SDimitry Andric 1627*0b57cec5SDimitry Andrictemplate<class T, class Compare> 1628*0b57cec5SDimitry Andric constexpr const T& clamp(const T& v, const T& lo, const T& hi, Compare comp); // C++17 1629*0b57cec5SDimitry Andric 1630*0b57cec5SDimitry Andrictemplate <class ForwardIterator> 1631e8d8bef9SDimitry Andric constexpr ForwardIterator // constexpr in C++14 1632e8d8bef9SDimitry Andric max_element(ForwardIterator first, ForwardIterator last); 1633*0b57cec5SDimitry Andric 1634*0b57cec5SDimitry Andrictemplate <class ForwardIterator, class Compare> 1635e8d8bef9SDimitry Andric constexpr ForwardIterator // constexpr in C++14 1636e8d8bef9SDimitry Andric max_element(ForwardIterator first, ForwardIterator last, Compare comp); 1637*0b57cec5SDimitry Andric 1638*0b57cec5SDimitry Andrictemplate <class T> 1639e8d8bef9SDimitry Andric constexpr const T& // constexpr in C++14 1640e8d8bef9SDimitry Andric max(const T& a, const T& b); 1641*0b57cec5SDimitry Andric 1642*0b57cec5SDimitry Andrictemplate <class T, class Compare> 1643e8d8bef9SDimitry Andric constexpr const T& // constexpr in C++14 1644e8d8bef9SDimitry Andric max(const T& a, const T& b, Compare comp); 1645*0b57cec5SDimitry Andric 1646*0b57cec5SDimitry Andrictemplate<class T> 1647e8d8bef9SDimitry Andric constexpr T // constexpr in C++14 1648e8d8bef9SDimitry Andric max(initializer_list<T> t); 1649*0b57cec5SDimitry Andric 1650*0b57cec5SDimitry Andrictemplate<class T, class Compare> 1651e8d8bef9SDimitry Andric constexpr T // constexpr in C++14 1652e8d8bef9SDimitry Andric max(initializer_list<T> t, Compare comp); 1653*0b57cec5SDimitry Andric 1654*0b57cec5SDimitry Andrictemplate<class ForwardIterator> 1655e8d8bef9SDimitry Andric constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++14 1656e8d8bef9SDimitry Andric minmax_element(ForwardIterator first, ForwardIterator last); 1657*0b57cec5SDimitry Andric 1658*0b57cec5SDimitry Andrictemplate<class ForwardIterator, class Compare> 1659e8d8bef9SDimitry Andric constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++14 1660e8d8bef9SDimitry Andric minmax_element(ForwardIterator first, ForwardIterator last, Compare comp); 1661*0b57cec5SDimitry Andric 1662*0b57cec5SDimitry Andrictemplate<class T> 1663e8d8bef9SDimitry Andric constexpr pair<const T&, const T&> // constexpr in C++14 1664e8d8bef9SDimitry Andric minmax(const T& a, const T& b); 1665*0b57cec5SDimitry Andric 1666*0b57cec5SDimitry Andrictemplate<class T, class Compare> 1667e8d8bef9SDimitry Andric constexpr pair<const T&, const T&> // constexpr in C++14 1668e8d8bef9SDimitry Andric minmax(const T& a, const T& b, Compare comp); 1669*0b57cec5SDimitry Andric 1670*0b57cec5SDimitry Andrictemplate<class T> 1671e8d8bef9SDimitry Andric constexpr pair<T, T> // constexpr in C++14 1672e8d8bef9SDimitry Andric minmax(initializer_list<T> t); 1673*0b57cec5SDimitry Andric 1674*0b57cec5SDimitry Andrictemplate<class T, class Compare> 1675e8d8bef9SDimitry Andric constexpr pair<T, T> // constexpr in C++14 1676e8d8bef9SDimitry Andric minmax(initializer_list<T> t, Compare comp); 1677*0b57cec5SDimitry Andric 1678*0b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2> 1679*0b57cec5SDimitry Andric constexpr bool // constexpr in C++20 1680*0b57cec5SDimitry Andric lexicographical_compare(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2); 1681*0b57cec5SDimitry Andric 1682*0b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class Compare> 1683*0b57cec5SDimitry Andric constexpr bool // constexpr in C++20 1684*0b57cec5SDimitry Andric lexicographical_compare(InputIterator1 first1, InputIterator1 last1, 1685*0b57cec5SDimitry Andric InputIterator2 first2, InputIterator2 last2, Compare comp); 1686*0b57cec5SDimitry Andric 1687*0b57cec5SDimitry Andrictemplate <class BidirectionalIterator> 1688e8d8bef9SDimitry Andric constexpr bool // constexpr in C++20 1689*0b57cec5SDimitry Andric next_permutation(BidirectionalIterator first, BidirectionalIterator last); 1690*0b57cec5SDimitry Andric 1691*0b57cec5SDimitry Andrictemplate <class BidirectionalIterator, class Compare> 1692e8d8bef9SDimitry Andric constexpr bool // constexpr in C++20 1693*0b57cec5SDimitry Andric next_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp); 1694*0b57cec5SDimitry Andric 1695*0b57cec5SDimitry Andrictemplate <class BidirectionalIterator> 1696e8d8bef9SDimitry Andric constexpr bool // constexpr in C++20 1697*0b57cec5SDimitry Andric prev_permutation(BidirectionalIterator first, BidirectionalIterator last); 1698*0b57cec5SDimitry Andric 1699*0b57cec5SDimitry Andrictemplate <class BidirectionalIterator, class Compare> 1700e8d8bef9SDimitry Andric constexpr bool // constexpr in C++20 1701*0b57cec5SDimitry Andric prev_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp); 1702*0b57cec5SDimitry Andric} // std 1703*0b57cec5SDimitry Andric 1704*0b57cec5SDimitry Andric*/ 1705*0b57cec5SDimitry Andric 170681ad6265SDimitry Andric#include <__assert> // all public C++ headers provide the assertion handler 170781ad6265SDimitry Andric#include <__bits> 1708*0b57cec5SDimitry Andric#include <__config> 1709fe6060f1SDimitry Andric#include <__debug> 1710fe6060f1SDimitry Andric#include <cstddef> 1711*0b57cec5SDimitry Andric#include <cstring> 1712fe6060f1SDimitry Andric#include <memory> 1713fe6060f1SDimitry Andric#include <type_traits> 1714*0b57cec5SDimitry Andric#include <version> 1715*0b57cec5SDimitry Andric 1716fe6060f1SDimitry Andric#include <__algorithm/adjacent_find.h> 1717fe6060f1SDimitry Andric#include <__algorithm/all_of.h> 1718fe6060f1SDimitry Andric#include <__algorithm/any_of.h> 1719fe6060f1SDimitry Andric#include <__algorithm/binary_search.h> 1720fe6060f1SDimitry Andric#include <__algorithm/clamp.h> 1721fe6060f1SDimitry Andric#include <__algorithm/comp.h> 1722fe6060f1SDimitry Andric#include <__algorithm/comp_ref_type.h> 1723fe6060f1SDimitry Andric#include <__algorithm/copy.h> 1724fe6060f1SDimitry Andric#include <__algorithm/copy_backward.h> 1725fe6060f1SDimitry Andric#include <__algorithm/copy_if.h> 1726fe6060f1SDimitry Andric#include <__algorithm/copy_n.h> 1727fe6060f1SDimitry Andric#include <__algorithm/count.h> 1728fe6060f1SDimitry Andric#include <__algorithm/count_if.h> 1729fe6060f1SDimitry Andric#include <__algorithm/equal.h> 1730fe6060f1SDimitry Andric#include <__algorithm/equal_range.h> 1731fe6060f1SDimitry Andric#include <__algorithm/fill.h> 173204eeddc0SDimitry Andric#include <__algorithm/fill_n.h> 1733fe6060f1SDimitry Andric#include <__algorithm/find.h> 1734fe6060f1SDimitry Andric#include <__algorithm/find_end.h> 1735fe6060f1SDimitry Andric#include <__algorithm/find_first_of.h> 1736fe6060f1SDimitry Andric#include <__algorithm/find_if.h> 1737fe6060f1SDimitry Andric#include <__algorithm/find_if_not.h> 1738fe6060f1SDimitry Andric#include <__algorithm/for_each.h> 1739fe6060f1SDimitry Andric#include <__algorithm/for_each_n.h> 1740fe6060f1SDimitry Andric#include <__algorithm/generate.h> 174104eeddc0SDimitry Andric#include <__algorithm/generate_n.h> 1742fe6060f1SDimitry Andric#include <__algorithm/half_positive.h> 174381ad6265SDimitry Andric#include <__algorithm/in_found_result.h> 174481ad6265SDimitry Andric#include <__algorithm/in_fun_result.h> 17451fd87a68SDimitry Andric#include <__algorithm/in_in_out_result.h> 174604eeddc0SDimitry Andric#include <__algorithm/in_in_result.h> 174781ad6265SDimitry Andric#include <__algorithm/in_out_out_result.h> 174804eeddc0SDimitry Andric#include <__algorithm/in_out_result.h> 1749fe6060f1SDimitry Andric#include <__algorithm/includes.h> 1750fe6060f1SDimitry Andric#include <__algorithm/inplace_merge.h> 1751fe6060f1SDimitry Andric#include <__algorithm/is_heap.h> 1752fe6060f1SDimitry Andric#include <__algorithm/is_heap_until.h> 1753fe6060f1SDimitry Andric#include <__algorithm/is_partitioned.h> 1754fe6060f1SDimitry Andric#include <__algorithm/is_permutation.h> 1755fe6060f1SDimitry Andric#include <__algorithm/is_sorted.h> 1756fe6060f1SDimitry Andric#include <__algorithm/is_sorted_until.h> 1757fe6060f1SDimitry Andric#include <__algorithm/iter_swap.h> 1758fe6060f1SDimitry Andric#include <__algorithm/lexicographical_compare.h> 1759fe6060f1SDimitry Andric#include <__algorithm/lower_bound.h> 1760fe6060f1SDimitry Andric#include <__algorithm/make_heap.h> 1761fe6060f1SDimitry Andric#include <__algorithm/max.h> 1762fe6060f1SDimitry Andric#include <__algorithm/max_element.h> 1763fe6060f1SDimitry Andric#include <__algorithm/merge.h> 1764fe6060f1SDimitry Andric#include <__algorithm/min.h> 1765fe6060f1SDimitry Andric#include <__algorithm/min_element.h> 176681ad6265SDimitry Andric#include <__algorithm/min_max_result.h> 1767fe6060f1SDimitry Andric#include <__algorithm/minmax.h> 1768fe6060f1SDimitry Andric#include <__algorithm/minmax_element.h> 1769fe6060f1SDimitry Andric#include <__algorithm/mismatch.h> 1770fe6060f1SDimitry Andric#include <__algorithm/move.h> 1771fe6060f1SDimitry Andric#include <__algorithm/move_backward.h> 1772fe6060f1SDimitry Andric#include <__algorithm/next_permutation.h> 1773fe6060f1SDimitry Andric#include <__algorithm/none_of.h> 1774fe6060f1SDimitry Andric#include <__algorithm/nth_element.h> 1775fe6060f1SDimitry Andric#include <__algorithm/partial_sort.h> 1776fe6060f1SDimitry Andric#include <__algorithm/partial_sort_copy.h> 1777fe6060f1SDimitry Andric#include <__algorithm/partition.h> 1778fe6060f1SDimitry Andric#include <__algorithm/partition_copy.h> 1779fe6060f1SDimitry Andric#include <__algorithm/partition_point.h> 1780fe6060f1SDimitry Andric#include <__algorithm/pop_heap.h> 1781fe6060f1SDimitry Andric#include <__algorithm/prev_permutation.h> 1782fe6060f1SDimitry Andric#include <__algorithm/push_heap.h> 178381ad6265SDimitry Andric#include <__algorithm/ranges_adjacent_find.h> 178481ad6265SDimitry Andric#include <__algorithm/ranges_all_of.h> 178581ad6265SDimitry Andric#include <__algorithm/ranges_any_of.h> 178681ad6265SDimitry Andric#include <__algorithm/ranges_binary_search.h> 178761cfbce3SDimitry Andric#include <__algorithm/ranges_clamp.h> 178881ad6265SDimitry Andric#include <__algorithm/ranges_copy.h> 178981ad6265SDimitry Andric#include <__algorithm/ranges_copy_backward.h> 179081ad6265SDimitry Andric#include <__algorithm/ranges_copy_if.h> 179181ad6265SDimitry Andric#include <__algorithm/ranges_copy_n.h> 179281ad6265SDimitry Andric#include <__algorithm/ranges_count.h> 179381ad6265SDimitry Andric#include <__algorithm/ranges_count_if.h> 179481ad6265SDimitry Andric#include <__algorithm/ranges_equal.h> 1795fcaf7f86SDimitry Andric#include <__algorithm/ranges_equal_range.h> 179681ad6265SDimitry Andric#include <__algorithm/ranges_fill.h> 179781ad6265SDimitry Andric#include <__algorithm/ranges_fill_n.h> 179881ad6265SDimitry Andric#include <__algorithm/ranges_find.h> 1799753f127fSDimitry Andric#include <__algorithm/ranges_find_end.h> 180081ad6265SDimitry Andric#include <__algorithm/ranges_find_first_of.h> 180181ad6265SDimitry Andric#include <__algorithm/ranges_find_if.h> 180281ad6265SDimitry Andric#include <__algorithm/ranges_find_if_not.h> 180381ad6265SDimitry Andric#include <__algorithm/ranges_for_each.h> 180481ad6265SDimitry Andric#include <__algorithm/ranges_for_each_n.h> 1805972a253aSDimitry Andric#include <__algorithm/ranges_generate.h> 1806972a253aSDimitry Andric#include <__algorithm/ranges_generate_n.h> 1807fcaf7f86SDimitry Andric#include <__algorithm/ranges_includes.h> 180861cfbce3SDimitry Andric#include <__algorithm/ranges_inplace_merge.h> 1809972a253aSDimitry Andric#include <__algorithm/ranges_is_heap.h> 1810972a253aSDimitry Andric#include <__algorithm/ranges_is_heap_until.h> 181181ad6265SDimitry Andric#include <__algorithm/ranges_is_partitioned.h> 181261cfbce3SDimitry Andric#include <__algorithm/ranges_is_permutation.h> 181381ad6265SDimitry Andric#include <__algorithm/ranges_is_sorted.h> 181481ad6265SDimitry Andric#include <__algorithm/ranges_is_sorted_until.h> 181581ad6265SDimitry Andric#include <__algorithm/ranges_lexicographical_compare.h> 181681ad6265SDimitry Andric#include <__algorithm/ranges_lower_bound.h> 1817753f127fSDimitry Andric#include <__algorithm/ranges_make_heap.h> 181881ad6265SDimitry Andric#include <__algorithm/ranges_max.h> 181981ad6265SDimitry Andric#include <__algorithm/ranges_max_element.h> 1820753f127fSDimitry Andric#include <__algorithm/ranges_merge.h> 182181ad6265SDimitry Andric#include <__algorithm/ranges_min.h> 182281ad6265SDimitry Andric#include <__algorithm/ranges_min_element.h> 182381ad6265SDimitry Andric#include <__algorithm/ranges_minmax.h> 182481ad6265SDimitry Andric#include <__algorithm/ranges_minmax_element.h> 182581ad6265SDimitry Andric#include <__algorithm/ranges_mismatch.h> 182681ad6265SDimitry Andric#include <__algorithm/ranges_move.h> 182781ad6265SDimitry Andric#include <__algorithm/ranges_move_backward.h> 182861cfbce3SDimitry Andric#include <__algorithm/ranges_next_permutation.h> 182981ad6265SDimitry Andric#include <__algorithm/ranges_none_of.h> 1830753f127fSDimitry Andric#include <__algorithm/ranges_nth_element.h> 1831fcaf7f86SDimitry Andric#include <__algorithm/ranges_partial_sort.h> 183261cfbce3SDimitry Andric#include <__algorithm/ranges_partial_sort_copy.h> 1833fcaf7f86SDimitry Andric#include <__algorithm/ranges_partition.h> 1834fcaf7f86SDimitry Andric#include <__algorithm/ranges_partition_copy.h> 1835fcaf7f86SDimitry Andric#include <__algorithm/ranges_partition_point.h> 1836753f127fSDimitry Andric#include <__algorithm/ranges_pop_heap.h> 183761cfbce3SDimitry Andric#include <__algorithm/ranges_prev_permutation.h> 1838753f127fSDimitry Andric#include <__algorithm/ranges_push_heap.h> 1839753f127fSDimitry Andric#include <__algorithm/ranges_remove.h> 184061cfbce3SDimitry Andric#include <__algorithm/ranges_remove_copy.h> 184161cfbce3SDimitry Andric#include <__algorithm/ranges_remove_copy_if.h> 1842753f127fSDimitry Andric#include <__algorithm/ranges_remove_if.h> 184381ad6265SDimitry Andric#include <__algorithm/ranges_replace.h> 184461cfbce3SDimitry Andric#include <__algorithm/ranges_replace_copy.h> 184561cfbce3SDimitry Andric#include <__algorithm/ranges_replace_copy_if.h> 184681ad6265SDimitry Andric#include <__algorithm/ranges_replace_if.h> 184781ad6265SDimitry Andric#include <__algorithm/ranges_reverse.h> 1848753f127fSDimitry Andric#include <__algorithm/ranges_reverse_copy.h> 184961cfbce3SDimitry Andric#include <__algorithm/ranges_rotate.h> 1850753f127fSDimitry Andric#include <__algorithm/ranges_rotate_copy.h> 185161cfbce3SDimitry Andric#include <__algorithm/ranges_sample.h> 1852753f127fSDimitry Andric#include <__algorithm/ranges_search.h> 1853753f127fSDimitry Andric#include <__algorithm/ranges_search_n.h> 1854753f127fSDimitry Andric#include <__algorithm/ranges_set_difference.h> 1855753f127fSDimitry Andric#include <__algorithm/ranges_set_intersection.h> 1856753f127fSDimitry Andric#include <__algorithm/ranges_set_symmetric_difference.h> 1857fcaf7f86SDimitry Andric#include <__algorithm/ranges_set_union.h> 1858fcaf7f86SDimitry Andric#include <__algorithm/ranges_shuffle.h> 185981ad6265SDimitry Andric#include <__algorithm/ranges_sort.h> 1860753f127fSDimitry Andric#include <__algorithm/ranges_sort_heap.h> 1861fcaf7f86SDimitry Andric#include <__algorithm/ranges_stable_partition.h> 186281ad6265SDimitry Andric#include <__algorithm/ranges_stable_sort.h> 186381ad6265SDimitry Andric#include <__algorithm/ranges_swap_ranges.h> 186481ad6265SDimitry Andric#include <__algorithm/ranges_transform.h> 186561cfbce3SDimitry Andric#include <__algorithm/ranges_unique.h> 186661cfbce3SDimitry Andric#include <__algorithm/ranges_unique_copy.h> 186781ad6265SDimitry Andric#include <__algorithm/ranges_upper_bound.h> 1868fe6060f1SDimitry Andric#include <__algorithm/remove.h> 1869fe6060f1SDimitry Andric#include <__algorithm/remove_copy.h> 1870fe6060f1SDimitry Andric#include <__algorithm/remove_copy_if.h> 1871fe6060f1SDimitry Andric#include <__algorithm/remove_if.h> 1872fe6060f1SDimitry Andric#include <__algorithm/replace.h> 1873fe6060f1SDimitry Andric#include <__algorithm/replace_copy.h> 1874fe6060f1SDimitry Andric#include <__algorithm/replace_copy_if.h> 1875fe6060f1SDimitry Andric#include <__algorithm/replace_if.h> 1876fe6060f1SDimitry Andric#include <__algorithm/reverse.h> 1877fe6060f1SDimitry Andric#include <__algorithm/reverse_copy.h> 1878fe6060f1SDimitry Andric#include <__algorithm/rotate.h> 1879fe6060f1SDimitry Andric#include <__algorithm/rotate_copy.h> 1880fe6060f1SDimitry Andric#include <__algorithm/sample.h> 1881fe6060f1SDimitry Andric#include <__algorithm/search.h> 1882fe6060f1SDimitry Andric#include <__algorithm/search_n.h> 1883fe6060f1SDimitry Andric#include <__algorithm/set_difference.h> 1884fe6060f1SDimitry Andric#include <__algorithm/set_intersection.h> 1885fe6060f1SDimitry Andric#include <__algorithm/set_symmetric_difference.h> 1886fe6060f1SDimitry Andric#include <__algorithm/set_union.h> 1887fe6060f1SDimitry Andric#include <__algorithm/shift_left.h> 1888fe6060f1SDimitry Andric#include <__algorithm/shift_right.h> 1889fe6060f1SDimitry Andric#include <__algorithm/shuffle.h> 1890fe6060f1SDimitry Andric#include <__algorithm/sift_down.h> 1891fe6060f1SDimitry Andric#include <__algorithm/sort.h> 1892fe6060f1SDimitry Andric#include <__algorithm/sort_heap.h> 1893fe6060f1SDimitry Andric#include <__algorithm/stable_partition.h> 1894fe6060f1SDimitry Andric#include <__algorithm/stable_sort.h> 1895fe6060f1SDimitry Andric#include <__algorithm/swap_ranges.h> 1896fe6060f1SDimitry Andric#include <__algorithm/transform.h> 1897fe6060f1SDimitry Andric#include <__algorithm/unique.h> 189804eeddc0SDimitry Andric#include <__algorithm/unique_copy.h> 1899fe6060f1SDimitry Andric#include <__algorithm/unwrap_iter.h> 1900fe6060f1SDimitry Andric#include <__algorithm/upper_bound.h> 1901*0b57cec5SDimitry Andric 190281ad6265SDimitry Andric#ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES 190381ad6265SDimitry Andric# include <chrono> 190481ad6265SDimitry Andric# include <iterator> 190581ad6265SDimitry Andric# include <utility> 190681ad6265SDimitry Andric#endif 190781ad6265SDimitry Andric 190881ad6265SDimitry Andric// standard-mandated includes 190981ad6265SDimitry Andric#include <initializer_list> 191081ad6265SDimitry Andric 1911*0b57cec5SDimitry Andric#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 1912*0b57cec5SDimitry Andric# pragma GCC system_header 1913*0b57cec5SDimitry Andric#endif 1914*0b57cec5SDimitry Andric 1915e40139ffSDimitry Andric#if defined(_LIBCPP_HAS_PARALLEL_ALGORITHMS) && _LIBCPP_STD_VER >= 17 1916e40139ffSDimitry Andric# include <__pstl_algorithm> 1917e40139ffSDimitry Andric#endif 1918e40139ffSDimitry Andric 1919*0b57cec5SDimitry Andric#endif // _LIBCPP_ALGORITHM 1920