diff options
author | hiddenpath <hiddenpath@yandex-team.com> | 2024-02-21 23:16:42 +0300 |
---|---|---|
committer | hiddenpath <hiddenpath@yandex-team.com> | 2024-02-21 23:33:25 +0300 |
commit | 9052eb5cc304b8da8885fc4e3364ebddc16945f3 (patch) | |
tree | 3c252f6161dd0745c7732d74c9304c000645ab47 /contrib/libs/cxxsupp/libcxx/include/algorithm | |
parent | f5eb715f103692e7c7536e13bef3f281fd78e5e7 (diff) | |
download | ydb-9052eb5cc304b8da8885fc4e3364ebddc16945f3.tar.gz |
Update libcxx to llvmorg-17.0.6
Update libcxx to llvmorg-17.0.6
c871ef572c71b4fef22d4a9e65bcebc57e625aea
Diffstat (limited to 'contrib/libs/cxxsupp/libcxx/include/algorithm')
-rw-r--r-- | contrib/libs/cxxsupp/libcxx/include/algorithm | 284 |
1 files changed, 163 insertions, 121 deletions
diff --git a/contrib/libs/cxxsupp/libcxx/include/algorithm b/contrib/libs/cxxsupp/libcxx/include/algorithm index a4351eaf9c..7813f67f2c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/algorithm +++ b/contrib/libs/cxxsupp/libcxx/include/algorithm @@ -22,41 +22,41 @@ namespace ranges { // [algorithms.results], algorithm result types template <class I, class F> - struct in_fun_result; // since C++20 + struct in_fun_result; // since C++20 template <class I1, class I2> - struct in_in_result; // since C++20 + struct in_in_result; // since C++20 template <class I, class O> - struct in_out_result; // since C++20 + struct in_out_result; // since C++20 template <class I1, class I2, class O> - struct in_in_out_result; // since C++20 + struct in_in_out_result; // since C++20 template <class I, class O1, class O2> - struct in_out_out_result; // since C++20 + struct in_out_out_result; // since C++20 template <class I1, class I2> - struct min_max_result; // since C++20 + struct min_max_result; // since C++20 template <class I> - struct in_found_result; // since C++20 + struct in_found_result; // since C++20 template<forward_iterator I, sentinel_for<I> S, class Proj = identity, - indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> // since C++20 + indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> // since C++20 constexpr I min_element(I first, S last, Comp comp = {}, Proj proj = {}); template<forward_range R, class Proj = identity, - indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> // since C++20 + indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> // since C++20 constexpr borrowed_iterator_t<R> min_element(R&& r, Comp comp = {}, Proj proj = {}); template<forward_iterator I, sentinel_for<I> S, class Proj = identity, indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> - constexpr I ranges::max_element(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 + constexpr I ranges::max_element(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 template<forward_range R, class Proj = identity, indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> - constexpr borrowed_iterator_t<R> ranges::max_element(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 + constexpr borrowed_iterator_t<R> ranges::max_element(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 template<class I1, class I2> using mismatch_result = in_in_result<I1, I2>; @@ -64,86 +64,86 @@ namespace ranges { template <input_iterator I1, sentinel_for<_I1> S1, input_iterator I2, sentinel_for<_I2> S2, class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2> - constexpr mismatch_result<_I1, _I2> - mismatch()(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}) // since C++20 + constexpr mismatch_result<_I1, _I2> // since C++20 + mismatch()(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}) template <input_range R1, input_range R2, class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2> constexpr mismatch_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>> - mismatch(R1&& r1, R2&& r2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}) // since C++20 + mismatch(R1&& r1, R2&& r2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}) // since C++20 requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*> - constexpr I find(I first, S last, const T& value, Proj proj = {}); // since C++20 + constexpr I find(I first, S last, const T& value, Proj proj = {}); // since C++20 template<input_range R, class T, class Proj = identity> requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*> constexpr borrowed_iterator_t<R> - find(R&& r, const T& value, Proj proj = {}); // since C++20 + find(R&& r, const T& value, Proj proj = {}); // since C++20 template<input_iterator I, sentinel_for<I> S, class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred> - constexpr I find_if(I first, S last, Pred pred, Proj proj = {}); // since C++20 + constexpr I find_if(I first, S last, Pred pred, Proj proj = {}); // since C++20 template<input_range R, class Proj = identity, indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> constexpr borrowed_iterator_t<R> - find_if(R&& r, Pred pred, Proj proj = {}); // since C++20 + find_if(R&& r, Pred pred, Proj proj = {}); // since C++20 template<input_iterator I, sentinel_for<I> S, class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred> - constexpr I find_if_not(I first, S last, Pred pred, Proj proj = {}); // since C++20 + constexpr I find_if_not(I first, S last, Pred pred, Proj proj = {}); // since C++20 template<input_range R, class Proj = identity, indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> constexpr borrowed_iterator_t<R> - find_if_not(R&& r, Pred pred, Proj proj = {}); // since C++20 + find_if_not(R&& r, Pred pred, Proj proj = {}); // since C++20 template<class T, class Proj = identity, indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less> - constexpr const T& min(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20 + constexpr const T& min(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20 template<copyable T, class Proj = identity, indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less> - constexpr T min(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20 + constexpr T min(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20 template<input_range R, class Proj = identity, indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*> constexpr range_value_t<R> - min(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 + min(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 template<class T, class Proj = identity, indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less> - constexpr const T& max(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20 + constexpr const T& max(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20 template<copyable T, class Proj = identity, indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less> - constexpr T max(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20 + constexpr T max(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20 template<input_range R, class Proj = identity, indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*> constexpr range_value_t<R> - max(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 + max(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 template<class I, class O> - using unary_transform_result = in_out_result<I, O>; // since C++20 + using unary_transform_result = in_out_result<I, O>; // since C++20 template<class I1, class I2, class O> - using binary_transform_result = in_in_out_result<I1, I2, O>; // since C++20 + using binary_transform_result = in_in_out_result<I1, I2, O>; // since C++20 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, copy_constructible F, class Proj = identity> requires indirectly_writable<O, indirect_result_t<F&, projected<I, Proj>>> constexpr ranges::unary_transform_result<I, O> - transform(I first1, S last1, O result, F op, Proj proj = {}); // since C++20 + transform(I first1, S last1, O result, F op, Proj proj = {}); // since C++20 template<input_range R, weakly_incrementable O, copy_constructible F, class Proj = identity> requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R>, Proj>>> constexpr ranges::unary_transform_result<borrowed_iterator_t<R>, O> - transform(R&& r, O result, F op, Proj proj = {}); // since C++20 + transform(R&& r, O result, F op, Proj proj = {}); // since C++20 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, weakly_incrementable O, copy_constructible F, class Proj1 = identity, @@ -152,7 +152,7 @@ namespace ranges { projected<I2, Proj2>>> constexpr ranges::binary_transform_result<I1, I2, O> transform(I1 first1, S1 last1, I2 first2, S2 last2, O result, - F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 + F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 template<input_range R1, input_range R2, weakly_incrementable O, copy_constructible F, class Proj1 = identity, class Proj2 = identity> @@ -160,27 +160,27 @@ namespace ranges { projected<iterator_t<R2>, Proj2>>> constexpr ranges::binary_transform_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O> transform(R1&& r1, R2&& r2, O result, - F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 + F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity> requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*> constexpr iter_difference_t<I> - count(I first, S last, const T& value, Proj proj = {}); // since C++20 + count(I first, S last, const T& value, Proj proj = {}); // since C++20 template<input_range R, class T, class Proj = identity> requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*> constexpr range_difference_t<R> - count(R&& r, const T& value, Proj proj = {}); // since C++20 + count(R&& r, const T& value, Proj proj = {}); // since C++20 template<input_iterator I, sentinel_for<I> S, class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred> constexpr iter_difference_t<I> - count_if(I first, S last, Pred pred, Proj proj = {}); // since C++20 + count_if(I first, S last, Pred pred, Proj proj = {}); // since C++20 template<input_range R, class Proj = identity, indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> constexpr range_difference_t<R> - count_if(R&& r, Pred pred, Proj proj = {}); // since C++20 + count_if(R&& r, Pred pred, Proj proj = {}); // since C++20 template<class T> using minmax_result = min_max_result<T>; @@ -188,18 +188,18 @@ namespace ranges { template<class T, class Proj = identity, indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less> constexpr ranges::minmax_result<const T&> - minmax(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20 + minmax(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20 template<copyable T, class Proj = identity, indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less> constexpr ranges::minmax_result<T> - minmax(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20 + minmax(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20 template<input_range R, class Proj = identity, indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*> constexpr ranges::minmax_result<range_value_t<R>> - minmax(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 + minmax(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 template<class I> using minmax_element_result = min_max_result<I>; @@ -207,18 +207,18 @@ namespace ranges { template<forward_iterator I, sentinel_for<I> S, class Proj = identity, indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> constexpr ranges::minmax_element_result<I> - minmax_element(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 + minmax_element(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 template<forward_range R, class Proj = identity, indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> constexpr ranges::minmax_element_result<borrowed_iterator_t<R>> - minmax_element(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 + minmax_element(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 template<class I, class O> - using copy_result = in_out_result<I, O>; // since C++20 + using copy_result = in_out_result<I, O>; // since C++20 template<class I, class O> - using copy_n_result = in_out_result<I, O>; // since C++20 + using copy_n_result = in_out_result<I, O>; // since C++20 template<class I, class O> using copy_if_result = in_out_result<I, O>; // since C++20 @@ -333,20 +333,20 @@ namespace ranges { template<random_access_iterator I, sentinel_for<I> S, class Proj = identity, indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> - constexpr bool is_heap(I first, S last, Comp comp = {}, Proj proj = {}); // Since C++20 + constexpr bool is_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 template<random_access_range R, class Proj = identity, indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> - constexpr bool is_heap(R&& r, Comp comp = {}, Proj proj = {}); // Since C++20 + constexpr bool is_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 template<random_access_iterator I, sentinel_for<I> S, class Proj = identity, indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> - constexpr I is_heap_until(I first, S last, Comp comp = {}, Proj proj = {}); // Since C++20 + constexpr I is_heap_until(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 template<random_access_range R, class Proj = identity, indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> constexpr borrowed_iterator_t<R> - is_heap_until(R&& r, Comp comp = {}, Proj proj = {}); // Since C++20 + is_heap_until(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 template<bidirectional_iterator I, sentinel_for<I> S> requires permutable<I> @@ -399,15 +399,24 @@ namespace ranges { template<input_or_output_iterator O, sentinel_for<O> S, copy_constructible F> requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>> - constexpr O generate(O first, S last, F gen); // Since C++20 + constexpr O generate(O first, S last, F gen); // since C++20 + + template<class ExecutionPolicy, class ForwardIterator, class Generator> + void generate(ExecutionPolicy&& exec, + ForwardIterator first, ForwardIterator last, + Generator gen); // since C++17 template<class R, copy_constructible F> requires invocable<F&> && output_range<R, invoke_result_t<F&>> - constexpr borrowed_iterator_t<R> generate(R&& r, F gen); // Since C++20 + constexpr borrowed_iterator_t<R> generate(R&& r, F gen); // since C++20 template<input_or_output_iterator O, copy_constructible F> requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>> - constexpr O generate_n(O first, iter_difference_t<O> n, F gen); // Since C++20 + constexpr O generate_n(O first, iter_difference_t<O> n, F gen); // since C++20 + + template<class ExecutionPolicy, class ForwardIterator, class Size, class Generator> + ForwardIterator generate_n(ExecutionPolicy&& exec, + ForwardIterator first, Size n, Generator gen); // since C++17 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> @@ -424,27 +433,39 @@ namespace ranges { template<input_iterator I, sentinel_for<I> S, class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred> - constexpr bool ranges::all_of(I first, S last, Pred pred, Proj proj = {}); // since C++20 + constexpr bool ranges::all_of(I first, S last, Pred pred, Proj proj = {}); // since C++20 template<input_range R, class Proj = identity, indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> - constexpr bool ranges::all_of(R&& r, Pred pred, Proj proj = {}); // since C++20 + constexpr bool ranges::all_of(R&& r, Pred pred, Proj proj = {}); // since C++20 template<input_iterator I, sentinel_for<I> S, class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred> - constexpr bool ranges::any_of(I first, S last, Pred pred, Proj proj = {}); // since C++20 + constexpr bool ranges::any_of(I first, S last, Pred pred, Proj proj = {}); // since C++20 template<input_range R, class Proj = identity, indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> - constexpr bool ranges::any_of(R&& r, Pred pred, Proj proj = {}); // since C++20 + constexpr bool ranges::any_of(R&& r, Pred pred, Proj proj = {}); // since C++20 template<input_iterator I, sentinel_for<I> S, class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred> - constexpr bool ranges::none_of(I first, S last, Pred pred, Proj proj = {}); // since C++20 + constexpr bool ranges::none_of(I first, S last, Pred pred, Proj proj = {}); // since C++20 template<input_range R, class Proj = identity, indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> - constexpr bool ranges::none_of(R&& r, Pred pred, Proj proj = {}); // since C++20 + constexpr bool ranges::none_of(R&& r, Pred pred, Proj proj = {}); // since C++20 + + template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, + class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> + requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2> + constexpr bool ranges::starts_with(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, + Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23 + + template<input_range R1, input_range R2, class Pred = ranges::equal_to, class Proj1 = identity, + class Proj2 = identity> + requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2> + constexpr bool ranges::starts_with(R1&& r1, R2&& r2, Pred pred = {}, + Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23 template<input_iterator I1, sentinel_for<I1> S1, random_access_iterator I2, sentinel_for<I2> S2, @@ -453,7 +474,7 @@ namespace ranges { indirect_strict_weak_order<Comp, projected<I1, Proj1>, projected<I2, Proj2>> constexpr partial_sort_copy_result<I1, I2> partial_sort_copy(I1 first, S1 last, I2 result_first, S2 result_last, - Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // Since C++20 + Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 template<input_range R1, random_access_range R2, class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity> @@ -463,7 +484,7 @@ namespace ranges { projected<iterator_t<R2>, Proj2>> constexpr partial_sort_copy_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>> partial_sort_copy(R1&& r, R2&& result_r, Comp comp = {}, - Proj1 proj1 = {}, Proj2 proj2 = {}); // Since C++20 + Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 template<forward_iterator I, sentinel_for<I> S, class Proj = identity, indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> @@ -486,64 +507,64 @@ namespace ranges { class Proj = identity> requires sortable<I, Comp, Proj> constexpr I - ranges::nth_element(I first, I nth, S last, Comp comp = {}, Proj proj = {}); // since C++20 + ranges::nth_element(I first, I nth, S last, Comp comp = {}, Proj proj = {}); // since C++20 template<random_access_range R, class Comp = ranges::less, class Proj = identity> requires sortable<iterator_t<R>, Comp, Proj> constexpr borrowed_iterator_t<R> - ranges::nth_element(R&& r, iterator_t<R> nth, Comp comp = {}, Proj proj = {}); // since C++20 + ranges::nth_element(R&& r, iterator_t<R> nth, Comp comp = {}, Proj proj = {}); // since C++20 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity, - indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less> - constexpr I upper_bound(I first, S last, const T& value, Comp comp = {}, Proj proj = {}); // since C++20 + indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less> // since C++20 + constexpr I upper_bound(I first, S last, const T& value, Comp comp = {}, Proj proj = {}); template<forward_range R, class T, class Proj = identity, indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp = ranges::less> constexpr borrowed_iterator_t<R> - upper_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20 + upper_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity, indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less> constexpr I lower_bound(I first, S last, const T& value, Comp comp = {}, - Proj proj = {}); // since C++20 + Proj proj = {}); // since C++20 template<forward_range R, class T, class Proj = identity, indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp = ranges::less> constexpr borrowed_iterator_t<R> - lower_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20 + lower_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity, indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less> constexpr bool binary_search(I first, S last, const T& value, Comp comp = {}, - Proj proj = {}); // since C++20 + Proj proj = {}); // since C++20 template<forward_range R, class T, class Proj = identity, indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp = ranges::less> constexpr bool binary_search(R&& r, const T& value, Comp comp = {}, - Proj proj = {}); // since C++20 + Proj proj = {}); // since C++20 template<permutable I, sentinel_for<I> S, class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred> constexpr subrange<I> - partition(I first, S last, Pred pred, Proj proj = {}); // Since C++20 + partition(I first, S last, Pred pred, Proj proj = {}); // since C++20 template<forward_range R, class Proj = identity, indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> requires permutable<iterator_t<R>> constexpr borrowed_subrange_t<R> - partition(R&& r, Pred pred, Proj proj = {}); // Since C++20 + partition(R&& r, Pred pred, Proj proj = {}); // since C++20 template<bidirectional_iterator I, sentinel_for<I> S, class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred> requires permutable<I> - subrange<I> stable_partition(I first, S last, Pred pred, Proj proj = {}); // Since C++20 + subrange<I> stable_partition(I first, S last, Pred pred, Proj proj = {}); // since C++20 template<bidirectional_range R, class Proj = identity, indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> requires permutable<iterator_t<R>> - borrowed_subrange_t<R> stable_partition(R&& r, Pred pred, Proj proj = {}); // Since C++20 + borrowed_subrange_t<R> stable_partition(R&& r, Pred pred, Proj proj = {}); // since C++20 template<input_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2, class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> @@ -563,7 +584,7 @@ namespace ranges { template<forward_iterator I, sentinel_for<I> S, class Proj = identity, indirect_binary_predicate<projected<I, Proj>, projected<I, Proj>> Pred = ranges::equal_to> - constexpr I ranges::adjacent_find(I first, S last, Pred pred = {}, Proj proj = {}); // since C+20 + constexpr I ranges::adjacent_find(I first, S last, Pred pred = {}, Proj proj = {}); // since C++20 template<forward_range R, class Proj = identity, indirect_binary_predicate<projected<iterator_t<R>, Proj>, @@ -604,7 +625,7 @@ namespace ranges { projected<I2, Proj2>> Comp = ranges::less> constexpr bool ranges::lexicographical_compare(I1 first1, S1 last1, I2 first2, S2 last2, - Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 + Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 template<input_range R1, input_range R2, class Proj1 = identity, class Proj2 = identity, @@ -612,7 +633,7 @@ namespace ranges { projected<iterator_t<R2>, Proj2>> Comp = ranges::less> constexpr bool ranges::lexicographical_compare(R1&& r1, R2&& r2, Comp comp = {}, - Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 + Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 template<bidirectional_iterator I1, sentinel_for<I1> S1, bidirectional_iterator I2> requires indirectly_movable<I1, I2> @@ -643,7 +664,7 @@ namespace ranges { requires indirectly_copyable<I, O1> && indirectly_copyable<I, O2> constexpr partition_copy_result<I, O1, O2> partition_copy(I first, S last, O1 out_true, O2 out_false, Pred pred, - Proj proj = {}); // Since C++20 + Proj proj = {}); // since C++20 template<input_range R, weakly_incrementable O1, weakly_incrementable O2, class Proj = identity, @@ -651,16 +672,16 @@ namespace ranges { requires indirectly_copyable<iterator_t<R>, O1> && indirectly_copyable<iterator_t<R>, O2> constexpr partition_copy_result<borrowed_iterator_t<R>, O1, O2> - partition_copy(R&& r, O1 out_true, O2 out_false, Pred pred, Proj proj = {}); // Since C++20 + partition_copy(R&& r, O1 out_true, O2 out_false, Pred pred, Proj proj = {}); // since C++20 template<forward_iterator I, sentinel_for<I> S, class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred> - constexpr I partition_point(I first, S last, Pred pred, Proj proj = {}); // Since C++20 + constexpr I partition_point(I first, S last, Pred pred, Proj proj = {}); // since C++20 template<forward_range R, class Proj = identity, indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> constexpr borrowed_iterator_t<R> - partition_point(R&& r, Pred pred, Proj proj = {}); // Since C++20 + partition_point(R&& r, Pred pred, Proj proj = {}); // since C++20 template<class I1, class I2, class O> using merge_result = in_in_out_result<I1, I2, O>; // since C++20 @@ -755,7 +776,7 @@ namespace ranges { template<forward_range R> requires permutable<iterator_t<R>> - constexpr borrowed_subrange_t<R> rotate(R&& r, iterator_t<R> middle); // Since C++20 + constexpr borrowed_subrange_t<R> rotate(R&& r, iterator_t<R> middle); // since C++20 template <class _InIter, class _OutIter> using rotate_copy_result = in_out_result<_InIter, _OutIter>; // since C++20 @@ -774,23 +795,23 @@ namespace ranges { requires (forward_iterator<I> || random_access_iterator<O>) && indirectly_copyable<I, O> && uniform_random_bit_generator<remove_reference_t<Gen>> - O sample(I first, S last, O out, iter_difference_t<I> n, Gen&& g); // Since C++20 + O sample(I first, S last, O out, iter_difference_t<I> n, Gen&& g); // since C++20 template<input_range R, weakly_incrementable O, class Gen> requires (forward_range<R> || random_access_iterator<O>) && indirectly_copyable<iterator_t<R>, O> && uniform_random_bit_generator<remove_reference_t<Gen>> - O sample(R&& r, O out, range_difference_t<R> n, Gen&& g); // Since C++20 + O sample(R&& r, O out, range_difference_t<R> n, Gen&& g); // since C++20 template<random_access_iterator I, sentinel_for<I> S, class Gen> requires permutable<I> && uniform_random_bit_generator<remove_reference_t<Gen>> - I shuffle(I first, S last, Gen&& g); // Since C++20 + I shuffle(I first, S last, Gen&& g); // since C++20 template<random_access_range R, class Gen> requires permutable<iterator_t<R>> && uniform_random_bit_generator<remove_reference_t<Gen>> - borrowed_iterator_t<R> shuffle(R&& r, Gen&& g); // Since C++20 + borrowed_iterator_t<R> shuffle(R&& r, Gen&& g); // since C++20 template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2, class Proj1 = identity, class Proj2 = identity, @@ -798,14 +819,14 @@ namespace ranges { projected<I2, Proj2>> Pred = ranges::equal_to> constexpr bool ranges::is_permutation(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, - Proj1 proj1 = {}, Proj2 proj2 = {}); // Since C++20 + Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 template<forward_range R1, forward_range R2, class Proj1 = identity, class Proj2 = identity, indirect_equivalence_relation<projected<iterator_t<R1>, Proj1>, projected<iterator_t<R2>, Proj2>> Pred = ranges::equal_to> constexpr bool ranges::is_permutation(R1&& r1, R2&& r2, Pred pred = {}, - Proj1 proj1 = {}, Proj2 proj2 = {}); // Since C++20 + Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2, class Pred = ranges::equal_to, @@ -904,35 +925,35 @@ namespace ranges { indirect_strict_weak_order<projected<I1, Proj1>, projected<I2, Proj2>> Comp = ranges::less> constexpr bool includes(I1 first1, S1 last1, I2 first2, S2 last2, Comp comp = {}, - Proj1 proj1 = {}, Proj2 proj2 = {}); // Since C++20 + Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 template<input_range R1, input_range R2, class Proj1 = identity, class Proj2 = identity, indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>, projected<iterator_t<R2>, Proj2>> Comp = ranges::less> constexpr bool includes(R1&& r1, R2&& r2, Comp comp = {}, - Proj1 proj1 = {}, Proj2 proj2 = {}); // Since C++20 + Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less, class Proj = identity> requires sortable<I, Comp, Proj> - I inplace_merge(I first, I middle, S last, Comp comp = {}, Proj proj = {}); // Since C++20 + I inplace_merge(I first, I middle, S last, Comp comp = {}, Proj proj = {}); // since C++20 template<bidirectional_range R, class Comp = ranges::less, class Proj = identity> requires sortable<iterator_t<R>, Comp, Proj> borrowed_iterator_t<R> inplace_merge(R&& r, iterator_t<R> middle, Comp comp = {}, - Proj proj = {}); // Since C++20 + Proj proj = {}); // since C++20 template<permutable I, sentinel_for<I> S, class Proj = identity, indirect_equivalence_relation<projected<I, Proj>> C = ranges::equal_to> - constexpr subrange<I> unique(I first, S last, C comp = {}, Proj proj = {}); // Since C++20 + constexpr subrange<I> unique(I first, S last, C comp = {}, Proj proj = {}); // since C++20 template<forward_range R, class Proj = identity, indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to> requires permutable<iterator_t<R>> constexpr borrowed_subrange_t<R> - unique(R&& r, C comp = {}, Proj proj = {}); // Since C++20 + unique(R&& r, C comp = {}, Proj proj = {}); // since C++20 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Proj = identity, indirect_equivalence_relation<projected<I, Proj>> C = ranges::equal_to> @@ -941,7 +962,7 @@ namespace ranges { (input_iterator<O> && same_as<iter_value_t<I>, iter_value_t<O>>) || indirectly_copyable_storable<I, O>) constexpr unique_copy_result<I, O> - unique_copy(I first, S last, O result, C comp = {}, Proj proj = {}); // Since C++20 + unique_copy(I first, S last, O result, C comp = {}, Proj proj = {}); // since C++20 template<input_range R, weakly_incrementable O, class Proj = identity, indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to> @@ -950,41 +971,41 @@ namespace ranges { (input_iterator<O> && same_as<range_value_t<R>, iter_value_t<O>>) || indirectly_copyable_storable<iterator_t<R>, O>) constexpr unique_copy_result<borrowed_iterator_t<R>, O> - unique_copy(R&& r, O result, C comp = {}, Proj proj = {}); // Since C++20 + unique_copy(R&& r, O result, C comp = {}, Proj proj = {}); // since C++20 template<class I, class O> - using remove_copy_result = in_out_result<I, O>; // Since C++20 + using remove_copy_result = in_out_result<I, O>; // since C++20 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class T, class Proj = identity> indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*> constexpr remove_copy_result<I, O> - remove_copy(I first, S last, O result, const T& value, Proj proj = {}); // Since C++20 + remove_copy(I first, S last, O result, const T& value, Proj proj = {}); // since C++20 template<input_range R, weakly_incrementable O, class T, class Proj = identity> requires indirectly_copyable<iterator_t<R>, O> && indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*> constexpr remove_copy_result<borrowed_iterator_t<R>, O> - remove_copy(R&& r, O result, const T& value, Proj proj = {}); // Since C++20 + remove_copy(R&& r, O result, const T& value, Proj proj = {}); // since C++20 template<class I, class O> - using remove_copy_if_result = in_out_result<I, O>; // Since C++20 + using remove_copy_if_result = in_out_result<I, O>; // since C++20 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred> requires indirectly_copyable<I, O> constexpr remove_copy_if_result<I, O> - remove_copy_if(I first, S last, O result, Pred pred, Proj proj = {}); // Since C++20 + remove_copy_if(I first, S last, O result, Pred pred, Proj proj = {}); // since C++20 template<input_range R, weakly_incrementable O, class Proj = identity, indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> requires indirectly_copyable<iterator_t<R>, O> constexpr remove_copy_if_result<borrowed_iterator_t<R>, O> - remove_copy_if(R&& r, O result, Pred pred, Proj proj = {}); // Since C++20 + remove_copy_if(R&& r, O result, Pred pred, Proj proj = {}); // since C++20 template<class I, class O> - using replace_copy_result = in_out_result<I, O>; // Since C++20 + using replace_copy_result = in_out_result<I, O>; // since C++20 template<input_iterator I, sentinel_for<I> S, class T1, class T2, output_iterator<const T2&> O, class Proj = identity> @@ -992,7 +1013,7 @@ namespace ranges { indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*> constexpr replace_copy_result<I, O> replace_copy(I first, S last, O result, const T1& old_value, const T2& new_value, - Proj proj = {}); // Since C++20 + Proj proj = {}); // since C++20 template<input_range R, class T1, class T2, output_iterator<const T2&> O, class Proj = identity> @@ -1001,54 +1022,54 @@ namespace ranges { projected<iterator_t<R>, Proj>, const T1*> constexpr replace_copy_result<borrowed_iterator_t<R>, O> replace_copy(R&& r, O result, const T1& old_value, const T2& new_value, - Proj proj = {}); // Since C++20 + Proj proj = {}); // since C++20 template<class I, class O> - using replace_copy_if_result = in_out_result<I, O>; // Since C++20 + using replace_copy_if_result = in_out_result<I, O>; // since C++20 template<input_iterator I, sentinel_for<I> S, class T, output_iterator<const T&> O, class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred> requires indirectly_copyable<I, O> constexpr replace_copy_if_result<I, O> replace_copy_if(I first, S last, O result, Pred pred, const T& new_value, - Proj proj = {}); // Since C++20 + Proj proj = {}); // since C++20 template<input_range R, class T, output_iterator<const T&> O, class Proj = identity, indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> requires indirectly_copyable<iterator_t<R>, O> constexpr replace_copy_if_result<borrowed_iterator_t<R>, O> replace_copy_if(R&& r, O result, Pred pred, const T& new_value, - Proj proj = {}); // Since C++20 + Proj proj = {}); // since C++20 template<class I> - using prev_permutation_result = in_found_result<I>; // Since C++20 + using prev_permutation_result = in_found_result<I>; // since C++20 template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less, class Proj = identity> requires sortable<I, Comp, Proj> constexpr ranges::prev_permutation_result<I> - ranges::prev_permutation(I first, S last, Comp comp = {}, Proj proj = {}); // Since C++20 + ranges::prev_permutation(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 template<bidirectional_range R, class Comp = ranges::less, class Proj = identity> requires sortable<iterator_t<R>, Comp, Proj> constexpr ranges::prev_permutation_result<borrowed_iterator_t<R>> - ranges::prev_permutation(R&& r, Comp comp = {}, Proj proj = {}); // Since C++20 + ranges::prev_permutation(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 template<class I> - using next_permutation_result = in_found_result<I>; // Since C++20 + using next_permutation_result = in_found_result<I>; // since C++20 template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less, class Proj = identity> requires sortable<I, Comp, Proj> constexpr ranges::next_permutation_result<I> - ranges::next_permutation(I first, S last, Comp comp = {}, Proj proj = {}); // Since C++20 + ranges::next_permutation(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 template<bidirectional_range R, class Comp = ranges::less, class Proj = identity> requires sortable<iterator_t<R>, Comp, Proj> constexpr ranges::next_permutation_result<borrowed_iterator_t<R>> - ranges::next_permutation(R&& r, Comp comp = {}, Proj proj = {}); // Since C++20 + ranges::next_permutation(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 } @@ -1684,6 +1705,18 @@ template <class InputIterator1, class InputIterator2, class Compare> lexicographical_compare(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, Compare comp); +template<class InputIterator1, class InputIterator2, class Cmp> + constexpr auto + lexicographical_compare_three_way(InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, InputIterator2 last2, + Cmp comp) + -> decltype(comp(*b1, *b2)); // since C++20 + +template<class InputIterator1, class InputIterator2> + constexpr auto + lexicographical_compare_three_way(InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, InputIterator2 last2); // since C++20 + template <class BidirectionalIterator> constexpr bool // constexpr in C++20 next_permutation(BidirectionalIterator first, BidirectionalIterator last); @@ -1705,9 +1738,7 @@ template <class BidirectionalIterator, class Compare> #include <__assert> // all public C++ headers provide the assertion handler #include <__config> -#include <__debug> #include <cstddef> -#include <type_traits> #include <version> #include <__algorithm/adjacent_find.h> @@ -1753,6 +1784,7 @@ template <class BidirectionalIterator, class Compare> #include <__algorithm/is_sorted_until.h> #include <__algorithm/iter_swap.h> #include <__algorithm/lexicographical_compare.h> +#include <__algorithm/lexicographical_compare_three_way.h> #include <__algorithm/lower_bound.h> #include <__algorithm/make_heap.h> #include <__algorithm/max.h> @@ -1776,6 +1808,19 @@ template <class BidirectionalIterator, class Compare> #include <__algorithm/partition_point.h> #include <__algorithm/pop_heap.h> #include <__algorithm/prev_permutation.h> +#include <__algorithm/pstl_any_all_none_of.h> +#include <__algorithm/pstl_copy.h> +#include <__algorithm/pstl_count.h> +#include <__algorithm/pstl_fill.h> +#include <__algorithm/pstl_find.h> +#include <__algorithm/pstl_for_each.h> +#include <__algorithm/pstl_generate.h> +#include <__algorithm/pstl_is_partitioned.h> +#include <__algorithm/pstl_merge.h> +#include <__algorithm/pstl_replace.h> +#include <__algorithm/pstl_sort.h> +#include <__algorithm/pstl_stable_sort.h> +#include <__algorithm/pstl_transform.h> #include <__algorithm/push_heap.h> #include <__algorithm/ranges_adjacent_find.h> #include <__algorithm/ranges_all_of.h> @@ -1857,6 +1902,7 @@ template <class BidirectionalIterator, class Compare> #include <__algorithm/ranges_sort_heap.h> #include <__algorithm/ranges_stable_partition.h> #include <__algorithm/ranges_stable_sort.h> +#include <__algorithm/ranges_starts_with.h> #include <__algorithm/ranges_swap_ranges.h> #include <__algorithm/ranges_transform.h> #include <__algorithm/ranges_unique.h> @@ -1886,6 +1932,7 @@ template <class BidirectionalIterator, class Compare> #include <__algorithm/shuffle.h> #include <__algorithm/sift_down.h> #include <__algorithm/sort.h> +#include <__algorithm/sort_old.h> #include <__algorithm/sort_heap.h> #include <__algorithm/stable_partition.h> #include <__algorithm/stable_sort.h> @@ -1905,21 +1952,16 @@ template <class BidirectionalIterator, class Compare> # pragma GCC system_header #endif -#if defined(_LIBCPP_HAS_PARALLEL_ALGORITHMS) && _LIBCPP_STD_VER >= 17 -#error # include <__pstl_algorithm> -#endif - -#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17 -# include <chrono> -#endif - #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <atomic> +# include <bit> # include <concepts> +# include <cstdlib> # include <cstring> # include <iterator> # include <memory> # include <stdexcept> +# include <type_traits> # include <utility> #endif |