From 1f917f69ff07f09b6dbb670971f57f8efe718b84 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Thu, 14 Jul 2022 20:50:02 +0200 Subject: Vendor import of llvm-project main llvmorg-15-init-16436-g18a6ab5b8d1f. --- libcxx/include/algorithm | 234 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 234 insertions(+) (limited to 'libcxx/include/algorithm') diff --git a/libcxx/include/algorithm b/libcxx/include/algorithm index 0154dbc39c08..f616a031960e 100644 --- a/libcxx/include/algorithm +++ b/libcxx/include/algorithm @@ -287,6 +287,50 @@ namespace ranges { indirect_unary_predicate, Proj>> Pred> constexpr bool ranges::is_partitioned(R&& r, Pred pred, Proj proj = {}); // since C++20 + template S, class Comp = ranges::less, + class Proj = identity> + requires sortable + constexpr I + ranges::push_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 + + template + requires sortable, Comp, Proj> + constexpr borrowed_iterator_t + ranges::push_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 + + template S, class Comp = ranges::less, + class Proj = identity> + requires sortable + constexpr I + ranges::pop_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 + + template + requires sortable, Comp, Proj> + constexpr borrowed_iterator_t + ranges::pop_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 + + template S, class Comp = ranges::less, + class Proj = identity> + requires sortable + constexpr I + ranges::make_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 + + template + requires sortable, Comp, Proj> + constexpr borrowed_iterator_t + ranges::make_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 + + template S, class Comp = ranges::less, + class Proj = identity> + requires sortable + constexpr I + ranges::sort_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 + + template + requires sortable, Comp, Proj> + constexpr borrowed_iterator_t + ranges::sort_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 + template S> requires permutable constexpr I ranges::reverse(I first, S last); // since C++20 @@ -379,6 +423,17 @@ namespace ranges { constexpr borrowed_iterator_t ranges::is_sorted_until(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 + template S, class Comp = ranges::less, + class Proj = identity> + requires sortable + constexpr I + ranges::nth_element(I first, I nth, S last, Comp comp = {}, Proj proj = {}); // since C++20 + + template + requires sortable, Comp, Proj> + constexpr borrowed_iterator_t + ranges::nth_element(R&& r, iterator_t nth, Comp comp = {}, Proj proj = {}); // since C++20 + template S, class T, class Proj = identity, indirect_strict_weak_order> Comp = ranges::less> constexpr I upper_bound(I first, S last, const T& value, Comp comp = {}, Proj proj = {}); // since C++20 @@ -493,7 +548,170 @@ namespace ranges { constexpr ranges::move_result, O> ranges::move(R&& r, O result); // since C++20 + template + using merge_result = in_in_out_result; // since C++20 + + template S1, input_iterator I2, sentinel_for S2, + weakly_incrementable O, class Comp = ranges::less, class Proj1 = identity, + class Proj2 = identity> + requires mergeable + constexpr merge_result + merge(I1 first1, S1 last1, I2 first2, S2 last2, O result, + Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 + + template + requires mergeable, iterator_t, O, Comp, Proj1, Proj2> + constexpr merge_result, borrowed_iterator_t, O> + merge(R1&& r1, R2&& r2, O result, + Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 + + template S, class T, class Proj = identity> + requires indirect_binary_predicate, const T*> + constexpr subrange ranges::remove(I first, S last, const T& value, Proj proj = {}); // since C++20 + + template + requires permutable> && + indirect_binary_predicate, Proj>, const T*> + constexpr borrowed_subrange_t + ranges::remove(R&& r, const T& value, Proj proj = {}); // since C++20 + + template S, class Proj = identity, + indirect_unary_predicate> Pred> + constexpr subrange ranges::remove_if(I first, S last, Pred pred, Proj proj = {}); // since C++20 + + template, Proj>> Pred> + requires permutable> + constexpr borrowed_subrange_t + ranges::remove_if(R&& r, Pred pred, Proj proj = {}); // since C++20 + + template + using set_difference_result = in_out_result; // since C++20 + template S1, input_iterator I2, sentinel_for S2, + weakly_incrementable O, class Comp = ranges::less, + class Proj1 = identity, class Proj2 = identity> + requires mergeable + constexpr set_difference_result + set_difference(I1 first1, S1 last1, I2 first2, S2 last2, O result, + Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 + + template + requires mergeable, iterator_t, O, Comp, Proj1, Proj2> + constexpr set_difference_result, O> + set_difference(R1&& r1, R2&& r2, O result, + Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 + + template + using set_intersection_result = in_in_out_result; // since C++20 + + template S1, input_iterator I2, sentinel_for S2, + weakly_incrementable O, class Comp = ranges::less, + class Proj1 = identity, class Proj2 = identity> + requires mergeable + constexpr set_intersection_result + set_intersection(I1 first1, S1 last1, I2 first2, S2 last2, O result, + Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 + + template S1, input_iterator I2, sentinel_for S2, + weakly_incrementable O, class Comp = ranges::less, + class Proj1 = identity, class Proj2 = identity> + requires mergeable + constexpr set_intersection_result, borrowed_iterator_t, O> + set_intersection(R1&& r1, R2&& r2, O result, + Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 + + template + using reverse_copy_result = in_out_result<_InIter, _OutIter>; // since C++20 + + template S, weakly_incrementable O> + requires indirectly_copyable + constexpr ranges::reverse_copy_result + ranges::reverse_copy(I first, S last, O result); // since C++20 + + template + requires indirectly_copyable, O> + constexpr ranges::reverse_copy_result, O> + ranges::reverse_copy(R&& r, O result); // since C++20 + + template + using rotate_copy_result = in_out_result<_InIter, _OutIter>; // since C++20 + + template S, weakly_incrementable O> + requires indirectly_copyable + constexpr ranges::rotate_copy_result + ranges::rotate_copy(I first, I middle, S last, O result); // since C++20 + + template + requires indirectly_copyable, O> + constexpr ranges::rotate_copy_result, O> + ranges::rotate_copy(R&& r, iterator_t middle, O result); // since C++20 + + template S1, forward_iterator I2, + sentinel_for S2, class Pred = ranges::equal_to, + class Proj1 = identity, class Proj2 = identity> + requires indirectly_comparable + constexpr subrange + ranges::search(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, + Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 + + template + requires indirectly_comparable, iterator_t, Pred, Proj1, Proj2> + constexpr borrowed_subrange_t + ranges::search(R1&& r1, R2&& r2, Pred pred = {}, + Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 + + template S, class T, + class Pred = ranges::equal_to, class Proj = identity> + requires indirectly_comparable + constexpr subrange + ranges::search_n(I first, S last, iter_difference_t count, + const T& value, Pred pred = {}, Proj proj = {}); // since C++20 + + template + requires indirectly_comparable, const T*, Pred, Proj> + constexpr borrowed_subrange_t + ranges::search_n(R&& r, range_difference_t count, + const T& value, Pred pred = {}, Proj proj = {}); // since C++20 + + template S1, forward_iterator I2, sentinel_for S2, + class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> + requires indirectly_comparable + constexpr subrange + ranges::find_end(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, + Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 + + template + requires indirectly_comparable, iterator_t, Pred, Proj1, Proj2> + constexpr borrowed_subrange_t + ranges::find_end(R1&& r1, R2&& r2, Pred pred = {}, + Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 + + template + using set_symmetric_difference_result = in_in_out_result; // since C++20 + + template S1, input_iterator I2, sentinel_for S2, + weakly_incrementable O, class Comp = ranges::less, + class Proj1 = identity, class Proj2 = identity> + requires mergeable + constexpr set_symmetric_difference_result + set_symmetric_difference(I1 first1, S1 last1, I2 first2, S2 last2, O result, + Comp comp = {}, Proj1 proj1 = {}, + Proj2 proj2 = {}); // since C++20 + + template + requires mergeable, iterator_t, O, Comp, Proj1, Proj2> + constexpr set_symmetric_difference_result, + borrowed_iterator_t, O> + set_symmetric_difference(R1&& r1, R2&& r2, O result, Comp comp = {}, + Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 + } constexpr bool // constexpr in C++20 @@ -1237,6 +1455,7 @@ template #include <__algorithm/ranges_fill.h> #include <__algorithm/ranges_fill_n.h> #include <__algorithm/ranges_find.h> +#include <__algorithm/ranges_find_end.h> #include <__algorithm/ranges_find_first_of.h> #include <__algorithm/ranges_find_if.h> #include <__algorithm/ranges_find_if_not.h> @@ -1247,8 +1466,10 @@ template #include <__algorithm/ranges_is_sorted_until.h> #include <__algorithm/ranges_lexicographical_compare.h> #include <__algorithm/ranges_lower_bound.h> +#include <__algorithm/ranges_make_heap.h> #include <__algorithm/ranges_max.h> #include <__algorithm/ranges_max_element.h> +#include <__algorithm/ranges_merge.h> #include <__algorithm/ranges_min.h> #include <__algorithm/ranges_min_element.h> #include <__algorithm/ranges_minmax.h> @@ -1257,10 +1478,23 @@ template #include <__algorithm/ranges_move.h> #include <__algorithm/ranges_move_backward.h> #include <__algorithm/ranges_none_of.h> +#include <__algorithm/ranges_nth_element.h> +#include <__algorithm/ranges_pop_heap.h> +#include <__algorithm/ranges_push_heap.h> +#include <__algorithm/ranges_remove.h> +#include <__algorithm/ranges_remove_if.h> #include <__algorithm/ranges_replace.h> #include <__algorithm/ranges_replace_if.h> #include <__algorithm/ranges_reverse.h> +#include <__algorithm/ranges_reverse_copy.h> +#include <__algorithm/ranges_rotate_copy.h> +#include <__algorithm/ranges_search.h> +#include <__algorithm/ranges_search_n.h> +#include <__algorithm/ranges_set_difference.h> +#include <__algorithm/ranges_set_intersection.h> +#include <__algorithm/ranges_set_symmetric_difference.h> #include <__algorithm/ranges_sort.h> +#include <__algorithm/ranges_sort_heap.h> #include <__algorithm/ranges_stable_sort.h> #include <__algorithm/ranges_swap_ranges.h> #include <__algorithm/ranges_transform.h> -- cgit v1.3