Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1 | // -*- C++ -*- |
Louis Dionne | eb8650a | 2021-11-17 21:25:01 | [diff] [blame] | 2 | //===----------------------------------------------------------------------===// |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 3 | // |
Chandler Carruth | 57b08b0 | 2019-01-19 10:56:40 | [diff] [blame] | 4 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 5 | // See https://llvm.org/LICENSE.txt for license information. |
| 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #ifndef _LIBCPP_ALGORITHM |
| 11 | #define _LIBCPP_ALGORITHM |
| 12 | |
| 13 | /* |
| 14 | algorithm synopsis |
| 15 | |
| 16 | #include <initializer_list> |
| 17 | |
| 18 | namespace std |
| 19 | { |
| 20 | |
Nikolas Klauser | d3729bb | 2022-01-14 01:55:51 | [diff] [blame] | 21 | namespace ranges { |
Konstantin Varlamov | 79a2b4b | 2022-06-28 18:59:59 | [diff] [blame] | 22 | |
| 23 | // [algorithms.results], algorithm result types |
Nikolas Klauser | 1e77b39 | 2022-02-11 16:01:58 | [diff] [blame] | 24 | template <class I, class F> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 25 | struct in_fun_result; // since C++20 |
Nikolas Klauser | 1e77b39 | 2022-02-11 16:01:58 | [diff] [blame] | 26 | |
Nikolas Klauser | d3729bb | 2022-01-14 01:55:51 | [diff] [blame] | 27 | template <class I1, class I2> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 28 | struct in_in_result; // since C++20 |
Nikolas Klauser | f3514af | 2022-01-25 10:21:47 | [diff] [blame] | 29 | |
Konstantin Varlamov | 79a2b4b | 2022-06-28 18:59:59 | [diff] [blame] | 30 | template <class I, class O> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 31 | struct in_out_result; // since C++20 |
Konstantin Varlamov | 79a2b4b | 2022-06-28 18:59:59 | [diff] [blame] | 32 | |
Nikolas Klauser | f3514af | 2022-01-25 10:21:47 | [diff] [blame] | 33 | template <class I1, class I2, class O> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 34 | struct in_in_out_result; // since C++20 |
Nikolas Klauser | 610979b | 2022-02-03 01:17:03 | [diff] [blame] | 35 | |
| 36 | template <class I, class O1, class O2> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 37 | struct in_out_out_result; // since C++20 |
Nikolas Klauser | 1e77b39 | 2022-02-11 16:01:58 | [diff] [blame] | 38 | |
Nikolas Klauser | 807766b | 2022-02-21 21:48:36 | [diff] [blame] | 39 | template <class I1, class I2> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 40 | struct min_max_result; // since C++20 |
Nikolas Klauser | 807766b | 2022-02-21 21:48:36 | [diff] [blame] | 41 | |
Nikolas Klauser | 68f4131 | 2022-02-21 22:07:02 | [diff] [blame] | 42 | template <class I> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 43 | struct in_found_result; // since C++20 |
Nikolas Klauser | 68f4131 | 2022-02-21 22:07:02 | [diff] [blame] | 44 | |
Christopher Di Bella | 3903438 | 2023-12-20 05:57:50 | [diff] [blame] | 45 | template <class I, class T> |
| 46 | struct in_value_result; // since C++23 |
| 47 | |
Nikolas Klauser | 3b470d1 | 2022-02-11 12:11:57 | [diff] [blame] | 48 | template<forward_iterator I, sentinel_for<I> S, class Proj = identity, |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 49 | indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> // since C++20 |
Nikolas Klauser | 3b470d1 | 2022-02-11 12:11:57 | [diff] [blame] | 50 | constexpr I min_element(I first, S last, Comp comp = {}, Proj proj = {}); |
| 51 | |
| 52 | template<forward_range R, class Proj = identity, |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 53 | indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> // since C++20 |
Nikolas Klauser | 3b470d1 | 2022-02-11 12:11:57 | [diff] [blame] | 54 | constexpr borrowed_iterator_t<R> min_element(R&& r, Comp comp = {}, Proj proj = {}); |
Nikolas Klauser | c2cd15a | 2022-03-08 22:12:35 | [diff] [blame] | 55 | |
Nikolas Klauser | 40f7fca3 | 2022-05-22 11:43:37 | [diff] [blame] | 56 | template<forward_iterator I, sentinel_for<I> S, class Proj = identity, |
| 57 | indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 58 | constexpr I ranges::max_element(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 |
Nikolas Klauser | 40f7fca3 | 2022-05-22 11:43:37 | [diff] [blame] | 59 | |
| 60 | template<forward_range R, class Proj = identity, |
| 61 | indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 62 | constexpr borrowed_iterator_t<R> ranges::max_element(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 |
Nikolas Klauser | 40f7fca3 | 2022-05-22 11:43:37 | [diff] [blame] | 63 | |
Konstantin Varlamov | 79a2b4b | 2022-06-28 18:59:59 | [diff] [blame] | 64 | template<class I1, class I2> |
| 65 | using mismatch_result = in_in_result<I1, I2>; |
| 66 | |
Nikolas Klauser | c2cd15a | 2022-03-08 22:12:35 | [diff] [blame] | 67 | template <input_iterator I1, sentinel_for<_I1> S1, input_iterator I2, sentinel_for<_I2> S2, |
| 68 | class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> |
| 69 | requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 70 | constexpr mismatch_result<_I1, _I2> // since C++20 |
| 71 | mismatch()(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}) |
Nikolas Klauser | c2cd15a | 2022-03-08 22:12:35 | [diff] [blame] | 72 | |
| 73 | template <input_range R1, input_range R2, |
| 74 | class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> |
| 75 | requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2> |
| 76 | constexpr mismatch_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 77 | mismatch(R1&& r1, R2&& r2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}) // since C++20 |
Nikolas Klauser | ee0f8c4 | 2022-03-12 00:45:35 | [diff] [blame] | 78 | |
Nikolas Klauser | ee0f8c4 | 2022-03-12 00:45:35 | [diff] [blame] | 79 | requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 80 | constexpr I find(I first, S last, const T& value, Proj proj = {}); // since C++20 |
Nikolas Klauser | ee0f8c4 | 2022-03-12 00:45:35 | [diff] [blame] | 81 | |
| 82 | template<input_range R, class T, class Proj = identity> |
| 83 | requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*> |
| 84 | constexpr borrowed_iterator_t<R> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 85 | find(R&& r, const T& value, Proj proj = {}); // since C++20 |
Nikolas Klauser | ee0f8c4 | 2022-03-12 00:45:35 | [diff] [blame] | 86 | |
| 87 | template<input_iterator I, sentinel_for<I> S, class Proj = identity, |
| 88 | indirect_unary_predicate<projected<I, Proj>> Pred> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 89 | constexpr I find_if(I first, S last, Pred pred, Proj proj = {}); // since C++20 |
Nikolas Klauser | ee0f8c4 | 2022-03-12 00:45:35 | [diff] [blame] | 90 | |
| 91 | template<input_range R, class Proj = identity, |
| 92 | indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> |
| 93 | constexpr borrowed_iterator_t<R> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 94 | find_if(R&& r, Pred pred, Proj proj = {}); // since C++20 |
Nikolas Klauser | ee0f8c4 | 2022-03-12 00:45:35 | [diff] [blame] | 95 | |
| 96 | template<input_iterator I, sentinel_for<I> S, class Proj = identity, |
| 97 | indirect_unary_predicate<projected<I, Proj>> Pred> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 98 | constexpr I find_if_not(I first, S last, Pred pred, Proj proj = {}); // since C++20 |
Nikolas Klauser | ee0f8c4 | 2022-03-12 00:45:35 | [diff] [blame] | 99 | |
| 100 | template<input_range R, class Proj = identity, |
| 101 | indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> |
| 102 | constexpr borrowed_iterator_t<R> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 103 | find_if_not(R&& r, Pred pred, Proj proj = {}); // since C++20 |
Nikolas Klauser | f83d833 | 2022-03-18 01:57:08 | [diff] [blame] | 104 | |
nicole mazzuca | 04760bf | 2024-07-19 16:42:16 | [diff] [blame] | 105 | template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity> |
| 106 | requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*> |
| 107 | constexpr subrange<I> find_last(I first, S last, const T& value, Proj proj = {}); // since C++23 |
| 108 | |
| 109 | template<forward_range R, class T, class Proj = identity> |
| 110 | requires |
| 111 | indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*> |
| 112 | constexpr borrowed_subrange_t<R> find_last(R&& r, const T& value, Proj proj = {}); // since C++23 |
| 113 | |
| 114 | template<forward_iterator I, sentinel_for<I> S, class Proj = identity, |
| 115 | indirect_unary_predicate<projected<I, Proj>> Pred> |
| 116 | constexpr subrange<I> find_last_if(I first, S last, Pred pred, Proj proj = {}); // since C++23 |
| 117 | |
| 118 | template<forward_range R, class Proj = identity, |
| 119 | indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> |
| 120 | constexpr borrowed_subrange_t<R> find_last_if(R&& r, Pred pred, Proj proj = {}); // since C++23 |
| 121 | |
| 122 | template<forward_iterator I, sentinel_for<I> S, class Proj = identity, |
| 123 | indirect_unary_predicate<projected<I, Proj>> Pred> |
| 124 | constexpr subrange<I> find_last_if_not(I first, S last, Pred pred, Proj proj = {}); // since C++23 |
| 125 | |
| 126 | template<forward_range R, class Proj = identity, |
| 127 | indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> |
| 128 | constexpr borrowed_subrange_t<R> find_last_if_not(R&& r, Pred pred, Proj proj = {}); // since C++23 |
| 129 | |
Nikolas Klauser | e476df5 | 2022-04-03 07:17:01 | [diff] [blame] | 130 | template<class T, class Proj = identity, |
| 131 | indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 132 | constexpr const T& min(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20 |
Nikolas Klauser | f83d833 | 2022-03-18 01:57:08 | [diff] [blame] | 133 | |
Nikolas Klauser | e476df5 | 2022-04-03 07:17:01 | [diff] [blame] | 134 | template<copyable T, class Proj = identity, |
| 135 | indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 136 | constexpr T min(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20 |
Nikolas Klauser | f83d833 | 2022-03-18 01:57:08 | [diff] [blame] | 137 | |
| 138 | template<input_range R, class Proj = identity, |
| 139 | indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> |
| 140 | requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*> |
| 141 | constexpr range_value_t<R> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 142 | min(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 |
Nikolas Klauser | e476df5 | 2022-04-03 07:17:01 | [diff] [blame] | 143 | |
| 144 | template<class T, class Proj = identity, |
| 145 | indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 146 | constexpr const T& max(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20 |
Nikolas Klauser | e476df5 | 2022-04-03 07:17:01 | [diff] [blame] | 147 | |
| 148 | template<copyable T, class Proj = identity, |
| 149 | indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 150 | constexpr T max(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20 |
Nikolas Klauser | e476df5 | 2022-04-03 07:17:01 | [diff] [blame] | 151 | |
| 152 | template<input_range R, class Proj = identity, |
| 153 | indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> |
| 154 | requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*> |
| 155 | constexpr range_value_t<R> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 156 | max(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 |
Nikolas Klauser | 3ba8548 | 2022-04-05 09:05:36 | [diff] [blame] | 157 | |
| 158 | template<class I, class O> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 159 | using unary_transform_result = in_out_result<I, O>; // since C++20 |
Nikolas Klauser | 3ba8548 | 2022-04-05 09:05:36 | [diff] [blame] | 160 | |
| 161 | template<class I1, class I2, class O> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 162 | using binary_transform_result = in_in_out_result<I1, I2, O>; // since C++20 |
Nikolas Klauser | 3ba8548 | 2022-04-05 09:05:36 | [diff] [blame] | 163 | |
| 164 | template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, |
| 165 | copy_constructible F, class Proj = identity> |
| 166 | requires indirectly_writable<O, indirect_result_t<F&, projected<I, Proj>>> |
| 167 | constexpr ranges::unary_transform_result<I, O> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 168 | transform(I first1, S last1, O result, F op, Proj proj = {}); // since C++20 |
Nikolas Klauser | 3ba8548 | 2022-04-05 09:05:36 | [diff] [blame] | 169 | |
| 170 | template<input_range R, weakly_incrementable O, copy_constructible F, |
| 171 | class Proj = identity> |
| 172 | requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R>, Proj>>> |
| 173 | constexpr ranges::unary_transform_result<borrowed_iterator_t<R>, O> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 174 | transform(R&& r, O result, F op, Proj proj = {}); // since C++20 |
Nikolas Klauser | 3ba8548 | 2022-04-05 09:05:36 | [diff] [blame] | 175 | |
| 176 | template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, |
| 177 | weakly_incrementable O, copy_constructible F, class Proj1 = identity, |
| 178 | class Proj2 = identity> |
| 179 | requires indirectly_writable<O, indirect_result_t<F&, projected<I1, Proj1>, |
| 180 | projected<I2, Proj2>>> |
| 181 | constexpr ranges::binary_transform_result<I1, I2, O> |
| 182 | transform(I1 first1, S1 last1, I2 first2, S2 last2, O result, |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 183 | F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 |
Nikolas Klauser | 3ba8548 | 2022-04-05 09:05:36 | [diff] [blame] | 184 | |
| 185 | template<input_range R1, input_range R2, weakly_incrementable O, |
| 186 | copy_constructible F, class Proj1 = identity, class Proj2 = identity> |
| 187 | requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R1>, Proj1>, |
| 188 | projected<iterator_t<R2>, Proj2>>> |
| 189 | constexpr ranges::binary_transform_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O> |
| 190 | transform(R1&& r1, R2&& r2, O result, |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 191 | F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 |
Nikolas Klauser | 1306b10 | 2022-04-07 11:02:02 | [diff] [blame] | 192 | |
| 193 | template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity> |
| 194 | requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*> |
| 195 | constexpr iter_difference_t<I> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 196 | count(I first, S last, const T& value, Proj proj = {}); // since C++20 |
Nikolas Klauser | 1306b10 | 2022-04-07 11:02:02 | [diff] [blame] | 197 | |
| 198 | template<input_range R, class T, class Proj = identity> |
| 199 | requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*> |
| 200 | constexpr range_difference_t<R> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 201 | count(R&& r, const T& value, Proj proj = {}); // since C++20 |
Nikolas Klauser | 1306b10 | 2022-04-07 11:02:02 | [diff] [blame] | 202 | |
| 203 | template<input_iterator I, sentinel_for<I> S, class Proj = identity, |
| 204 | indirect_unary_predicate<projected<I, Proj>> Pred> |
| 205 | constexpr iter_difference_t<I> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 206 | count_if(I first, S last, Pred pred, Proj proj = {}); // since C++20 |
Nikolas Klauser | 1306b10 | 2022-04-07 11:02:02 | [diff] [blame] | 207 | |
| 208 | template<input_range R, class Proj = identity, |
| 209 | indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> |
| 210 | constexpr range_difference_t<R> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 211 | count_if(R&& r, Pred pred, Proj proj = {}); // since C++20 |
Nikolas Klauser | 58d9ab7 | 2022-04-13 20:59:09 | [diff] [blame] | 212 | |
Konstantin Varlamov | 79a2b4b | 2022-06-28 18:59:59 | [diff] [blame] | 213 | template<class T> |
| 214 | using minmax_result = min_max_result<T>; |
| 215 | |
Nikolas Klauser | 58d9ab7 | 2022-04-13 20:59:09 | [diff] [blame] | 216 | template<class T, class Proj = identity, |
| 217 | indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less> |
| 218 | constexpr ranges::minmax_result<const T&> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 219 | minmax(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20 |
Nikolas Klauser | 58d9ab7 | 2022-04-13 20:59:09 | [diff] [blame] | 220 | |
| 221 | template<copyable T, class Proj = identity, |
| 222 | indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less> |
| 223 | constexpr ranges::minmax_result<T> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 224 | minmax(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20 |
Nikolas Klauser | 58d9ab7 | 2022-04-13 20:59:09 | [diff] [blame] | 225 | |
| 226 | template<input_range R, class Proj = identity, |
| 227 | indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> |
| 228 | requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*> |
| 229 | constexpr ranges::minmax_result<range_value_t<R>> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 230 | minmax(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 |
Nikolas Klauser | 58d9ab7 | 2022-04-13 20:59:09 | [diff] [blame] | 231 | |
Konstantin Varlamov | 79a2b4b | 2022-06-28 18:59:59 | [diff] [blame] | 232 | template<class I> |
| 233 | using minmax_element_result = min_max_result<I>; |
| 234 | |
Nikolas Klauser | 58d9ab7 | 2022-04-13 20:59:09 | [diff] [blame] | 235 | template<forward_iterator I, sentinel_for<I> S, class Proj = identity, |
| 236 | indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> |
| 237 | constexpr ranges::minmax_element_result<I> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 238 | minmax_element(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 |
Nikolas Klauser | 58d9ab7 | 2022-04-13 20:59:09 | [diff] [blame] | 239 | |
| 240 | template<forward_range R, class Proj = identity, |
| 241 | indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> |
| 242 | constexpr ranges::minmax_element_result<borrowed_iterator_t<R>> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 243 | minmax_element(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 |
Nikolas Klauser | 1d83750 | 2022-04-15 11:43:40 | [diff] [blame] | 244 | |
ZijunZhaoCCK | a6b846a | 2024-02-13 23:42:37 | [diff] [blame] | 245 | template<forward_iterator I1, sentinel_for<I1> S1, |
| 246 | forward_iterator I2, sentinel_for<I2> S2, |
| 247 | class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> |
| 248 | requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2> |
| 249 | constexpr bool contains_subrange(I1 first1, S1 last1, I2 first2, S2 last2, |
| 250 | Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23 |
| 251 | |
| 252 | template<forward_range R1, forward_range R2, |
| 253 | class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> |
| 254 | requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2> |
| 255 | constexpr bool contains_subrange(R1&& r1, R2&& r2, Pred pred = {}, |
| 256 | Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23 |
| 257 | |
Nikolas Klauser | 1d83750 | 2022-04-15 11:43:40 | [diff] [blame] | 258 | template<class I, class O> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 259 | using copy_result = in_out_result<I, O>; // since C++20 |
Nikolas Klauser | 1d83750 | 2022-04-15 11:43:40 | [diff] [blame] | 260 | |
Konstantin Varlamov | 79a2b4b | 2022-06-28 18:59:59 | [diff] [blame] | 261 | template<class I, class O> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 262 | using copy_n_result = in_out_result<I, O>; // since C++20 |
Nikolas Klauser | 1d83750 | 2022-04-15 11:43:40 | [diff] [blame] | 263 | |
| 264 | template<class I, class O> |
| 265 | using copy_if_result = in_out_result<I, O>; // since C++20 |
| 266 | |
| 267 | template<class I1, class I2> |
| 268 | using copy_backward_result = in_out_result<I1, I2>; // since C++20 |
| 269 | |
ZijunZhaoCCK | fdd089b | 2023-12-20 00:34:19 | [diff] [blame] | 270 | template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity> |
| 271 | requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*> |
| 272 | constexpr bool ranges::contains(I first, S last, const T& value, Proj proj = {}); // since C++23 |
| 273 | |
| 274 | template<input_range R, class T, class Proj = identity> |
| 275 | requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*> |
| 276 | constexpr bool ranges::contains(R&& r, const T& value, Proj proj = {}); // since C++23 |
| 277 | |
Nikolas Klauser | 1d83750 | 2022-04-15 11:43:40 | [diff] [blame] | 278 | template<input_iterator I, sentinel_for<I> S, weakly_incrementable O> |
| 279 | requires indirectly_copyable<I, O> |
| 280 | constexpr ranges::copy_result<I, O> ranges::copy(I first, S last, O result); // since C++20 |
| 281 | |
| 282 | template<input_range R, weakly_incrementable O> |
| 283 | requires indirectly_copyable<iterator_t<R>, O> |
| 284 | constexpr ranges::copy_result<borrowed_iterator_t<R>, O> ranges::copy(R&& r, O result); // since C++20 |
| 285 | |
| 286 | template<input_iterator I, weakly_incrementable O> |
| 287 | requires indirectly_copyable<I, O> |
| 288 | constexpr ranges::copy_n_result<I, O> |
| 289 | ranges::copy_n(I first, iter_difference_t<I> n, O result); // since C++20 |
| 290 | |
| 291 | template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Proj = identity, |
| 292 | indirect_unary_predicate<projected<I, Proj>> Pred> |
| 293 | requires indirectly_copyable<I, O> |
| 294 | constexpr ranges::copy_if_result<I, O> |
| 295 | ranges::copy_if(I first, S last, O result, Pred pred, Proj proj = {}); // since C++20 |
| 296 | |
| 297 | template<input_range R, weakly_incrementable O, class Proj = identity, |
| 298 | indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> |
| 299 | requires indirectly_copyable<iterator_t<R>, O> |
| 300 | constexpr ranges::copy_if_result<borrowed_iterator_t<R>, O> |
| 301 | ranges::copy_if(R&& r, O result, Pred pred, Proj proj = {}); // since C++20 |
| 302 | |
| 303 | template<bidirectional_iterator I1, sentinel_for<I1> S1, bidirectional_iterator I2> |
| 304 | requires indirectly_copyable<I1, I2> |
| 305 | constexpr ranges::copy_backward_result<I1, I2> |
| 306 | ranges::copy_backward(I1 first, S1 last, I2 result); // since C++20 |
| 307 | |
| 308 | template<bidirectional_range R, bidirectional_iterator I> |
| 309 | requires indirectly_copyable<iterator_t<R>, I> |
| 310 | constexpr ranges::copy_backward_result<borrowed_iterator_t<R>, I> |
| 311 | ranges::copy_backward(R&& r, I result); // since C++20 |
Nikolas Klauser | 80045e9 | 2022-05-04 18:27:07 | [diff] [blame] | 312 | |
| 313 | template<class I, class F> |
| 314 | using for_each_result = in_fun_result<I, F>; // since C++20 |
| 315 | |
Louis Dionne | 09e3a36 | 2024-09-16 19:06:20 | [diff] [blame] | 316 | template<class I, class F> |
| 317 | using for_each_n_result = in_fun_result<I, F>; // since C++20 |
| 318 | |
Nikolas Klauser | 80045e9 | 2022-05-04 18:27:07 | [diff] [blame] | 319 | template<input_iterator I, sentinel_for<I> S, class Proj = identity, |
| 320 | indirectly_unary_invocable<projected<I, Proj>> Fun> |
| 321 | constexpr ranges::for_each_result<I, Fun> |
| 322 | ranges::for_each(I first, S last, Fun f, Proj proj = {}); // since C++20 |
| 323 | |
| 324 | template<input_range R, class Proj = identity, |
| 325 | indirectly_unary_invocable<projected<iterator_t<R>, Proj>> Fun> |
| 326 | constexpr ranges::for_each_result<borrowed_iterator_t<R>, Fun> |
| 327 | ranges::for_each(R&& r, Fun f, Proj proj = {}); // since C++20 |
| 328 | |
| 329 | template<input_iterator I, class Proj = identity, |
| 330 | indirectly_unary_invocable<projected<I, Proj>> Fun> |
| 331 | constexpr ranges::for_each_n_result<I, Fun> |
| 332 | ranges::for_each_n(I first, iter_difference_t<I> n, Fun f, Proj proj = {}); // since C++20 |
Nikolas Klauser | 37ba1b9 | 2022-05-04 12:19:09 | [diff] [blame] | 333 | |
| 334 | template<input_iterator I, sentinel_for<I> S, class Proj = identity, |
| 335 | indirect_unary_predicate<projected<I, Proj>> Pred> |
| 336 | constexpr bool ranges::is_partitioned(I first, S last, Pred pred, Proj proj = {}); // since C++20 |
| 337 | |
| 338 | template<input_range R, class Proj = identity, |
| 339 | indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> |
| 340 | constexpr bool ranges::is_partitioned(R&& r, Pred pred, Proj proj = {}); // since C++20 |
| 341 | |
Konstantin Varlamov | c945bd0 | 2022-07-08 20:46:27 | [diff] [blame] | 342 | template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less, |
| 343 | class Proj = identity> |
| 344 | requires sortable<I, Comp, Proj> |
| 345 | constexpr I |
| 346 | ranges::push_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 |
| 347 | |
| 348 | template<random_access_range R, class Comp = ranges::less, class Proj = identity> |
| 349 | requires sortable<iterator_t<R>, Comp, Proj> |
| 350 | constexpr borrowed_iterator_t<R> |
| 351 | ranges::push_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 |
| 352 | |
| 353 | template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less, |
| 354 | class Proj = identity> |
| 355 | requires sortable<I, Comp, Proj> |
| 356 | constexpr I |
| 357 | ranges::pop_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 |
| 358 | |
| 359 | template<random_access_range R, class Comp = ranges::less, class Proj = identity> |
| 360 | requires sortable<iterator_t<R>, Comp, Proj> |
| 361 | constexpr borrowed_iterator_t<R> |
| 362 | ranges::pop_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 |
| 363 | |
| 364 | template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less, |
| 365 | class Proj = identity> |
| 366 | requires sortable<I, Comp, Proj> |
| 367 | constexpr I |
| 368 | ranges::make_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 |
| 369 | |
| 370 | template<random_access_range R, class Comp = ranges::less, class Proj = identity> |
| 371 | requires sortable<iterator_t<R>, Comp, Proj> |
| 372 | constexpr borrowed_iterator_t<R> |
| 373 | ranges::make_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 |
| 374 | |
| 375 | template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less, |
| 376 | class Proj = identity> |
| 377 | requires sortable<I, Comp, Proj> |
| 378 | constexpr I |
| 379 | ranges::sort_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 |
| 380 | |
| 381 | template<random_access_range R, class Comp = ranges::less, class Proj = identity> |
| 382 | requires sortable<iterator_t<R>, Comp, Proj> |
| 383 | constexpr borrowed_iterator_t<R> |
| 384 | ranges::sort_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 |
| 385 | |
Konstantin Varlamov | d406c64 | 2022-07-26 23:11:09 | [diff] [blame] | 386 | template<random_access_iterator I, sentinel_for<I> S, class Proj = identity, |
| 387 | indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 388 | constexpr bool is_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 |
Konstantin Varlamov | d406c64 | 2022-07-26 23:11:09 | [diff] [blame] | 389 | |
| 390 | template<random_access_range R, class Proj = identity, |
| 391 | indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 392 | constexpr bool is_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 |
Konstantin Varlamov | d406c64 | 2022-07-26 23:11:09 | [diff] [blame] | 393 | |
| 394 | template<random_access_iterator I, sentinel_for<I> S, class Proj = identity, |
| 395 | indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 396 | constexpr I is_heap_until(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 |
Konstantin Varlamov | d406c64 | 2022-07-26 23:11:09 | [diff] [blame] | 397 | |
| 398 | template<random_access_range R, class Proj = identity, |
| 399 | indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> |
| 400 | constexpr borrowed_iterator_t<R> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 401 | is_heap_until(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 |
Konstantin Varlamov | d406c64 | 2022-07-26 23:11:09 | [diff] [blame] | 402 | |
Nikolas Klauser | 1d1a191 | 2022-05-24 08:32:50 | [diff] [blame] | 403 | template<bidirectional_iterator I, sentinel_for<I> S> |
| 404 | requires permutable<I> |
| 405 | constexpr I ranges::reverse(I first, S last); // since C++20 |
| 406 | |
| 407 | template<bidirectional_range R> |
| 408 | requires permutable<iterator_t<R>> |
| 409 | constexpr borrowed_iterator_t<R> ranges::reverse(R&& r); // since C++20 |
| 410 | |
Konstantin Varlamov | ff3989e | 2022-06-16 22:20:53 | [diff] [blame] | 411 | template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less, |
| 412 | class Proj = identity> |
| 413 | requires sortable<I, Comp, Proj> |
| 414 | constexpr I |
Konstantin Varlamov | 94c7b89 | 2022-07-01 23:34:08 | [diff] [blame] | 415 | ranges::sort(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 |
Konstantin Varlamov | ff3989e | 2022-06-16 22:20:53 | [diff] [blame] | 416 | |
| 417 | template<random_access_range R, class Comp = ranges::less, class Proj = identity> |
| 418 | requires sortable<iterator_t<R>, Comp, Proj> |
| 419 | constexpr borrowed_iterator_t<R> |
Konstantin Varlamov | 94c7b89 | 2022-07-01 23:34:08 | [diff] [blame] | 420 | ranges::sort(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 |
| 421 | |
| 422 | template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less, |
| 423 | class Proj = identity> |
| 424 | requires sortable<I, Comp, Proj> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 425 | constexpr I // constexpr since C++26 |
| 426 | ranges::stable_sort(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 |
Konstantin Varlamov | 94c7b89 | 2022-07-01 23:34:08 | [diff] [blame] | 427 | |
| 428 | template<random_access_range R, class Comp = ranges::less, class Proj = identity> |
| 429 | requires sortable<iterator_t<R>, Comp, Proj> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 430 | constexpr borrowed_iterator_t<R> // constexpr since C++26 |
Konstantin Varlamov | 94c7b89 | 2022-07-01 23:34:08 | [diff] [blame] | 431 | ranges::stable_sort(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 |
Konstantin Varlamov | ff3989e | 2022-06-16 22:20:53 | [diff] [blame] | 432 | |
varconst | 5dd19ad | 2022-07-20 03:10:02 | [diff] [blame] | 433 | template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less, |
| 434 | class Proj = identity> |
| 435 | requires sortable<I, Comp, Proj> |
| 436 | constexpr I |
| 437 | ranges::partial_sort(I first, I middle, S last, Comp comp = {}, Proj proj = {}); // since C++20 |
| 438 | |
| 439 | template<random_access_range R, class Comp = ranges::less, class Proj = identity> |
| 440 | requires sortable<iterator_t<R>, Comp, Proj> |
| 441 | constexpr borrowed_iterator_t<R> |
| 442 | ranges::partial_sort(R&& r, iterator_t<R> middle, Comp comp = {}, Proj proj = {}); // since C++20 |
| 443 | |
Nikolas Klauser | 7af89a3 | 2022-05-21 16:26:29 | [diff] [blame] | 444 | template<class T, output_iterator<const T&> O, sentinel_for<O> S> |
| 445 | constexpr O ranges::fill(O first, S last, const T& value); // since C++20 |
| 446 | |
| 447 | template<class T, output_range<const T&> R> |
| 448 | constexpr borrowed_iterator_t<R> ranges::fill(R&& r, const T& value); // since C++20 |
| 449 | |
| 450 | template<class T, output_iterator<const T&> O> |
| 451 | constexpr O ranges::fill_n(O first, iter_difference_t<O> n, const T& value); // since C++20 |
Nikolas Klauser | 569d663 | 2022-05-25 09:09:43 | [diff] [blame] | 452 | |
Konstantin Varlamov | ead7302 | 2022-07-26 22:50:14 | [diff] [blame] | 453 | template<input_or_output_iterator O, sentinel_for<O> S, copy_constructible F> |
| 454 | requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 455 | constexpr O generate(O first, S last, F gen); // since C++20 |
Konstantin Varlamov | ead7302 | 2022-07-26 22:50:14 | [diff] [blame] | 456 | |
Nikolas Klauser | cd91610 | 2023-06-09 20:45:34 | [diff] [blame] | 457 | template<class ExecutionPolicy, class ForwardIterator, class Generator> |
| 458 | void generate(ExecutionPolicy&& exec, |
| 459 | ForwardIterator first, ForwardIterator last, |
| 460 | Generator gen); // since C++17 |
| 461 | |
Konstantin Varlamov | ead7302 | 2022-07-26 22:50:14 | [diff] [blame] | 462 | template<class R, copy_constructible F> |
| 463 | requires invocable<F&> && output_range<R, invoke_result_t<F&>> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 464 | constexpr borrowed_iterator_t<R> generate(R&& r, F gen); // since C++20 |
Konstantin Varlamov | ead7302 | 2022-07-26 22:50:14 | [diff] [blame] | 465 | |
| 466 | template<input_or_output_iterator O, copy_constructible F> |
| 467 | requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 468 | constexpr O generate_n(O first, iter_difference_t<O> n, F gen); // since C++20 |
Konstantin Varlamov | ead7302 | 2022-07-26 22:50:14 | [diff] [blame] | 469 | |
Nikolas Klauser | cd91610 | 2023-06-09 20:45:34 | [diff] [blame] | 470 | template<class ExecutionPolicy, class ForwardIterator, class Size, class Generator> |
| 471 | ForwardIterator generate_n(ExecutionPolicy&& exec, |
| 472 | ForwardIterator first, Size n, Generator gen); // since C++17 |
| 473 | |
Nikolas Klauser | 569d663 | 2022-05-25 09:09:43 | [diff] [blame] | 474 | template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, |
| 475 | class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> |
| 476 | requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2> |
| 477 | constexpr bool ranges::equal(I1 first1, S1 last1, I2 first2, S2 last2, |
| 478 | Pred pred = {}, |
| 479 | Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 |
| 480 | |
| 481 | template<input_range R1, input_range R2, class Pred = ranges::equal_to, |
| 482 | class Proj1 = identity, class Proj2 = identity> |
| 483 | requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2> |
| 484 | constexpr bool ranges::equal(R1&& r1, R2&& r2, Pred pred = {}, |
| 485 | Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 |
| 486 | |
Nikolas Klauser | 0e3dc1a | 2022-05-26 14:42:46 | [diff] [blame] | 487 | template<input_iterator I, sentinel_for<I> S, class Proj = identity, |
| 488 | indirect_unary_predicate<projected<I, Proj>> Pred> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 489 | constexpr bool ranges::all_of(I first, S last, Pred pred, Proj proj = {}); // since C++20 |
Nikolas Klauser | 0e3dc1a | 2022-05-26 14:42:46 | [diff] [blame] | 490 | |
| 491 | template<input_range R, class Proj = identity, |
| 492 | indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 493 | constexpr bool ranges::all_of(R&& r, Pred pred, Proj proj = {}); // since C++20 |
Nikolas Klauser | 0e3dc1a | 2022-05-26 14:42:46 | [diff] [blame] | 494 | |
| 495 | template<input_iterator I, sentinel_for<I> S, class Proj = identity, |
| 496 | indirect_unary_predicate<projected<I, Proj>> Pred> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 497 | constexpr bool ranges::any_of(I first, S last, Pred pred, Proj proj = {}); // since C++20 |
Nikolas Klauser | 0e3dc1a | 2022-05-26 14:42:46 | [diff] [blame] | 498 | |
| 499 | template<input_range R, class Proj = identity, |
| 500 | indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 501 | constexpr bool ranges::any_of(R&& r, Pred pred, Proj proj = {}); // since C++20 |
Nikolas Klauser | 0e3dc1a | 2022-05-26 14:42:46 | [diff] [blame] | 502 | |
Zijun Zhao | 0218ea4 | 2023-09-18 18:28:11 | [diff] [blame] | 503 | template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, |
| 504 | class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> |
| 505 | requires (forward_iterator<I1> || sized_sentinel_for<S1, I1>) && |
| 506 | (forward_iterator<I2> || sized_sentinel_for<S2, I2>) && |
| 507 | indirectly_comparable<I1, I2, Pred, Proj1, Proj2> |
| 508 | constexpr bool ranges::ends_with(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, |
| 509 | Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23 |
| 510 | |
| 511 | template<input_range R1, input_range R2, class Pred = ranges::equal_to, class Proj1 = identity, |
| 512 | class Proj2 = identity> |
| 513 | requires (forward_range<R1> || sized_range<R1>) && |
| 514 | (forward_range<R2> || sized_range<R2>) && |
| 515 | indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2> |
| 516 | constexpr bool ranges::ends_with(R1&& r1, R2&& r2, Pred pred = {}, |
| 517 | Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23 |
| 518 | |
Nikolas Klauser | 0e3dc1a | 2022-05-26 14:42:46 | [diff] [blame] | 519 | template<input_iterator I, sentinel_for<I> S, class Proj = identity, |
| 520 | indirect_unary_predicate<projected<I, Proj>> Pred> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 521 | constexpr bool ranges::none_of(I first, S last, Pred pred, Proj proj = {}); // since C++20 |
Nikolas Klauser | 0e3dc1a | 2022-05-26 14:42:46 | [diff] [blame] | 522 | |
| 523 | template<input_range R, class Proj = identity, |
| 524 | indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 525 | constexpr bool ranges::none_of(R&& r, Pred pred, Proj proj = {}); // since C++20 |
Nikolas Klauser | 0e3dc1a | 2022-05-26 14:42:46 | [diff] [blame] | 526 | |
zijunzhao | 2051755 | 2023-05-08 22:04:00 | [diff] [blame] | 527 | template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, |
| 528 | class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> |
| 529 | requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2> |
| 530 | constexpr bool ranges::starts_with(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, |
| 531 | Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23 |
| 532 | |
| 533 | template<input_range R1, input_range R2, class Pred = ranges::equal_to, class Proj1 = identity, |
| 534 | class Proj2 = identity> |
| 535 | requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2> |
| 536 | constexpr bool ranges::starts_with(R1&& r1, R2&& r2, Pred pred = {}, |
| 537 | Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23 |
| 538 | |
Konstantin Varlamov | db7d795 | 2022-07-30 09:42:05 | [diff] [blame] | 539 | template<input_iterator I1, sentinel_for<I1> S1, |
| 540 | random_access_iterator I2, sentinel_for<I2> S2, |
| 541 | class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity> |
| 542 | requires indirectly_copyable<I1, I2> && sortable<I2, Comp, Proj2> && |
| 543 | indirect_strict_weak_order<Comp, projected<I1, Proj1>, projected<I2, Proj2>> |
| 544 | constexpr partial_sort_copy_result<I1, I2> |
| 545 | partial_sort_copy(I1 first, S1 last, I2 result_first, S2 result_last, |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 546 | Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 |
Konstantin Varlamov | db7d795 | 2022-07-30 09:42:05 | [diff] [blame] | 547 | |
| 548 | template<input_range R1, random_access_range R2, class Comp = ranges::less, |
| 549 | class Proj1 = identity, class Proj2 = identity> |
| 550 | requires indirectly_copyable<iterator_t<R1>, iterator_t<R2>> && |
| 551 | sortable<iterator_t<R2>, Comp, Proj2> && |
| 552 | indirect_strict_weak_order<Comp, projected<iterator_t<R1>, Proj1>, |
| 553 | projected<iterator_t<R2>, Proj2>> |
| 554 | constexpr partial_sort_copy_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>> |
| 555 | partial_sort_copy(R1&& r, R2&& result_r, Comp comp = {}, |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 556 | Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 |
Konstantin Varlamov | db7d795 | 2022-07-30 09:42:05 | [diff] [blame] | 557 | |
Nikolas Klauser | 11e3ad2 | 2022-05-26 14:08:55 | [diff] [blame] | 558 | template<forward_iterator I, sentinel_for<I> S, class Proj = identity, |
| 559 | indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> |
| 560 | constexpr bool ranges::is_sorted(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 |
| 561 | |
| 562 | template<forward_range R, class Proj = identity, |
| 563 | indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> |
| 564 | constexpr bool ranges::is_sorted(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 |
| 565 | |
| 566 | template<forward_iterator I, sentinel_for<I> S, class Proj = identity, |
| 567 | indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> |
| 568 | constexpr I ranges::is_sorted_until(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 |
| 569 | |
| 570 | template<forward_range R, class Proj = identity, |
| 571 | indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> |
| 572 | constexpr borrowed_iterator_t<R> |
| 573 | ranges::is_sorted_until(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 |
Nikolas Klauser | 8171586 | 2022-06-05 19:15:16 | [diff] [blame] | 574 | |
Konstantin Varlamov | 23c7328 | 2022-07-08 03:35:51 | [diff] [blame] | 575 | template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less, |
| 576 | class Proj = identity> |
| 577 | requires sortable<I, Comp, Proj> |
| 578 | constexpr I |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 579 | ranges::nth_element(I first, I nth, S last, Comp comp = {}, Proj proj = {}); // since C++20 |
Konstantin Varlamov | 23c7328 | 2022-07-08 03:35:51 | [diff] [blame] | 580 | |
| 581 | template<random_access_range R, class Comp = ranges::less, class Proj = identity> |
| 582 | requires sortable<iterator_t<R>, Comp, Proj> |
| 583 | constexpr borrowed_iterator_t<R> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 584 | ranges::nth_element(R&& r, iterator_t<R> nth, Comp comp = {}, Proj proj = {}); // since C++20 |
Konstantin Varlamov | 23c7328 | 2022-07-08 03:35:51 | [diff] [blame] | 585 | |
Nikolas Klauser | 8171586 | 2022-06-05 19:15:16 | [diff] [blame] | 586 | template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity, |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 587 | indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less> // since C++20 |
| 588 | constexpr I upper_bound(I first, S last, const T& value, Comp comp = {}, Proj proj = {}); |
Nikolas Klauser | 8171586 | 2022-06-05 19:15:16 | [diff] [blame] | 589 | |
| 590 | template<forward_range R, class T, class Proj = identity, |
| 591 | indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp = |
| 592 | ranges::less> |
| 593 | constexpr borrowed_iterator_t<R> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 594 | upper_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20 |
Nikolas Klauser | 8171586 | 2022-06-05 19:15:16 | [diff] [blame] | 595 | |
| 596 | template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity, |
| 597 | indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less> |
| 598 | constexpr I lower_bound(I first, S last, const T& value, Comp comp = {}, |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 599 | Proj proj = {}); // since C++20 |
Nikolas Klauser | 8171586 | 2022-06-05 19:15:16 | [diff] [blame] | 600 | template<forward_range R, class T, class Proj = identity, |
| 601 | indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp = |
| 602 | ranges::less> |
| 603 | constexpr borrowed_iterator_t<R> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 604 | lower_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20 |
Nikolas Klauser | 8171586 | 2022-06-05 19:15:16 | [diff] [blame] | 605 | |
| 606 | template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity, |
| 607 | indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less> |
| 608 | constexpr bool binary_search(I first, S last, const T& value, Comp comp = {}, |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 609 | Proj proj = {}); // since C++20 |
Nikolas Klauser | b79b2b6 | 2022-06-06 11:57:34 | [diff] [blame] | 610 | |
Nikolas Klauser | 8171586 | 2022-06-05 19:15:16 | [diff] [blame] | 611 | template<forward_range R, class T, class Proj = identity, |
| 612 | indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp = |
| 613 | ranges::less> |
| 614 | constexpr bool binary_search(R&& r, const T& value, Comp comp = {}, |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 615 | Proj proj = {}); // since C++20 |
Konstantin Varlamov | 8ed702b | 2022-07-19 04:05:51 | [diff] [blame] | 616 | |
| 617 | template<permutable I, sentinel_for<I> S, class Proj = identity, |
| 618 | indirect_unary_predicate<projected<I, Proj>> Pred> |
| 619 | constexpr subrange<I> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 620 | partition(I first, S last, Pred pred, Proj proj = {}); // since C++20 |
Konstantin Varlamov | 8ed702b | 2022-07-19 04:05:51 | [diff] [blame] | 621 | |
| 622 | template<forward_range R, class Proj = identity, |
| 623 | indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> |
| 624 | requires permutable<iterator_t<R>> |
| 625 | constexpr borrowed_subrange_t<R> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 626 | partition(R&& r, Pred pred, Proj proj = {}); // since C++20 |
Konstantin Varlamov | 8ed702b | 2022-07-19 04:05:51 | [diff] [blame] | 627 | |
| 628 | template<bidirectional_iterator I, sentinel_for<I> S, class Proj = identity, |
| 629 | indirect_unary_predicate<projected<I, Proj>> Pred> |
| 630 | requires permutable<I> |
A. Jiang | c28c508 | 2025-03-06 01:23:55 | [diff] [blame] | 631 | constexpr subrange<I> // constexpr since C++26 |
| 632 | stable_partition(I first, S last, Pred pred, Proj proj = {}); // since C++20 |
Konstantin Varlamov | 8ed702b | 2022-07-19 04:05:51 | [diff] [blame] | 633 | |
| 634 | template<bidirectional_range R, class Proj = identity, |
| 635 | indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> |
| 636 | requires permutable<iterator_t<R>> |
A. Jiang | c28c508 | 2025-03-06 01:23:55 | [diff] [blame] | 637 | constexpr borrowed_subrange_t<R> // constexpr since C++26 |
| 638 | stable_partition(R&& r, Pred pred, Proj proj = {}); // since C++20 |
Konstantin Varlamov | 8ed702b | 2022-07-19 04:05:51 | [diff] [blame] | 639 | |
Nikolas Klauser | b79b2b6 | 2022-06-06 11:57:34 | [diff] [blame] | 640 | template<input_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2, |
| 641 | class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> |
| 642 | requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2> |
| 643 | constexpr I1 ranges::find_first_of(I1 first1, S1 last1, I2 first2, S2 last2, |
| 644 | Pred pred = {}, |
| 645 | Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 |
| 646 | |
| 647 | template<input_range R1, forward_range R2, |
| 648 | class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> |
| 649 | requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2> |
| 650 | constexpr borrowed_iterator_t<R1> |
| 651 | ranges::find_first_of(R1&& r1, R2&& r2, |
| 652 | Pred pred = {}, |
| 653 | Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 |
Nikolas Klauser | 8171586 | 2022-06-05 19:15:16 | [diff] [blame] | 654 | |
Nikolas Klauser | 916e905 | 2022-06-08 10:14:12 | [diff] [blame] | 655 | template<forward_iterator I, sentinel_for<I> S, class Proj = identity, |
| 656 | indirect_binary_predicate<projected<I, Proj>, |
| 657 | projected<I, Proj>> Pred = ranges::equal_to> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 658 | constexpr I ranges::adjacent_find(I first, S last, Pred pred = {}, Proj proj = {}); // since C++20 |
Nikolas Klauser | 916e905 | 2022-06-08 10:14:12 | [diff] [blame] | 659 | |
| 660 | template<forward_range R, class Proj = identity, |
| 661 | indirect_binary_predicate<projected<iterator_t<R>, Proj>, |
| 662 | projected<iterator_t<R>, Proj>> Pred = ranges::equal_to> |
| 663 | constexpr borrowed_iterator_t<R> ranges::adjacent_find(R&& r, Pred pred = {}, Proj proj = {}); // since C++20 |
| 664 | |
Nikolas Klauser | ff6d5de | 2022-06-07 07:42:10 | [diff] [blame] | 665 | template<input_iterator I, sentinel_for<I> S, class T1, class T2, class Proj = identity> |
| 666 | requires indirectly_writable<I, const T2&> && |
| 667 | indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*> |
| 668 | constexpr I |
| 669 | ranges::replace(I first, S last, const T1& old_value, const T2& new_value, Proj proj = {}); // since C++20 |
| 670 | |
| 671 | template<input_range R, class T1, class T2, class Proj = identity> |
| 672 | requires indirectly_writable<iterator_t<R>, const T2&> && |
| 673 | indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T1*> |
| 674 | constexpr borrowed_iterator_t<R> |
| 675 | ranges::replace(R&& r, const T1& old_value, const T2& new_value, Proj proj = {}); // since C++20 |
| 676 | |
| 677 | template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity, |
| 678 | indirect_unary_predicate<projected<I, Proj>> Pred> |
| 679 | requires indirectly_writable<I, const T&> |
| 680 | constexpr I ranges::replace_if(I first, S last, Pred pred, const T& new_value, Proj proj = {}); // since C++20 |
| 681 | |
| 682 | template<input_range R, class T, class Proj = identity, |
| 683 | indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> |
| 684 | requires indirectly_writable<iterator_t<R>, const T&> |
| 685 | constexpr borrowed_iterator_t<R> |
| 686 | ranges::replace_if(R&& r, Pred pred, const T& new_value, Proj proj = {}); // since C++20 |
| 687 | |
Nikolas Klauser | a203acb | 2022-08-03 23:30:50 | [diff] [blame] | 688 | template<class T, class Proj = identity, |
| 689 | indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less> |
| 690 | constexpr const T& |
| 691 | ranges::clamp(const T& v, const T& lo, const T& hi, Comp comp = {}, Proj proj = {}); // since C++20 |
| 692 | |
Nikolas Klauser | afd5a4f | 2022-06-15 14:24:43 | [diff] [blame] | 693 | template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, |
| 694 | class Proj1 = identity, class Proj2 = identity, |
| 695 | indirect_strict_weak_order<projected<I1, Proj1>, |
| 696 | projected<I2, Proj2>> Comp = ranges::less> |
| 697 | constexpr bool |
| 698 | ranges::lexicographical_compare(I1 first1, S1 last1, I2 first2, S2 last2, |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 699 | Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 |
Nikolas Klauser | afd5a4f | 2022-06-15 14:24:43 | [diff] [blame] | 700 | |
| 701 | template<input_range R1, input_range R2, class Proj1 = identity, |
| 702 | class Proj2 = identity, |
| 703 | indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>, |
| 704 | projected<iterator_t<R2>, Proj2>> Comp = ranges::less> |
| 705 | constexpr bool |
| 706 | ranges::lexicographical_compare(R1&& r1, R2&& r2, Comp comp = {}, |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 707 | Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 |
Nikolas Klauser | afd5a4f | 2022-06-15 14:24:43 | [diff] [blame] | 708 | |
Louis Dionne | 09e3a36 | 2024-09-16 19:06:20 | [diff] [blame] | 709 | template<class I, class O> |
| 710 | using move_result = in_out_result<I, O>; // since C++20 |
| 711 | |
| 712 | template<class I, class O> |
| 713 | using move_backward_result = in_out_result<I, O>; // since C++20 |
| 714 | |
Nikolas Klauser | 2c3bbac | 2022-06-23 10:23:41 | [diff] [blame] | 715 | template<bidirectional_iterator I1, sentinel_for<I1> S1, bidirectional_iterator I2> |
| 716 | requires indirectly_movable<I1, I2> |
| 717 | constexpr ranges::move_backward_result<I1, I2> |
| 718 | ranges::move_backward(I1 first, S1 last, I2 result); // since C++20 |
| 719 | |
| 720 | template<bidirectional_range R, bidirectional_iterator I> |
| 721 | requires indirectly_movable<iterator_t<R>, I> |
| 722 | constexpr ranges::move_backward_result<borrowed_iterator_t<R>, I> |
| 723 | ranges::move_backward(R&& r, I result); // since C++20 |
| 724 | |
| 725 | template<input_iterator I, sentinel_for<I> S, weakly_incrementable O> |
| 726 | requires indirectly_movable<I, O> |
| 727 | constexpr ranges::move_result<I, O> |
| 728 | ranges::move(I first, S last, O result); // since C++20 |
| 729 | |
| 730 | template<input_range R, weakly_incrementable O> |
| 731 | requires indirectly_movable<iterator_t<R>, O> |
| 732 | constexpr ranges::move_result<borrowed_iterator_t<R>, O> |
| 733 | ranges::move(R&& r, O result); // since C++20 |
| 734 | |
Konstantin Varlamov | 065202f | 2022-07-20 08:57:13 | [diff] [blame] | 735 | template<class I, class O1, class O2> |
| 736 | using partition_copy_result = in_out_out_result<I, O1, O2>; // since C++20 |
| 737 | |
| 738 | template<input_iterator I, sentinel_for<I> S, |
| 739 | weakly_incrementable O1, weakly_incrementable O2, |
| 740 | class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred> |
| 741 | requires indirectly_copyable<I, O1> && indirectly_copyable<I, O2> |
| 742 | constexpr partition_copy_result<I, O1, O2> |
| 743 | partition_copy(I first, S last, O1 out_true, O2 out_false, Pred pred, |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 744 | Proj proj = {}); // since C++20 |
Konstantin Varlamov | 065202f | 2022-07-20 08:57:13 | [diff] [blame] | 745 | |
| 746 | template<input_range R, weakly_incrementable O1, weakly_incrementable O2, |
| 747 | class Proj = identity, |
| 748 | indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> |
| 749 | requires indirectly_copyable<iterator_t<R>, O1> && |
| 750 | indirectly_copyable<iterator_t<R>, O2> |
| 751 | constexpr partition_copy_result<borrowed_iterator_t<R>, O1, O2> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 752 | partition_copy(R&& r, O1 out_true, O2 out_false, Pred pred, Proj proj = {}); // since C++20 |
Konstantin Varlamov | 065202f | 2022-07-20 08:57:13 | [diff] [blame] | 753 | |
| 754 | template<forward_iterator I, sentinel_for<I> S, class Proj = identity, |
| 755 | indirect_unary_predicate<projected<I, Proj>> Pred> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 756 | constexpr I partition_point(I first, S last, Pred pred, Proj proj = {}); // since C++20 |
Konstantin Varlamov | 065202f | 2022-07-20 08:57:13 | [diff] [blame] | 757 | |
| 758 | template<forward_range R, class Proj = identity, |
| 759 | indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> |
| 760 | constexpr borrowed_iterator_t<R> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 761 | partition_point(R&& r, Pred pred, Proj proj = {}); // since C++20 |
Konstantin Varlamov | 065202f | 2022-07-20 08:57:13 | [diff] [blame] | 762 | |
Hui Xie | 25607d1 | 2022-06-26 15:13:43 | [diff] [blame] | 763 | template<class I1, class I2, class O> |
| 764 | using merge_result = in_in_out_result<I1, I2, O>; // since C++20 |
| 765 | |
| 766 | template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, |
| 767 | weakly_incrementable O, class Comp = ranges::less, class Proj1 = identity, |
| 768 | class Proj2 = identity> |
| 769 | requires mergeable<I1, I2, O, Comp, Proj1, Proj2> |
| 770 | constexpr merge_result<I1, I2, O> |
| 771 | merge(I1 first1, S1 last1, I2 first2, S2 last2, O result, |
| 772 | Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 |
| 773 | |
| 774 | template<input_range R1, input_range R2, weakly_incrementable O, class Comp = ranges::less, |
| 775 | class Proj1 = identity, class Proj2 = identity> |
| 776 | requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2> |
| 777 | constexpr merge_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O> |
| 778 | merge(R1&& r1, R2&& r2, O result, |
| 779 | Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 |
Nikolas Klauser | 2c3bbac | 2022-06-23 10:23:41 | [diff] [blame] | 780 | |
Nikolas Klauser | f8cbe3cdf | 2022-07-06 12:03:00 | [diff] [blame] | 781 | template<permutable I, sentinel_for<I> S, class T, class Proj = identity> |
| 782 | requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*> |
| 783 | constexpr subrange<I> ranges::remove(I first, S last, const T& value, Proj proj = {}); // since C++20 |
| 784 | |
| 785 | template<forward_range R, class T, class Proj = identity> |
| 786 | requires permutable<iterator_t<R>> && |
| 787 | indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*> |
| 788 | constexpr borrowed_subrange_t<R> |
| 789 | ranges::remove(R&& r, const T& value, Proj proj = {}); // since C++20 |
| 790 | |
| 791 | template<permutable I, sentinel_for<I> S, class Proj = identity, |
| 792 | indirect_unary_predicate<projected<I, Proj>> Pred> |
| 793 | constexpr subrange<I> ranges::remove_if(I first, S last, Pred pred, Proj proj = {}); // since C++20 |
| 794 | |
| 795 | template<forward_range R, class Proj = identity, |
| 796 | indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> |
| 797 | requires permutable<iterator_t<R>> |
| 798 | constexpr borrowed_subrange_t<R> |
| 799 | ranges::remove_if(R&& r, Pred pred, Proj proj = {}); // since C++20 |
Nikolas Klauser | 7d426a3 | 2022-07-11 15:07:35 | [diff] [blame] | 800 | |
Hui Xie | 1cdec6c | 2022-06-26 15:13:43 | [diff] [blame] | 801 | template<class I, class O> |
Nikolas Klauser | 7d426a3 | 2022-07-11 15:07:35 | [diff] [blame] | 802 | using set_difference_result = in_out_result<I, O>; // since C++20 |
Hui Xie | 1cdec6c | 2022-06-26 15:13:43 | [diff] [blame] | 803 | |
| 804 | template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, |
| 805 | weakly_incrementable O, class Comp = ranges::less, |
| 806 | class Proj1 = identity, class Proj2 = identity> |
| 807 | requires mergeable<I1, I2, O, Comp, Proj1, Proj2> |
| 808 | constexpr set_difference_result<I1, O> |
| 809 | set_difference(I1 first1, S1 last1, I2 first2, S2 last2, O result, |
| 810 | Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 |
| 811 | |
| 812 | template<input_range R1, input_range R2, weakly_incrementable O, |
| 813 | class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity> |
| 814 | requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2> |
| 815 | constexpr set_difference_result<borrowed_iterator_t<R1>, O> |
| 816 | set_difference(R1&& r1, R2&& r2, O result, |
| 817 | Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 |
Nikolas Klauser | f8cbe3cdf | 2022-07-06 12:03:00 | [diff] [blame] | 818 | |
Hui Xie | 96b674f | 2022-07-08 14:21:40 | [diff] [blame] | 819 | template<class I1, class I2, class O> |
| 820 | using set_intersection_result = in_in_out_result<I1, I2, O>; // since C++20 |
| 821 | |
| 822 | template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, |
| 823 | weakly_incrementable O, class Comp = ranges::less, |
| 824 | class Proj1 = identity, class Proj2 = identity> |
| 825 | requires mergeable<I1, I2, O, Comp, Proj1, Proj2> |
| 826 | constexpr set_intersection_result<I1, I2, O> |
| 827 | set_intersection(I1 first1, S1 last1, I2 first2, S2 last2, O result, |
| 828 | Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 |
| 829 | |
| 830 | template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, |
| 831 | weakly_incrementable O, class Comp = ranges::less, |
| 832 | class Proj1 = identity, class Proj2 = identity> |
| 833 | requires mergeable<I1, I2, O, Comp, Proj1, Proj2> |
| 834 | constexpr set_intersection_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O> |
| 835 | set_intersection(R1&& r1, R2&& r2, O result, |
| 836 | Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 |
| 837 | |
Nikolas Klauser | 7d426a3 | 2022-07-11 15:07:35 | [diff] [blame] | 838 | template <class _InIter, class _OutIter> |
| 839 | using reverse_copy_result = in_out_result<_InIter, _OutIter>; // since C++20 |
| 840 | |
| 841 | template<bidirectional_iterator I, sentinel_for<I> S, weakly_incrementable O> |
| 842 | requires indirectly_copyable<I, O> |
| 843 | constexpr ranges::reverse_copy_result<I, O> |
| 844 | ranges::reverse_copy(I first, S last, O result); // since C++20 |
| 845 | |
| 846 | template<bidirectional_range R, weakly_incrementable O> |
| 847 | requires indirectly_copyable<iterator_t<R>, O> |
| 848 | constexpr ranges::reverse_copy_result<borrowed_iterator_t<R>, O> |
| 849 | ranges::reverse_copy(R&& r, O result); // since C++20 |
| 850 | |
Konstantin Varlamov | 36c746c | 2022-08-03 23:04:14 | [diff] [blame] | 851 | template<permutable I, sentinel_for<I> S> |
| 852 | constexpr subrange<I> rotate(I first, I middle, S last); // since C++20 |
| 853 | |
| 854 | template<forward_range R> |
| 855 | requires permutable<iterator_t<R>> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 856 | constexpr borrowed_subrange_t<R> rotate(R&& r, iterator_t<R> middle); // since C++20 |
Konstantin Varlamov | 36c746c | 2022-08-03 23:04:14 | [diff] [blame] | 857 | |
Nikolas Klauser | 7d426a3 | 2022-07-11 15:07:35 | [diff] [blame] | 858 | template <class _InIter, class _OutIter> |
| 859 | using rotate_copy_result = in_out_result<_InIter, _OutIter>; // since C++20 |
| 860 | |
| 861 | template<forward_iterator I, sentinel_for<I> S, weakly_incrementable O> |
| 862 | requires indirectly_copyable<I, O> |
| 863 | constexpr ranges::rotate_copy_result<I, O> |
| 864 | ranges::rotate_copy(I first, I middle, S last, O result); // since C++20 |
| 865 | |
| 866 | template<forward_range R, weakly_incrementable O> |
| 867 | requires indirectly_copyable<iterator_t<R>, O> |
| 868 | constexpr ranges::rotate_copy_result<borrowed_iterator_t<R>, O> |
| 869 | ranges::rotate_copy(R&& r, iterator_t<R> middle, O result); // since C++20 |
| 870 | |
Konstantin Varlamov | 6bdb642 | 2022-08-03 05:33:12 | [diff] [blame] | 871 | template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Gen> |
| 872 | requires (forward_iterator<I> || random_access_iterator<O>) && |
| 873 | indirectly_copyable<I, O> && |
| 874 | uniform_random_bit_generator<remove_reference_t<Gen>> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 875 | O sample(I first, S last, O out, iter_difference_t<I> n, Gen&& g); // since C++20 |
Konstantin Varlamov | 6bdb642 | 2022-08-03 05:33:12 | [diff] [blame] | 876 | |
| 877 | template<input_range R, weakly_incrementable O, class Gen> |
| 878 | requires (forward_range<R> || random_access_iterator<O>) && |
| 879 | indirectly_copyable<iterator_t<R>, O> && |
| 880 | uniform_random_bit_generator<remove_reference_t<Gen>> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 881 | O sample(R&& r, O out, range_difference_t<R> n, Gen&& g); // since C++20 |
Konstantin Varlamov | 6bdb642 | 2022-08-03 05:33:12 | [diff] [blame] | 882 | |
Konstantin Varlamov | 14cf74d | 2022-07-22 16:58:56 | [diff] [blame] | 883 | template<random_access_iterator I, sentinel_for<I> S, class Gen> |
| 884 | requires permutable<I> && |
| 885 | uniform_random_bit_generator<remove_reference_t<Gen>> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 886 | I shuffle(I first, S last, Gen&& g); // since C++20 |
Konstantin Varlamov | 14cf74d | 2022-07-22 16:58:56 | [diff] [blame] | 887 | |
| 888 | template<random_access_range R, class Gen> |
| 889 | requires permutable<iterator_t<R>> && |
| 890 | uniform_random_bit_generator<remove_reference_t<Gen>> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 891 | borrowed_iterator_t<R> shuffle(R&& r, Gen&& g); // since C++20 |
Konstantin Varlamov | 14cf74d | 2022-07-22 16:58:56 | [diff] [blame] | 892 | |
Nikolas Klauser | 101d1e9 | 2022-07-13 16:07:26 | [diff] [blame] | 893 | template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2, |
Nikolas Klauser | 4038c85 | 2022-08-04 17:54:13 | [diff] [blame] | 894 | sentinel_for<I2> S2, class Proj1 = identity, class Proj2 = identity, |
| 895 | indirect_equivalence_relation<projected<I1, Proj1>, |
| 896 | projected<I2, Proj2>> Pred = ranges::equal_to> |
| 897 | constexpr bool ranges::is_permutation(I1 first1, S1 last1, I2 first2, S2 last2, |
| 898 | Pred pred = {}, |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 899 | Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 |
Nikolas Klauser | 4038c85 | 2022-08-04 17:54:13 | [diff] [blame] | 900 | |
| 901 | template<forward_range R1, forward_range R2, |
| 902 | class Proj1 = identity, class Proj2 = identity, |
| 903 | indirect_equivalence_relation<projected<iterator_t<R1>, Proj1>, |
| 904 | projected<iterator_t<R2>, Proj2>> Pred = ranges::equal_to> |
| 905 | constexpr bool ranges::is_permutation(R1&& r1, R2&& r2, Pred pred = {}, |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 906 | Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 |
Nikolas Klauser | 4038c85 | 2022-08-04 17:54:13 | [diff] [blame] | 907 | |
| 908 | template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2, |
Nikolas Klauser | 101d1e9 | 2022-07-13 16:07:26 | [diff] [blame] | 909 | sentinel_for<I2> S2, class Pred = ranges::equal_to, |
| 910 | class Proj1 = identity, class Proj2 = identity> |
| 911 | requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2> |
| 912 | constexpr subrange<I1> |
| 913 | ranges::search(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, |
| 914 | Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 |
| 915 | |
| 916 | template<forward_range R1, forward_range R2, class Pred = ranges::equal_to, |
| 917 | class Proj1 = identity, class Proj2 = identity> |
| 918 | requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2> |
| 919 | constexpr borrowed_subrange_t<R1> |
| 920 | ranges::search(R1&& r1, R2&& r2, Pred pred = {}, |
| 921 | Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 |
| 922 | |
| 923 | template<forward_iterator I, sentinel_for<I> S, class T, |
| 924 | class Pred = ranges::equal_to, class Proj = identity> |
| 925 | requires indirectly_comparable<I, const T*, Pred, Proj> |
| 926 | constexpr subrange<I> |
| 927 | ranges::search_n(I first, S last, iter_difference_t<I> count, |
| 928 | const T& value, Pred pred = {}, Proj proj = {}); // since C++20 |
| 929 | |
| 930 | template<forward_range R, class T, class Pred = ranges::equal_to, |
| 931 | class Proj = identity> |
| 932 | requires indirectly_comparable<iterator_t<R>, const T*, Pred, Proj> |
| 933 | constexpr borrowed_subrange_t<R> |
| 934 | ranges::search_n(R&& r, range_difference_t<R> count, |
| 935 | const T& value, Pred pred = {}, Proj proj = {}); // since C++20 |
| 936 | |
Christopher Di Bella | 3903438 | 2023-12-20 05:57:50 | [diff] [blame] | 937 | template<input_iterator I, sentinel_for<I> S, class T, |
| 938 | indirectly-binary-left-foldable<T, I> F> |
| 939 | constexpr auto ranges::fold_left(I first, S last, T init, F f); // since C++23 |
| 940 | |
| 941 | template<input_range R, class T, indirectly-binary-left-foldable<T, iterator_t<R>> F> |
| 942 | constexpr auto fold_left(R&& r, T init, F f); // since C++23 |
| 943 | |
| 944 | template<class I, class T> |
| 945 | using fold_left_with_iter_result = in_value_result<I, T>; // since C++23 |
| 946 | |
| 947 | template<input_iterator I, sentinel_for<I> S, class T, |
| 948 | indirectly-binary-left-foldable<T, I> F> |
| 949 | constexpr see below fold_left_with_iter(I first, S last, T init, F f); // since C++23 |
| 950 | |
| 951 | template<input_range R, class T, indirectly-binary-left-foldable<T, iterator_t<R>> F> |
| 952 | constexpr see below fold_left_with_iter(R&& r, T init, F f); // since C++23 |
| 953 | |
Nikolas Klauser | 101d1e9 | 2022-07-13 16:07:26 | [diff] [blame] | 954 | template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2, |
| 955 | class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> |
| 956 | requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2> |
| 957 | constexpr subrange<I1> |
| 958 | ranges::find_end(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, |
| 959 | Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 |
| 960 | |
| 961 | template<forward_range R1, forward_range R2, |
| 962 | class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> |
| 963 | requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2> |
| 964 | constexpr borrowed_subrange_t<R1> |
| 965 | ranges::find_end(R1&& r1, R2&& r2, Pred pred = {}, |
| 966 | Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 |
| 967 | |
Hui Xie | a5c0638 | 2022-07-11 22:39:59 | [diff] [blame] | 968 | template<class I1, class I2, class O> |
| 969 | using set_symmetric_difference_result = in_in_out_result<I1, I2, O>; // since C++20 |
| 970 | |
| 971 | template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, |
| 972 | weakly_incrementable O, class Comp = ranges::less, |
| 973 | class Proj1 = identity, class Proj2 = identity> |
| 974 | requires mergeable<I1, I2, O, Comp, Proj1, Proj2> |
| 975 | constexpr set_symmetric_difference_result<I1, I2, O> |
| 976 | set_symmetric_difference(I1 first1, S1 last1, I2 first2, S2 last2, O result, |
| 977 | Comp comp = {}, Proj1 proj1 = {}, |
| 978 | Proj2 proj2 = {}); // since C++20 |
Hui Xie | 8a61749 | 2022-07-27 12:20:16 | [diff] [blame] | 979 | |
Hui Xie | a5c0638 | 2022-07-11 22:39:59 | [diff] [blame] | 980 | template<input_range R1, input_range R2, weakly_incrementable O, |
| 981 | class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity> |
| 982 | requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2> |
| 983 | constexpr set_symmetric_difference_result<borrowed_iterator_t<R1>, |
| 984 | borrowed_iterator_t<R2>, O> |
| 985 | set_symmetric_difference(R1&& r1, R2&& r2, O result, Comp comp = {}, |
| 986 | Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 |
Hui Xie | 0f6364b8 | 2022-07-14 19:35:15 | [diff] [blame] | 987 | |
| 988 | template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity, |
| 989 | indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less> |
| 990 | constexpr subrange<I> |
| 991 | equal_range(I first, S last, const T& value, Comp comp = {}, Proj proj = {}); // since C++20 |
Hui Xie | 8a61749 | 2022-07-27 12:20:16 | [diff] [blame] | 992 | |
Hui Xie | 0f6364b8 | 2022-07-14 19:35:15 | [diff] [blame] | 993 | template<forward_range R, class T, class Proj = identity, |
| 994 | indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp = |
| 995 | ranges::less> |
| 996 | constexpr borrowed_subrange_t<R> |
| 997 | equal_range(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20 |
Hui Xie | 8a61749 | 2022-07-27 12:20:16 | [diff] [blame] | 998 | |
Hui Xie | 3151b95 | 2022-07-13 16:20:22 | [diff] [blame] | 999 | template<class I1, class I2, class O> |
| 1000 | using set_union_result = in_in_out_result<I1, I2, O>; // since C++20 |
| 1001 | |
| 1002 | template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, |
| 1003 | weakly_incrementable O, class Comp = ranges::less, |
| 1004 | class Proj1 = identity, class Proj2 = identity> |
| 1005 | requires mergeable<I1, I2, O, Comp, Proj1, Proj2> |
| 1006 | constexpr set_union_result<I1, I2, O> |
| 1007 | set_union(I1 first1, S1 last1, I2 first2, S2 last2, O result, Comp comp = {}, |
| 1008 | Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 |
| 1009 | |
| 1010 | template<input_range R1, input_range R2, weakly_incrementable O, |
| 1011 | class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity> |
| 1012 | requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2> |
| 1013 | constexpr set_union_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O> |
| 1014 | set_union(R1&& r1, R2&& r2, O result, Comp comp = {}, |
| 1015 | Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 |
Hui Xie | c559964 | 2022-07-19 19:54:35 | [diff] [blame] | 1016 | |
| 1017 | template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, |
| 1018 | class Proj1 = identity, class Proj2 = identity, |
| 1019 | indirect_strict_weak_order<projected<I1, Proj1>, projected<I2, Proj2>> Comp = |
| 1020 | ranges::less> |
| 1021 | constexpr bool includes(I1 first1, S1 last1, I2 first2, S2 last2, Comp comp = {}, |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 1022 | Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 |
Hui Xie | 8a61749 | 2022-07-27 12:20:16 | [diff] [blame] | 1023 | |
Hui Xie | c559964 | 2022-07-19 19:54:35 | [diff] [blame] | 1024 | template<input_range R1, input_range R2, class Proj1 = identity, |
| 1025 | class Proj2 = identity, |
| 1026 | indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>, |
| 1027 | projected<iterator_t<R2>, Proj2>> Comp = ranges::less> |
| 1028 | constexpr bool includes(R1&& r1, R2&& r2, Comp comp = {}, |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 1029 | Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 |
Hui Xie | 8a61749 | 2022-07-27 12:20:16 | [diff] [blame] | 1030 | |
| 1031 | template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less, |
| 1032 | class Proj = identity> |
| 1033 | requires sortable<I, Comp, Proj> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 1034 | I inplace_merge(I first, I middle, S last, Comp comp = {}, Proj proj = {}); // since C++20 |
Hui Xie | 8a61749 | 2022-07-27 12:20:16 | [diff] [blame] | 1035 | |
| 1036 | template<bidirectional_range R, class Comp = ranges::less, class Proj = identity> |
| 1037 | requires sortable<iterator_t<R>, Comp, Proj> |
| 1038 | borrowed_iterator_t<R> |
| 1039 | inplace_merge(R&& r, iterator_t<R> middle, Comp comp = {}, |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 1040 | Proj proj = {}); // since C++20 |
Hui Xie | 72f57e3 | 2022-07-23 00:44:25 | [diff] [blame] | 1041 | |
| 1042 | template<permutable I, sentinel_for<I> S, class Proj = identity, |
| 1043 | indirect_equivalence_relation<projected<I, Proj>> C = ranges::equal_to> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 1044 | constexpr subrange<I> unique(I first, S last, C comp = {}, Proj proj = {}); // since C++20 |
Hui Xie | 72f57e3 | 2022-07-23 00:44:25 | [diff] [blame] | 1045 | |
| 1046 | template<forward_range R, class Proj = identity, |
| 1047 | indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to> |
| 1048 | requires permutable<iterator_t<R>> |
| 1049 | constexpr borrowed_subrange_t<R> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 1050 | unique(R&& r, C comp = {}, Proj proj = {}); // since C++20 |
Hui Xie | 72f57e3 | 2022-07-23 00:44:25 | [diff] [blame] | 1051 | |
| 1052 | template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Proj = identity, |
| 1053 | indirect_equivalence_relation<projected<I, Proj>> C = ranges::equal_to> |
| 1054 | requires indirectly_copyable<I, O> && |
| 1055 | (forward_iterator<I> || |
| 1056 | (input_iterator<O> && same_as<iter_value_t<I>, iter_value_t<O>>) || |
| 1057 | indirectly_copyable_storable<I, O>) |
| 1058 | constexpr unique_copy_result<I, O> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 1059 | unique_copy(I first, S last, O result, C comp = {}, Proj proj = {}); // since C++20 |
Hui Xie | 72f57e3 | 2022-07-23 00:44:25 | [diff] [blame] | 1060 | |
| 1061 | template<input_range R, weakly_incrementable O, class Proj = identity, |
| 1062 | indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to> |
| 1063 | requires indirectly_copyable<iterator_t<R>, O> && |
| 1064 | (forward_iterator<iterator_t<R>> || |
| 1065 | (input_iterator<O> && same_as<range_value_t<R>, iter_value_t<O>>) || |
| 1066 | indirectly_copyable_storable<iterator_t<R>, O>) |
| 1067 | constexpr unique_copy_result<borrowed_iterator_t<R>, O> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 1068 | unique_copy(R&& r, O result, C comp = {}, Proj proj = {}); // since C++20 |
Nikolas Klauser | 760d2b4 | 2022-08-03 05:13:59 | [diff] [blame] | 1069 | |
| 1070 | template<class I, class O> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 1071 | using remove_copy_result = in_out_result<I, O>; // since C++20 |
Nikolas Klauser | 760d2b4 | 2022-08-03 05:13:59 | [diff] [blame] | 1072 | |
| 1073 | template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class T, |
| 1074 | class Proj = identity> |
| 1075 | indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*> |
| 1076 | constexpr remove_copy_result<I, O> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 1077 | remove_copy(I first, S last, O result, const T& value, Proj proj = {}); // since C++20 |
Nikolas Klauser | 760d2b4 | 2022-08-03 05:13:59 | [diff] [blame] | 1078 | |
| 1079 | template<input_range R, weakly_incrementable O, class T, class Proj = identity> |
| 1080 | requires indirectly_copyable<iterator_t<R>, O> && |
| 1081 | indirect_binary_predicate<ranges::equal_to, |
| 1082 | projected<iterator_t<R>, Proj>, const T*> |
| 1083 | constexpr remove_copy_result<borrowed_iterator_t<R>, O> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 1084 | remove_copy(R&& r, O result, const T& value, Proj proj = {}); // since C++20 |
Nikolas Klauser | 760d2b4 | 2022-08-03 05:13:59 | [diff] [blame] | 1085 | |
| 1086 | template<class I, class O> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 1087 | using remove_copy_if_result = in_out_result<I, O>; // since C++20 |
Nikolas Klauser | 760d2b4 | 2022-08-03 05:13:59 | [diff] [blame] | 1088 | |
| 1089 | template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, |
| 1090 | class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred> |
| 1091 | requires indirectly_copyable<I, O> |
| 1092 | constexpr remove_copy_if_result<I, O> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 1093 | remove_copy_if(I first, S last, O result, Pred pred, Proj proj = {}); // since C++20 |
Nikolas Klauser | 760d2b4 | 2022-08-03 05:13:59 | [diff] [blame] | 1094 | |
| 1095 | template<input_range R, weakly_incrementable O, class Proj = identity, |
| 1096 | indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> |
| 1097 | requires indirectly_copyable<iterator_t<R>, O> |
| 1098 | constexpr remove_copy_if_result<borrowed_iterator_t<R>, O> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 1099 | remove_copy_if(R&& r, O result, Pred pred, Proj proj = {}); // since C++20 |
Nikolas Klauser | 760d2b4 | 2022-08-03 05:13:59 | [diff] [blame] | 1100 | |
Nikolas Klauser | 93172c1 | 2022-08-03 05:25:00 | [diff] [blame] | 1101 | template<class I, class O> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 1102 | using replace_copy_result = in_out_result<I, O>; // since C++20 |
Nikolas Klauser | 93172c1 | 2022-08-03 05:25:00 | [diff] [blame] | 1103 | |
| 1104 | template<input_iterator I, sentinel_for<I> S, class T1, class T2, |
| 1105 | output_iterator<const T2&> O, class Proj = identity> |
| 1106 | requires indirectly_copyable<I, O> && |
| 1107 | indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*> |
| 1108 | constexpr replace_copy_result<I, O> |
| 1109 | replace_copy(I first, S last, O result, const T1& old_value, const T2& new_value, |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 1110 | Proj proj = {}); // since C++20 |
Nikolas Klauser | 93172c1 | 2022-08-03 05:25:00 | [diff] [blame] | 1111 | |
| 1112 | template<input_range R, class T1, class T2, output_iterator<const T2&> O, |
| 1113 | class Proj = identity> |
| 1114 | requires indirectly_copyable<iterator_t<R>, O> && |
| 1115 | indirect_binary_predicate<ranges::equal_to, |
| 1116 | projected<iterator_t<R>, Proj>, const T1*> |
| 1117 | constexpr replace_copy_result<borrowed_iterator_t<R>, O> |
| 1118 | replace_copy(R&& r, O result, const T1& old_value, const T2& new_value, |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 1119 | Proj proj = {}); // since C++20 |
Nikolas Klauser | 93172c1 | 2022-08-03 05:25:00 | [diff] [blame] | 1120 | |
| 1121 | template<class I, class O> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 1122 | using replace_copy_if_result = in_out_result<I, O>; // since C++20 |
Nikolas Klauser | 93172c1 | 2022-08-03 05:25:00 | [diff] [blame] | 1123 | |
| 1124 | template<input_iterator I, sentinel_for<I> S, class T, output_iterator<const T&> O, |
| 1125 | class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred> |
| 1126 | requires indirectly_copyable<I, O> |
| 1127 | constexpr replace_copy_if_result<I, O> |
| 1128 | replace_copy_if(I first, S last, O result, Pred pred, const T& new_value, |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 1129 | Proj proj = {}); // since C++20 |
Nikolas Klauser | 93172c1 | 2022-08-03 05:25:00 | [diff] [blame] | 1130 | |
| 1131 | template<input_range R, class T, output_iterator<const T&> O, class Proj = identity, |
| 1132 | indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> |
| 1133 | requires indirectly_copyable<iterator_t<R>, O> |
| 1134 | constexpr replace_copy_if_result<borrowed_iterator_t<R>, O> |
| 1135 | replace_copy_if(R&& r, O result, Pred pred, const T& new_value, |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 1136 | Proj proj = {}); // since C++20 |
Nikolas Klauser | 93172c1 | 2022-08-03 05:25:00 | [diff] [blame] | 1137 | |
Nikolas Klauser | 68264b6 | 2022-08-03 05:40:13 | [diff] [blame] | 1138 | template<class I> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 1139 | using prev_permutation_result = in_found_result<I>; // since C++20 |
Nikolas Klauser | 68264b6 | 2022-08-03 05:40:13 | [diff] [blame] | 1140 | |
| 1141 | template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less, |
| 1142 | class Proj = identity> |
| 1143 | requires sortable<I, Comp, Proj> |
| 1144 | constexpr ranges::prev_permutation_result<I> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 1145 | ranges::prev_permutation(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 |
Nikolas Klauser | 68264b6 | 2022-08-03 05:40:13 | [diff] [blame] | 1146 | |
| 1147 | template<bidirectional_range R, class Comp = ranges::less, |
| 1148 | class Proj = identity> |
| 1149 | requires sortable<iterator_t<R>, Comp, Proj> |
| 1150 | constexpr ranges::prev_permutation_result<borrowed_iterator_t<R>> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 1151 | ranges::prev_permutation(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 |
Nikolas Klauser | 68264b6 | 2022-08-03 05:40:13 | [diff] [blame] | 1152 | |
| 1153 | template<class I> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 1154 | using next_permutation_result = in_found_result<I>; // since C++20 |
Nikolas Klauser | 68264b6 | 2022-08-03 05:40:13 | [diff] [blame] | 1155 | |
| 1156 | template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less, |
| 1157 | class Proj = identity> |
| 1158 | requires sortable<I, Comp, Proj> |
| 1159 | constexpr ranges::next_permutation_result<I> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 1160 | ranges::next_permutation(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 |
Nikolas Klauser | 68264b6 | 2022-08-03 05:40:13 | [diff] [blame] | 1161 | |
| 1162 | template<bidirectional_range R, class Comp = ranges::less, |
| 1163 | class Proj = identity> |
| 1164 | requires sortable<iterator_t<R>, Comp, Proj> |
| 1165 | constexpr ranges::next_permutation_result<borrowed_iterator_t<R>> |
Mark de Wever | de6827b | 2023-02-24 20:35:41 | [diff] [blame] | 1166 | ranges::next_permutation(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 |
Nikolas Klauser | 68264b6 | 2022-08-03 05:40:13 | [diff] [blame] | 1167 | |
Nikolas Klauser | d3729bb | 2022-01-14 01:55:51 | [diff] [blame] | 1168 | } |
| 1169 | |
Nikolas Klauser | 68264b6 | 2022-08-03 05:40:13 | [diff] [blame] | 1170 | template <class InputIterator, class Predicate> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1171 | constexpr bool // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1172 | all_of(InputIterator first, InputIterator last, Predicate pred); |
| 1173 | |
| 1174 | template <class InputIterator, class Predicate> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1175 | constexpr bool // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1176 | any_of(InputIterator first, InputIterator last, Predicate pred); |
| 1177 | |
| 1178 | template <class InputIterator, class Predicate> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1179 | constexpr bool // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1180 | none_of(InputIterator first, InputIterator last, Predicate pred); |
| 1181 | |
| 1182 | template <class InputIterator, class Function> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1183 | constexpr Function // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1184 | for_each(InputIterator first, InputIterator last, Function f); |
| 1185 | |
Marshall Clow | d5c65ff | 2017-05-25 02:29:54 | [diff] [blame] | 1186 | template<class InputIterator, class Size, class Function> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1187 | constexpr InputIterator // constexpr since C++20 |
Marshall Clow | 1b9a4ff | 2018-01-22 20:44:33 | [diff] [blame] | 1188 | for_each_n(InputIterator first, Size n, Function f); // C++17 |
Marshall Clow | d5c65ff | 2017-05-25 02:29:54 | [diff] [blame] | 1189 | |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1190 | template <class InputIterator, class T> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1191 | constexpr InputIterator // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1192 | find(InputIterator first, InputIterator last, const T& value); |
| 1193 | |
| 1194 | template <class InputIterator, class Predicate> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1195 | constexpr InputIterator // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1196 | find_if(InputIterator first, InputIterator last, Predicate pred); |
| 1197 | |
| 1198 | template<class InputIterator, class Predicate> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1199 | constexpr InputIterator // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1200 | find_if_not(InputIterator first, InputIterator last, Predicate pred); |
| 1201 | |
| 1202 | template <class ForwardIterator1, class ForwardIterator2> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1203 | constexpr ForwardIterator1 // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1204 | find_end(ForwardIterator1 first1, ForwardIterator1 last1, |
| 1205 | ForwardIterator2 first2, ForwardIterator2 last2); |
| 1206 | |
| 1207 | template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1208 | constexpr ForwardIterator1 // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1209 | find_end(ForwardIterator1 first1, ForwardIterator1 last1, |
| 1210 | ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred); |
| 1211 | |
| 1212 | template <class ForwardIterator1, class ForwardIterator2> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1213 | constexpr ForwardIterator1 // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1214 | find_first_of(ForwardIterator1 first1, ForwardIterator1 last1, |
| 1215 | ForwardIterator2 first2, ForwardIterator2 last2); |
| 1216 | |
| 1217 | template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1218 | constexpr ForwardIterator1 // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1219 | find_first_of(ForwardIterator1 first1, ForwardIterator1 last1, |
| 1220 | ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred); |
| 1221 | |
| 1222 | template <class ForwardIterator> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1223 | constexpr ForwardIterator // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1224 | adjacent_find(ForwardIterator first, ForwardIterator last); |
| 1225 | |
| 1226 | template <class ForwardIterator, class BinaryPredicate> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1227 | constexpr ForwardIterator // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1228 | adjacent_find(ForwardIterator first, ForwardIterator last, BinaryPredicate pred); |
| 1229 | |
| 1230 | template <class InputIterator, class T> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1231 | constexpr typename iterator_traits<InputIterator>::difference_type // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1232 | count(InputIterator first, InputIterator last, const T& value); |
| 1233 | |
| 1234 | template <class InputIterator, class Predicate> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1235 | constexpr typename iterator_traits<InputIterator>::difference_type // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1236 | count_if(InputIterator first, InputIterator last, Predicate pred); |
| 1237 | |
| 1238 | template <class InputIterator1, class InputIterator2> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1239 | constexpr pair<InputIterator1, InputIterator2> // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1240 | mismatch(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2); |
| 1241 | |
Marshall Clow | 0b0bbd2 | 2013-05-09 21:14:23 | [diff] [blame] | 1242 | template <class InputIterator1, class InputIterator2> |
Louis Dionne | 5366bf5 | 2024-10-01 16:59:36 | [diff] [blame] | 1243 | constexpr pair<InputIterator1, InputIterator2> |
Aditya Kumar | 331fb80 | 2016-08-25 11:52:38 | [diff] [blame] | 1244 | mismatch(InputIterator1 first1, InputIterator1 last1, |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1245 | InputIterator2 first2, InputIterator2 last2); // since C++14, constexpr since C++20 |
Marshall Clow | 0b0bbd2 | 2013-05-09 21:14:23 | [diff] [blame] | 1246 | |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1247 | template <class InputIterator1, class InputIterator2, class BinaryPredicate> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1248 | constexpr pair<InputIterator1, InputIterator2> // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1249 | mismatch(InputIterator1 first1, InputIterator1 last1, |
| 1250 | InputIterator2 first2, BinaryPredicate pred); |
| 1251 | |
Marshall Clow | 0b0bbd2 | 2013-05-09 21:14:23 | [diff] [blame] | 1252 | template <class InputIterator1, class InputIterator2, class BinaryPredicate> |
Louis Dionne | 5366bf5 | 2024-10-01 16:59:36 | [diff] [blame] | 1253 | constexpr pair<InputIterator1, InputIterator2> |
Marshall Clow | 0b0bbd2 | 2013-05-09 21:14:23 | [diff] [blame] | 1254 | mismatch(InputIterator1 first1, InputIterator1 last1, |
| 1255 | InputIterator2 first2, InputIterator2 last2, |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1256 | BinaryPredicate pred); // since C++14, constexpr since C++20 |
Marshall Clow | 0b0bbd2 | 2013-05-09 21:14:23 | [diff] [blame] | 1257 | |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1258 | template <class InputIterator1, class InputIterator2> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1259 | constexpr bool // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1260 | equal(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2); |
| 1261 | |
Marshall Clow | 0b0bbd2 | 2013-05-09 21:14:23 | [diff] [blame] | 1262 | template <class InputIterator1, class InputIterator2> |
Louis Dionne | 5366bf5 | 2024-10-01 16:59:36 | [diff] [blame] | 1263 | constexpr bool |
Aditya Kumar | 331fb80 | 2016-08-25 11:52:38 | [diff] [blame] | 1264 | equal(InputIterator1 first1, InputIterator1 last1, |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1265 | InputIterator2 first2, InputIterator2 last2); // since C++14, constexpr since C++20 |
Marshall Clow | 0b0bbd2 | 2013-05-09 21:14:23 | [diff] [blame] | 1266 | |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1267 | template <class InputIterator1, class InputIterator2, class BinaryPredicate> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1268 | constexpr bool // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1269 | equal(InputIterator1 first1, InputIterator1 last1, |
| 1270 | InputIterator2 first2, BinaryPredicate pred); |
| 1271 | |
Marshall Clow | 0b0bbd2 | 2013-05-09 21:14:23 | [diff] [blame] | 1272 | template <class InputIterator1, class InputIterator2, class BinaryPredicate> |
Louis Dionne | 5366bf5 | 2024-10-01 16:59:36 | [diff] [blame] | 1273 | constexpr bool |
Marshall Clow | 0b0bbd2 | 2013-05-09 21:14:23 | [diff] [blame] | 1274 | equal(InputIterator1 first1, InputIterator1 last1, |
| 1275 | InputIterator2 first2, InputIterator2 last2, |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1276 | BinaryPredicate pred); // since C++14, constexpr since C++20 |
Marshall Clow | 0b0bbd2 | 2013-05-09 21:14:23 | [diff] [blame] | 1277 | |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1278 | template<class ForwardIterator1, class ForwardIterator2> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1279 | constexpr bool // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1280 | is_permutation(ForwardIterator1 first1, ForwardIterator1 last1, |
| 1281 | ForwardIterator2 first2); |
| 1282 | |
Marshall Clow | 0b0bbd2 | 2013-05-09 21:14:23 | [diff] [blame] | 1283 | template<class ForwardIterator1, class ForwardIterator2> |
Louis Dionne | 5366bf5 | 2024-10-01 16:59:36 | [diff] [blame] | 1284 | constexpr bool |
Marshall Clow | 0b0bbd2 | 2013-05-09 21:14:23 | [diff] [blame] | 1285 | is_permutation(ForwardIterator1 first1, ForwardIterator1 last1, |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1286 | ForwardIterator2 first2, ForwardIterator2 last2); // since C++14, constexpr since C++20 |
Marshall Clow | 0b0bbd2 | 2013-05-09 21:14:23 | [diff] [blame] | 1287 | |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1288 | template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1289 | constexpr bool // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1290 | is_permutation(ForwardIterator1 first1, ForwardIterator1 last1, |
| 1291 | ForwardIterator2 first2, BinaryPredicate pred); |
| 1292 | |
Marshall Clow | 0b0bbd2 | 2013-05-09 21:14:23 | [diff] [blame] | 1293 | template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate> |
Louis Dionne | 5366bf5 | 2024-10-01 16:59:36 | [diff] [blame] | 1294 | constexpr bool |
Marshall Clow | 0b0bbd2 | 2013-05-09 21:14:23 | [diff] [blame] | 1295 | is_permutation(ForwardIterator1 first1, ForwardIterator1 last1, |
| 1296 | ForwardIterator2 first2, ForwardIterator2 last2, |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1297 | BinaryPredicate pred); // since C++14, constexpr since C++20 |
Marshall Clow | 0b0bbd2 | 2013-05-09 21:14:23 | [diff] [blame] | 1298 | |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1299 | template <class ForwardIterator1, class ForwardIterator2> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1300 | constexpr ForwardIterator1 // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1301 | search(ForwardIterator1 first1, ForwardIterator1 last1, |
| 1302 | ForwardIterator2 first2, ForwardIterator2 last2); |
| 1303 | |
| 1304 | template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1305 | constexpr ForwardIterator1 // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1306 | search(ForwardIterator1 first1, ForwardIterator1 last1, |
| 1307 | ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred); |
| 1308 | |
| 1309 | template <class ForwardIterator, class Size, class T> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1310 | constexpr ForwardIterator // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1311 | search_n(ForwardIterator first, ForwardIterator last, Size count, const T& value); |
| 1312 | |
| 1313 | template <class ForwardIterator, class Size, class T, class BinaryPredicate> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1314 | constexpr ForwardIterator // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1315 | search_n(ForwardIterator first, ForwardIterator last, |
| 1316 | Size count, const T& value, BinaryPredicate pred); |
| 1317 | |
| 1318 | template <class InputIterator, class OutputIterator> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1319 | constexpr OutputIterator // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1320 | copy(InputIterator first, InputIterator last, OutputIterator result); |
| 1321 | |
| 1322 | template<class InputIterator, class OutputIterator, class Predicate> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1323 | constexpr OutputIterator // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1324 | copy_if(InputIterator first, InputIterator last, |
| 1325 | OutputIterator result, Predicate pred); |
| 1326 | |
| 1327 | template<class InputIterator, class Size, class OutputIterator> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1328 | constexpr OutputIterator // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1329 | copy_n(InputIterator first, Size n, OutputIterator result); |
| 1330 | |
| 1331 | template <class BidirectionalIterator1, class BidirectionalIterator2> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1332 | constexpr BidirectionalIterator2 // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1333 | copy_backward(BidirectionalIterator1 first, BidirectionalIterator1 last, |
| 1334 | BidirectionalIterator2 result); |
| 1335 | |
Konstantin Varlamov | 79a2b4b | 2022-06-28 18:59:59 | [diff] [blame] | 1336 | // [alg.move], move |
| 1337 | template<class InputIterator, class OutputIterator> |
| 1338 | constexpr OutputIterator move(InputIterator first, InputIterator last, |
| 1339 | OutputIterator result); |
| 1340 | |
| 1341 | template<class BidirectionalIterator1, class BidirectionalIterator2> |
| 1342 | constexpr BidirectionalIterator2 |
| 1343 | move_backward(BidirectionalIterator1 first, BidirectionalIterator1 last, |
| 1344 | BidirectionalIterator2 result); |
| 1345 | |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1346 | template <class ForwardIterator1, class ForwardIterator2> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1347 | constexpr ForwardIterator2 // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1348 | swap_ranges(ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2); |
| 1349 | |
Konstantin Varlamov | 79a2b4b | 2022-06-28 18:59:59 | [diff] [blame] | 1350 | namespace ranges { |
| 1351 | template<class I1, class I2> |
| 1352 | using swap_ranges_result = in_in_result<I1, I2>; |
| 1353 | |
Nikolas Klauser | 9d90531 | 2022-02-10 12:33:03 | [diff] [blame] | 1354 | template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2> |
| 1355 | requires indirectly_swappable<I1, I2> |
| 1356 | constexpr ranges::swap_ranges_result<I1, I2> |
Konstantin Varlamov | 79a2b4b | 2022-06-28 18:59:59 | [diff] [blame] | 1357 | swap_ranges(I1 first1, S1 last1, I2 first2, S2 last2); |
Nikolas Klauser | 9d90531 | 2022-02-10 12:33:03 | [diff] [blame] | 1358 | |
| 1359 | template<input_range R1, input_range R2> |
| 1360 | requires indirectly_swappable<iterator_t<R1>, iterator_t<R2>> |
| 1361 | constexpr ranges::swap_ranges_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>> |
Konstantin Varlamov | 79a2b4b | 2022-06-28 18:59:59 | [diff] [blame] | 1362 | swap_ranges(R1&& r1, R2&& r2); |
| 1363 | } |
Nikolas Klauser | 9d90531 | 2022-02-10 12:33:03 | [diff] [blame] | 1364 | |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1365 | template <class ForwardIterator1, class ForwardIterator2> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1366 | constexpr void // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1367 | iter_swap(ForwardIterator1 a, ForwardIterator2 b); |
| 1368 | |
| 1369 | template <class InputIterator, class OutputIterator, class UnaryOperation> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1370 | constexpr OutputIterator // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1371 | transform(InputIterator first, InputIterator last, OutputIterator result, UnaryOperation op); |
| 1372 | |
| 1373 | template <class InputIterator1, class InputIterator2, class OutputIterator, class BinaryOperation> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1374 | constexpr OutputIterator // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1375 | transform(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, |
| 1376 | OutputIterator result, BinaryOperation binary_op); |
| 1377 | |
| 1378 | template <class ForwardIterator, class T> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1379 | constexpr void // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1380 | replace(ForwardIterator first, ForwardIterator last, const T& old_value, const T& new_value); |
| 1381 | |
| 1382 | template <class ForwardIterator, class Predicate, class T> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1383 | constexpr void // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1384 | replace_if(ForwardIterator first, ForwardIterator last, Predicate pred, const T& new_value); |
| 1385 | |
| 1386 | template <class InputIterator, class OutputIterator, class T> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1387 | constexpr OutputIterator // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1388 | replace_copy(InputIterator first, InputIterator last, OutputIterator result, |
| 1389 | const T& old_value, const T& new_value); |
| 1390 | |
| 1391 | template <class InputIterator, class OutputIterator, class Predicate, class T> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1392 | constexpr OutputIterator // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1393 | replace_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred, const T& new_value); |
| 1394 | |
| 1395 | template <class ForwardIterator, class T> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1396 | constexpr void // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1397 | fill(ForwardIterator first, ForwardIterator last, const T& value); |
| 1398 | |
| 1399 | template <class OutputIterator, class Size, class T> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1400 | constexpr OutputIterator // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1401 | fill_n(OutputIterator first, Size n, const T& value); |
| 1402 | |
| 1403 | template <class ForwardIterator, class Generator> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1404 | constexpr void // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1405 | generate(ForwardIterator first, ForwardIterator last, Generator gen); |
| 1406 | |
| 1407 | template <class OutputIterator, class Size, class Generator> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1408 | constexpr OutputIterator // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1409 | generate_n(OutputIterator first, Size n, Generator gen); |
| 1410 | |
| 1411 | template <class ForwardIterator, class T> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1412 | constexpr ForwardIterator // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1413 | remove(ForwardIterator first, ForwardIterator last, const T& value); |
| 1414 | |
| 1415 | template <class ForwardIterator, class Predicate> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1416 | constexpr ForwardIterator // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1417 | remove_if(ForwardIterator first, ForwardIterator last, Predicate pred); |
| 1418 | |
| 1419 | template <class InputIterator, class OutputIterator, class T> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1420 | constexpr OutputIterator // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1421 | remove_copy(InputIterator first, InputIterator last, OutputIterator result, const T& value); |
| 1422 | |
| 1423 | template <class InputIterator, class OutputIterator, class Predicate> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1424 | constexpr OutputIterator // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1425 | remove_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred); |
| 1426 | |
| 1427 | template <class ForwardIterator> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1428 | constexpr ForwardIterator // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1429 | unique(ForwardIterator first, ForwardIterator last); |
| 1430 | |
| 1431 | template <class ForwardIterator, class BinaryPredicate> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1432 | constexpr ForwardIterator // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1433 | unique(ForwardIterator first, ForwardIterator last, BinaryPredicate pred); |
| 1434 | |
| 1435 | template <class InputIterator, class OutputIterator> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1436 | constexpr OutputIterator // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1437 | unique_copy(InputIterator first, InputIterator last, OutputIterator result); |
| 1438 | |
| 1439 | template <class InputIterator, class OutputIterator, class BinaryPredicate> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1440 | constexpr OutputIterator // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1441 | unique_copy(InputIterator first, InputIterator last, OutputIterator result, BinaryPredicate pred); |
| 1442 | |
| 1443 | template <class BidirectionalIterator> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1444 | constexpr void // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1445 | reverse(BidirectionalIterator first, BidirectionalIterator last); |
| 1446 | |
| 1447 | template <class BidirectionalIterator, class OutputIterator> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1448 | constexpr OutputIterator // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1449 | reverse_copy(BidirectionalIterator first, BidirectionalIterator last, OutputIterator result); |
| 1450 | |
| 1451 | template <class ForwardIterator> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1452 | constexpr ForwardIterator // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1453 | rotate(ForwardIterator first, ForwardIterator middle, ForwardIterator last); |
| 1454 | |
| 1455 | template <class ForwardIterator, class OutputIterator> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1456 | constexpr OutputIterator // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1457 | rotate_copy(ForwardIterator first, ForwardIterator middle, ForwardIterator last, OutputIterator result); |
| 1458 | |
| 1459 | template <class RandomAccessIterator> |
| 1460 | void |
Marshall Clow | 0f37a41 | 2017-03-23 13:43:37 | [diff] [blame] | 1461 | random_shuffle(RandomAccessIterator first, RandomAccessIterator last); // deprecated in C++14, removed in C++17 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1462 | |
| 1463 | template <class RandomAccessIterator, class RandomNumberGenerator> |
| 1464 | void |
Marshall Clow | 06965c1 | 2014-03-03 06:14:19 | [diff] [blame] | 1465 | random_shuffle(RandomAccessIterator first, RandomAccessIterator last, |
Marshall Clow | 0f37a41 | 2017-03-23 13:43:37 | [diff] [blame] | 1466 | RandomNumberGenerator& rand); // deprecated in C++14, removed in C++17 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1467 | |
Eric Fiselier | e715470 | 2016-08-28 22:14:37 | [diff] [blame] | 1468 | template<class PopulationIterator, class SampleIterator, |
| 1469 | class Distance, class UniformRandomBitGenerator> |
| 1470 | SampleIterator sample(PopulationIterator first, PopulationIterator last, |
| 1471 | SampleIterator out, Distance n, |
| 1472 | UniformRandomBitGenerator&& g); // C++17 |
| 1473 | |
Howard Hinnant | f9d540b | 2010-05-26 17:49:34 | [diff] [blame] | 1474 | template<class RandomAccessIterator, class UniformRandomNumberGenerator> |
| 1475 | void shuffle(RandomAccessIterator first, RandomAccessIterator last, |
Howard Hinnant | fb34010 | 2010-11-18 01:47:02 | [diff] [blame] | 1476 | UniformRandomNumberGenerator&& g); |
Howard Hinnant | f9d540b | 2010-05-26 17:49:34 | [diff] [blame] | 1477 | |
Arthur O'Dwyer | 3fbd3ea | 2020-12-26 06:39:03 | [diff] [blame] | 1478 | template<class ForwardIterator> |
| 1479 | constexpr ForwardIterator |
| 1480 | shift_left(ForwardIterator first, ForwardIterator last, |
| 1481 | typename iterator_traits<ForwardIterator>::difference_type n); // C++20 |
| 1482 | |
| 1483 | template<class ForwardIterator> |
| 1484 | constexpr ForwardIterator |
| 1485 | shift_right(ForwardIterator first, ForwardIterator last, |
| 1486 | typename iterator_traits<ForwardIterator>::difference_type n); // C++20 |
| 1487 | |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1488 | template <class InputIterator, class Predicate> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1489 | constexpr bool // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1490 | is_partitioned(InputIterator first, InputIterator last, Predicate pred); |
| 1491 | |
| 1492 | template <class ForwardIterator, class Predicate> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1493 | constexpr ForwardIterator // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1494 | partition(ForwardIterator first, ForwardIterator last, Predicate pred); |
| 1495 | |
| 1496 | template <class InputIterator, class OutputIterator1, |
| 1497 | class OutputIterator2, class Predicate> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1498 | constexpr pair<OutputIterator1, OutputIterator2> // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1499 | partition_copy(InputIterator first, InputIterator last, |
| 1500 | OutputIterator1 out_true, OutputIterator2 out_false, |
| 1501 | Predicate pred); |
| 1502 | |
| 1503 | template <class ForwardIterator, class Predicate> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1504 | constexpr ForwardIterator // constexpr since C++26 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1505 | stable_partition(ForwardIterator first, ForwardIterator last, Predicate pred); |
| 1506 | |
| 1507 | template<class ForwardIterator, class Predicate> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1508 | constexpr ForwardIterator // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1509 | partition_point(ForwardIterator first, ForwardIterator last, Predicate pred); |
| 1510 | |
| 1511 | template <class ForwardIterator> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1512 | constexpr bool // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1513 | is_sorted(ForwardIterator first, ForwardIterator last); |
| 1514 | |
| 1515 | template <class ForwardIterator, class Compare> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1516 | constexpr bool // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1517 | is_sorted(ForwardIterator first, ForwardIterator last, Compare comp); |
| 1518 | |
| 1519 | template<class ForwardIterator> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1520 | constexpr ForwardIterator // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1521 | is_sorted_until(ForwardIterator first, ForwardIterator last); |
| 1522 | |
| 1523 | template <class ForwardIterator, class Compare> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1524 | constexpr ForwardIterator // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1525 | is_sorted_until(ForwardIterator first, ForwardIterator last, Compare comp); |
| 1526 | |
| 1527 | template <class RandomAccessIterator> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1528 | constexpr void // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1529 | sort(RandomAccessIterator first, RandomAccessIterator last); |
| 1530 | |
| 1531 | template <class RandomAccessIterator, class Compare> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1532 | constexpr void // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1533 | sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp); |
| 1534 | |
| 1535 | template <class RandomAccessIterator> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1536 | constexpr void // constexpr since C++26 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1537 | stable_sort(RandomAccessIterator first, RandomAccessIterator last); |
| 1538 | |
| 1539 | template <class RandomAccessIterator, class Compare> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1540 | constexpr void // constexpr since C++26 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1541 | stable_sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp); |
| 1542 | |
| 1543 | template <class RandomAccessIterator> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1544 | constexpr void // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1545 | partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last); |
| 1546 | |
| 1547 | template <class RandomAccessIterator, class Compare> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1548 | constexpr void // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1549 | partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last, Compare comp); |
| 1550 | |
| 1551 | template <class InputIterator, class RandomAccessIterator> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1552 | constexpr RandomAccessIterator // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1553 | partial_sort_copy(InputIterator first, InputIterator last, |
| 1554 | RandomAccessIterator result_first, RandomAccessIterator result_last); |
| 1555 | |
| 1556 | template <class InputIterator, class RandomAccessIterator, class Compare> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1557 | constexpr RandomAccessIterator // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1558 | partial_sort_copy(InputIterator first, InputIterator last, |
| 1559 | RandomAccessIterator result_first, RandomAccessIterator result_last, Compare comp); |
| 1560 | |
| 1561 | template <class RandomAccessIterator> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1562 | constexpr void // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1563 | nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last); |
| 1564 | |
| 1565 | template <class RandomAccessIterator, class Compare> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1566 | constexpr void // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1567 | nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last, Compare comp); |
| 1568 | |
| 1569 | template <class ForwardIterator, class T> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1570 | constexpr ForwardIterator // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1571 | lower_bound(ForwardIterator first, ForwardIterator last, const T& value); |
| 1572 | |
| 1573 | template <class ForwardIterator, class T, class Compare> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1574 | constexpr ForwardIterator // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1575 | lower_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp); |
| 1576 | |
| 1577 | template <class ForwardIterator, class T> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1578 | constexpr ForwardIterator // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1579 | upper_bound(ForwardIterator first, ForwardIterator last, const T& value); |
| 1580 | |
| 1581 | template <class ForwardIterator, class T, class Compare> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1582 | constexpr ForwardIterator // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1583 | upper_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp); |
| 1584 | |
| 1585 | template <class ForwardIterator, class T> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1586 | constexpr pair<ForwardIterator, ForwardIterator> // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1587 | equal_range(ForwardIterator first, ForwardIterator last, const T& value); |
| 1588 | |
| 1589 | template <class ForwardIterator, class T, class Compare> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1590 | constexpr pair<ForwardIterator, ForwardIterator> // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1591 | equal_range(ForwardIterator first, ForwardIterator last, const T& value, Compare comp); |
| 1592 | |
| 1593 | template <class ForwardIterator, class T> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1594 | constexpr bool // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1595 | binary_search(ForwardIterator first, ForwardIterator last, const T& value); |
| 1596 | |
| 1597 | template <class ForwardIterator, class T, class Compare> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1598 | constexpr bool // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1599 | binary_search(ForwardIterator first, ForwardIterator last, const T& value, Compare comp); |
| 1600 | |
| 1601 | template <class InputIterator1, class InputIterator2, class OutputIterator> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1602 | constexpr OutputIterator // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1603 | merge(InputIterator1 first1, InputIterator1 last1, |
| 1604 | InputIterator2 first2, InputIterator2 last2, OutputIterator result); |
| 1605 | |
| 1606 | template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1607 | constexpr OutputIterator // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1608 | merge(InputIterator1 first1, InputIterator1 last1, |
| 1609 | InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp); |
| 1610 | |
| 1611 | template <class BidirectionalIterator> |
| 1612 | void |
| 1613 | inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last); |
| 1614 | |
| 1615 | template <class BidirectionalIterator, class Compare> |
| 1616 | void |
| 1617 | inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last, Compare comp); |
| 1618 | |
| 1619 | template <class InputIterator1, class InputIterator2> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1620 | constexpr bool // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1621 | includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2); |
| 1622 | |
| 1623 | template <class InputIterator1, class InputIterator2, class Compare> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1624 | constexpr bool // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1625 | includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, Compare comp); |
| 1626 | |
| 1627 | template <class InputIterator1, class InputIterator2, class OutputIterator> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1628 | constexpr OutputIterator // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1629 | set_union(InputIterator1 first1, InputIterator1 last1, |
| 1630 | InputIterator2 first2, InputIterator2 last2, OutputIterator result); |
| 1631 | |
| 1632 | template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1633 | constexpr OutputIterator // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1634 | set_union(InputIterator1 first1, InputIterator1 last1, |
| 1635 | InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp); |
| 1636 | |
| 1637 | template <class InputIterator1, class InputIterator2, class OutputIterator> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1638 | constexpr OutputIterator // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1639 | set_intersection(InputIterator1 first1, InputIterator1 last1, |
| 1640 | InputIterator2 first2, InputIterator2 last2, OutputIterator result); |
| 1641 | |
| 1642 | template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1643 | constexpr OutputIterator // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1644 | set_intersection(InputIterator1 first1, InputIterator1 last1, |
| 1645 | InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp); |
| 1646 | |
| 1647 | template <class InputIterator1, class InputIterator2, class OutputIterator> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1648 | constexpr OutputIterator // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1649 | set_difference(InputIterator1 first1, InputIterator1 last1, |
| 1650 | InputIterator2 first2, InputIterator2 last2, OutputIterator result); |
| 1651 | |
| 1652 | template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1653 | constexpr OutputIterator // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1654 | set_difference(InputIterator1 first1, InputIterator1 last1, |
| 1655 | InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp); |
| 1656 | |
| 1657 | template <class InputIterator1, class InputIterator2, class OutputIterator> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1658 | constexpr OutputIterator // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1659 | set_symmetric_difference(InputIterator1 first1, InputIterator1 last1, |
| 1660 | InputIterator2 first2, InputIterator2 last2, OutputIterator result); |
| 1661 | |
| 1662 | template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1663 | constexpr OutputIterator // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1664 | set_symmetric_difference(InputIterator1 first1, InputIterator1 last1, |
| 1665 | InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp); |
| 1666 | |
| 1667 | template <class RandomAccessIterator> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1668 | constexpr void // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1669 | push_heap(RandomAccessIterator first, RandomAccessIterator last); |
| 1670 | |
| 1671 | template <class RandomAccessIterator, class Compare> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1672 | constexpr void // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1673 | push_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp); |
| 1674 | |
| 1675 | template <class RandomAccessIterator> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1676 | constexpr void // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1677 | pop_heap(RandomAccessIterator first, RandomAccessIterator last); |
| 1678 | |
| 1679 | template <class RandomAccessIterator, class Compare> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1680 | constexpr void // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1681 | pop_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp); |
| 1682 | |
| 1683 | template <class RandomAccessIterator> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1684 | constexpr void // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1685 | make_heap(RandomAccessIterator first, RandomAccessIterator last); |
| 1686 | |
| 1687 | template <class RandomAccessIterator, class Compare> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1688 | constexpr void // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1689 | make_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp); |
| 1690 | |
| 1691 | template <class RandomAccessIterator> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1692 | constexpr void // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1693 | sort_heap(RandomAccessIterator first, RandomAccessIterator last); |
| 1694 | |
| 1695 | template <class RandomAccessIterator, class Compare> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1696 | constexpr void // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1697 | sort_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp); |
| 1698 | |
Howard Hinnant | b3371f6 | 2010-08-22 00:02:43 | [diff] [blame] | 1699 | template <class RandomAccessIterator> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1700 | constexpr bool // constexpr since C++20 |
Howard Hinnant | b3371f6 | 2010-08-22 00:02:43 | [diff] [blame] | 1701 | is_heap(RandomAccessIterator first, RandomAccessiterator last); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1702 | |
Howard Hinnant | b3371f6 | 2010-08-22 00:02:43 | [diff] [blame] | 1703 | template <class RandomAccessIterator, class Compare> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1704 | constexpr bool // constexpr since C++20 |
Howard Hinnant | b3371f6 | 2010-08-22 00:02:43 | [diff] [blame] | 1705 | is_heap(RandomAccessIterator first, RandomAccessiterator last, Compare comp); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1706 | |
Howard Hinnant | b3371f6 | 2010-08-22 00:02:43 | [diff] [blame] | 1707 | template <class RandomAccessIterator> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1708 | constexpr RandomAccessIterator // constexpr since C++20 |
Howard Hinnant | b3371f6 | 2010-08-22 00:02:43 | [diff] [blame] | 1709 | is_heap_until(RandomAccessIterator first, RandomAccessiterator last); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1710 | |
Howard Hinnant | b3371f6 | 2010-08-22 00:02:43 | [diff] [blame] | 1711 | template <class RandomAccessIterator, class Compare> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1712 | constexpr RandomAccessIterator // constexpr since C++20 |
Howard Hinnant | b3371f6 | 2010-08-22 00:02:43 | [diff] [blame] | 1713 | is_heap_until(RandomAccessIterator first, RandomAccessiterator last, Compare comp); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1714 | |
Howard Hinnant | 4eb27b7 | 2010-08-21 20:10:01 | [diff] [blame] | 1715 | template <class ForwardIterator> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1716 | constexpr ForwardIterator // constexpr since C++14 |
Arthur O'Dwyer | b8bc4e1 | 2020-12-03 01:02:18 | [diff] [blame] | 1717 | min_element(ForwardIterator first, ForwardIterator last); |
Howard Hinnant | 4eb27b7 | 2010-08-21 20:10:01 | [diff] [blame] | 1718 | |
| 1719 | template <class ForwardIterator, class Compare> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1720 | constexpr ForwardIterator // constexpr since C++14 |
Arthur O'Dwyer | b8bc4e1 | 2020-12-03 01:02:18 | [diff] [blame] | 1721 | min_element(ForwardIterator first, ForwardIterator last, Compare comp); |
Howard Hinnant | 4eb27b7 | 2010-08-21 20:10:01 | [diff] [blame] | 1722 | |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1723 | template <class T> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1724 | constexpr const T& // constexpr since C++14 |
Arthur O'Dwyer | b8bc4e1 | 2020-12-03 01:02:18 | [diff] [blame] | 1725 | min(const T& a, const T& b); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1726 | |
| 1727 | template <class T, class Compare> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1728 | constexpr const T& // constexpr since C++14 |
Arthur O'Dwyer | b8bc4e1 | 2020-12-03 01:02:18 | [diff] [blame] | 1729 | min(const T& a, const T& b, Compare comp); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1730 | |
Howard Hinnant | 4eb27b7 | 2010-08-21 20:10:01 | [diff] [blame] | 1731 | template<class T> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1732 | constexpr T // constexpr since C++14 |
Arthur O'Dwyer | b8bc4e1 | 2020-12-03 01:02:18 | [diff] [blame] | 1733 | min(initializer_list<T> t); |
Howard Hinnant | 4eb27b7 | 2010-08-21 20:10:01 | [diff] [blame] | 1734 | |
| 1735 | template<class T, class Compare> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1736 | constexpr T // constexpr since C++14 |
Arthur O'Dwyer | b8bc4e1 | 2020-12-03 01:02:18 | [diff] [blame] | 1737 | min(initializer_list<T> t, Compare comp); |
Howard Hinnant | 4eb27b7 | 2010-08-21 20:10:01 | [diff] [blame] | 1738 | |
Marshall Clow | 146c14a | 2016-03-07 22:43:49 | [diff] [blame] | 1739 | template<class T> |
Arthur O'Dwyer | b8bc4e1 | 2020-12-03 01:02:18 | [diff] [blame] | 1740 | constexpr const T& clamp(const T& v, const T& lo, const T& hi); // C++17 |
Marshall Clow | 146c14a | 2016-03-07 22:43:49 | [diff] [blame] | 1741 | |
| 1742 | template<class T, class Compare> |
Arthur O'Dwyer | b8bc4e1 | 2020-12-03 01:02:18 | [diff] [blame] | 1743 | constexpr const T& clamp(const T& v, const T& lo, const T& hi, Compare comp); // C++17 |
Marshall Clow | 146c14a | 2016-03-07 22:43:49 | [diff] [blame] | 1744 | |
Howard Hinnant | 4eb27b7 | 2010-08-21 20:10:01 | [diff] [blame] | 1745 | template <class ForwardIterator> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1746 | constexpr ForwardIterator // constexpr since C++14 |
Arthur O'Dwyer | b8bc4e1 | 2020-12-03 01:02:18 | [diff] [blame] | 1747 | max_element(ForwardIterator first, ForwardIterator last); |
Howard Hinnant | 4eb27b7 | 2010-08-21 20:10:01 | [diff] [blame] | 1748 | |
| 1749 | template <class ForwardIterator, class Compare> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1750 | constexpr ForwardIterator // constexpr since C++14 |
Arthur O'Dwyer | b8bc4e1 | 2020-12-03 01:02:18 | [diff] [blame] | 1751 | max_element(ForwardIterator first, ForwardIterator last, Compare comp); |
Howard Hinnant | 4eb27b7 | 2010-08-21 20:10:01 | [diff] [blame] | 1752 | |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1753 | template <class T> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1754 | constexpr const T& // constexpr since C++14 |
Arthur O'Dwyer | b8bc4e1 | 2020-12-03 01:02:18 | [diff] [blame] | 1755 | max(const T& a, const T& b); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1756 | |
| 1757 | template <class T, class Compare> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1758 | constexpr const T& // constexpr since C++14 |
Arthur O'Dwyer | b8bc4e1 | 2020-12-03 01:02:18 | [diff] [blame] | 1759 | max(const T& a, const T& b, Compare comp); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1760 | |
Howard Hinnant | 4eb27b7 | 2010-08-21 20:10:01 | [diff] [blame] | 1761 | template<class T> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1762 | constexpr T // constexpr since C++14 |
Arthur O'Dwyer | b8bc4e1 | 2020-12-03 01:02:18 | [diff] [blame] | 1763 | max(initializer_list<T> t); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1764 | |
Howard Hinnant | 4eb27b7 | 2010-08-21 20:10:01 | [diff] [blame] | 1765 | template<class T, class Compare> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1766 | constexpr T // constexpr since C++14 |
Arthur O'Dwyer | b8bc4e1 | 2020-12-03 01:02:18 | [diff] [blame] | 1767 | max(initializer_list<T> t, Compare comp); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1768 | |
Howard Hinnant | 4eb27b7 | 2010-08-21 20:10:01 | [diff] [blame] | 1769 | template<class ForwardIterator> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1770 | constexpr pair<ForwardIterator, ForwardIterator> // constexpr since C++14 |
Arthur O'Dwyer | b8bc4e1 | 2020-12-03 01:02:18 | [diff] [blame] | 1771 | minmax_element(ForwardIterator first, ForwardIterator last); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1772 | |
Howard Hinnant | 4eb27b7 | 2010-08-21 20:10:01 | [diff] [blame] | 1773 | template<class ForwardIterator, class Compare> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1774 | constexpr pair<ForwardIterator, ForwardIterator> // constexpr since C++14 |
Arthur O'Dwyer | b8bc4e1 | 2020-12-03 01:02:18 | [diff] [blame] | 1775 | minmax_element(ForwardIterator first, ForwardIterator last, Compare comp); |
Howard Hinnant | 4eb27b7 | 2010-08-21 20:10:01 | [diff] [blame] | 1776 | |
| 1777 | template<class T> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1778 | constexpr pair<const T&, const T&> // constexpr since C++14 |
Arthur O'Dwyer | b8bc4e1 | 2020-12-03 01:02:18 | [diff] [blame] | 1779 | minmax(const T& a, const T& b); |
Howard Hinnant | 4eb27b7 | 2010-08-21 20:10:01 | [diff] [blame] | 1780 | |
| 1781 | template<class T, class Compare> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1782 | constexpr pair<const T&, const T&> // constexpr since C++14 |
Arthur O'Dwyer | b8bc4e1 | 2020-12-03 01:02:18 | [diff] [blame] | 1783 | minmax(const T& a, const T& b, Compare comp); |
Howard Hinnant | 4eb27b7 | 2010-08-21 20:10:01 | [diff] [blame] | 1784 | |
| 1785 | template<class T> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1786 | constexpr pair<T, T> // constexpr since C++14 |
Arthur O'Dwyer | b8bc4e1 | 2020-12-03 01:02:18 | [diff] [blame] | 1787 | minmax(initializer_list<T> t); |
Howard Hinnant | 4eb27b7 | 2010-08-21 20:10:01 | [diff] [blame] | 1788 | |
| 1789 | template<class T, class Compare> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1790 | constexpr pair<T, T> // constexpr since C++14 |
Arthur O'Dwyer | b8bc4e1 | 2020-12-03 01:02:18 | [diff] [blame] | 1791 | minmax(initializer_list<T> t, Compare comp); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1792 | |
| 1793 | template <class InputIterator1, class InputIterator2> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1794 | constexpr bool // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1795 | lexicographical_compare(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2); |
| 1796 | |
| 1797 | template <class InputIterator1, class InputIterator2, class Compare> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1798 | constexpr bool // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1799 | lexicographical_compare(InputIterator1 first1, InputIterator1 last1, |
| 1800 | InputIterator2 first2, InputIterator2 last2, Compare comp); |
| 1801 | |
Adrian Vogelsgesang | 2a06757 | 2022-08-04 22:21:27 | [diff] [blame] | 1802 | template<class InputIterator1, class InputIterator2, class Cmp> |
| 1803 | constexpr auto |
| 1804 | lexicographical_compare_three_way(InputIterator1 first1, InputIterator1 last1, |
| 1805 | InputIterator2 first2, InputIterator2 last2, |
| 1806 | Cmp comp) |
| 1807 | -> decltype(comp(*b1, *b2)); // since C++20 |
| 1808 | |
| 1809 | template<class InputIterator1, class InputIterator2> |
| 1810 | constexpr auto |
| 1811 | lexicographical_compare_three_way(InputIterator1 first1, InputIterator1 last1, |
| 1812 | InputIterator2 first2, InputIterator2 last2); // since C++20 |
| 1813 | |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1814 | template <class BidirectionalIterator> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1815 | constexpr bool // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1816 | next_permutation(BidirectionalIterator first, BidirectionalIterator last); |
| 1817 | |
| 1818 | template <class BidirectionalIterator, class Compare> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1819 | constexpr bool // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1820 | next_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp); |
| 1821 | |
| 1822 | template <class BidirectionalIterator> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1823 | constexpr bool // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1824 | prev_permutation(BidirectionalIterator first, BidirectionalIterator last); |
| 1825 | |
| 1826 | template <class BidirectionalIterator, class Compare> |
A. Jiang | ba9aeed | 2025-03-06 17:27:48 | [diff] [blame^] | 1827 | constexpr bool // constexpr since C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1828 | prev_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1829 | } // std |
| 1830 | |
| 1831 | */ |
| 1832 | |
Nikolas Klauser | b9a2658 | 2024-12-21 12:01:48 | [diff] [blame] | 1833 | #if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) |
| 1834 | # include <__cxx03/algorithm> |
| 1835 | #else |
Nikolas Klauser | c166a9c | 2024-12-10 15:02:12 | [diff] [blame] | 1836 | # include <__config> |
Howard Hinnant | 5d1a701 | 2013-08-14 18:00:20 | [diff] [blame] | 1837 | |
Nikolas Klauser | c166a9c | 2024-12-10 15:02:12 | [diff] [blame] | 1838 | # include <__algorithm/adjacent_find.h> |
| 1839 | # include <__algorithm/all_of.h> |
| 1840 | # include <__algorithm/any_of.h> |
| 1841 | # include <__algorithm/binary_search.h> |
| 1842 | # include <__algorithm/copy.h> |
| 1843 | # include <__algorithm/copy_backward.h> |
| 1844 | # include <__algorithm/copy_if.h> |
| 1845 | # include <__algorithm/copy_n.h> |
| 1846 | # include <__algorithm/count.h> |
| 1847 | # include <__algorithm/count_if.h> |
| 1848 | # include <__algorithm/equal.h> |
| 1849 | # include <__algorithm/equal_range.h> |
| 1850 | # include <__algorithm/fill.h> |
| 1851 | # include <__algorithm/fill_n.h> |
| 1852 | # include <__algorithm/find.h> |
| 1853 | # include <__algorithm/find_end.h> |
| 1854 | # include <__algorithm/find_first_of.h> |
| 1855 | # include <__algorithm/find_if.h> |
| 1856 | # include <__algorithm/find_if_not.h> |
| 1857 | # include <__algorithm/for_each.h> |
| 1858 | # include <__algorithm/generate.h> |
| 1859 | # include <__algorithm/generate_n.h> |
| 1860 | # include <__algorithm/includes.h> |
| 1861 | # include <__algorithm/inplace_merge.h> |
| 1862 | # include <__algorithm/is_heap.h> |
| 1863 | # include <__algorithm/is_heap_until.h> |
| 1864 | # include <__algorithm/is_partitioned.h> |
| 1865 | # include <__algorithm/is_permutation.h> |
| 1866 | # include <__algorithm/is_sorted.h> |
| 1867 | # include <__algorithm/is_sorted_until.h> |
| 1868 | # include <__algorithm/iter_swap.h> |
| 1869 | # include <__algorithm/lexicographical_compare.h> |
| 1870 | # include <__algorithm/lower_bound.h> |
| 1871 | # include <__algorithm/make_heap.h> |
| 1872 | # include <__algorithm/max.h> |
| 1873 | # include <__algorithm/max_element.h> |
| 1874 | # include <__algorithm/merge.h> |
| 1875 | # include <__algorithm/min.h> |
| 1876 | # include <__algorithm/min_element.h> |
| 1877 | # include <__algorithm/minmax.h> |
| 1878 | # include <__algorithm/minmax_element.h> |
| 1879 | # include <__algorithm/mismatch.h> |
| 1880 | # include <__algorithm/move.h> |
| 1881 | # include <__algorithm/move_backward.h> |
| 1882 | # include <__algorithm/next_permutation.h> |
| 1883 | # include <__algorithm/none_of.h> |
| 1884 | # include <__algorithm/nth_element.h> |
| 1885 | # include <__algorithm/partial_sort.h> |
| 1886 | # include <__algorithm/partial_sort_copy.h> |
| 1887 | # include <__algorithm/partition.h> |
| 1888 | # include <__algorithm/partition_copy.h> |
| 1889 | # include <__algorithm/partition_point.h> |
| 1890 | # include <__algorithm/pop_heap.h> |
| 1891 | # include <__algorithm/prev_permutation.h> |
| 1892 | # include <__algorithm/push_heap.h> |
| 1893 | # include <__algorithm/remove.h> |
| 1894 | # include <__algorithm/remove_copy.h> |
| 1895 | # include <__algorithm/remove_copy_if.h> |
| 1896 | # include <__algorithm/remove_if.h> |
| 1897 | # include <__algorithm/replace.h> |
| 1898 | # include <__algorithm/replace_copy.h> |
| 1899 | # include <__algorithm/replace_copy_if.h> |
| 1900 | # include <__algorithm/replace_if.h> |
| 1901 | # include <__algorithm/reverse.h> |
| 1902 | # include <__algorithm/reverse_copy.h> |
| 1903 | # include <__algorithm/rotate.h> |
| 1904 | # include <__algorithm/rotate_copy.h> |
| 1905 | # include <__algorithm/search.h> |
| 1906 | # include <__algorithm/search_n.h> |
| 1907 | # include <__algorithm/set_difference.h> |
| 1908 | # include <__algorithm/set_intersection.h> |
| 1909 | # include <__algorithm/set_symmetric_difference.h> |
| 1910 | # include <__algorithm/set_union.h> |
| 1911 | # include <__algorithm/shuffle.h> |
| 1912 | # include <__algorithm/sort.h> |
| 1913 | # include <__algorithm/sort_heap.h> |
| 1914 | # include <__algorithm/stable_partition.h> |
| 1915 | # include <__algorithm/stable_sort.h> |
| 1916 | # include <__algorithm/swap_ranges.h> |
| 1917 | # include <__algorithm/transform.h> |
| 1918 | # include <__algorithm/unique.h> |
| 1919 | # include <__algorithm/unique_copy.h> |
| 1920 | # include <__algorithm/upper_bound.h> |
Eric Fiselier | c1bd919 | 2014-08-10 23:53:08 | [diff] [blame] | 1921 | |
Nikolas Klauser | c166a9c | 2024-12-10 15:02:12 | [diff] [blame] | 1922 | # if _LIBCPP_STD_VER >= 17 |
| 1923 | # include <__algorithm/clamp.h> |
| 1924 | # include <__algorithm/for_each_n.h> |
| 1925 | # include <__algorithm/pstl.h> |
| 1926 | # include <__algorithm/sample.h> |
| 1927 | # endif // _LIBCPP_STD_VER >= 17 |
Nikolas Klauser | d5c654b | 2024-04-14 13:52:56 | [diff] [blame] | 1928 | |
Nikolas Klauser | c166a9c | 2024-12-10 15:02:12 | [diff] [blame] | 1929 | # if _LIBCPP_STD_VER >= 20 |
| 1930 | # include <__algorithm/in_found_result.h> |
| 1931 | # include <__algorithm/in_fun_result.h> |
| 1932 | # include <__algorithm/in_in_out_result.h> |
| 1933 | # include <__algorithm/in_in_result.h> |
| 1934 | # include <__algorithm/in_out_out_result.h> |
| 1935 | # include <__algorithm/in_out_result.h> |
| 1936 | # include <__algorithm/lexicographical_compare_three_way.h> |
| 1937 | # include <__algorithm/min_max_result.h> |
| 1938 | # include <__algorithm/ranges_adjacent_find.h> |
| 1939 | # include <__algorithm/ranges_all_of.h> |
| 1940 | # include <__algorithm/ranges_any_of.h> |
| 1941 | # include <__algorithm/ranges_binary_search.h> |
| 1942 | # include <__algorithm/ranges_clamp.h> |
| 1943 | # include <__algorithm/ranges_contains.h> |
| 1944 | # include <__algorithm/ranges_copy.h> |
| 1945 | # include <__algorithm/ranges_copy_backward.h> |
| 1946 | # include <__algorithm/ranges_copy_if.h> |
| 1947 | # include <__algorithm/ranges_copy_n.h> |
| 1948 | # include <__algorithm/ranges_count.h> |
| 1949 | # include <__algorithm/ranges_count_if.h> |
| 1950 | # include <__algorithm/ranges_equal.h> |
| 1951 | # include <__algorithm/ranges_equal_range.h> |
| 1952 | # include <__algorithm/ranges_fill.h> |
| 1953 | # include <__algorithm/ranges_fill_n.h> |
| 1954 | # include <__algorithm/ranges_find.h> |
| 1955 | # include <__algorithm/ranges_find_end.h> |
| 1956 | # include <__algorithm/ranges_find_first_of.h> |
| 1957 | # include <__algorithm/ranges_find_if.h> |
| 1958 | # include <__algorithm/ranges_find_if_not.h> |
| 1959 | # include <__algorithm/ranges_for_each.h> |
| 1960 | # include <__algorithm/ranges_for_each_n.h> |
| 1961 | # include <__algorithm/ranges_generate.h> |
| 1962 | # include <__algorithm/ranges_generate_n.h> |
| 1963 | # include <__algorithm/ranges_includes.h> |
| 1964 | # include <__algorithm/ranges_inplace_merge.h> |
| 1965 | # include <__algorithm/ranges_is_heap.h> |
| 1966 | # include <__algorithm/ranges_is_heap_until.h> |
| 1967 | # include <__algorithm/ranges_is_partitioned.h> |
| 1968 | # include <__algorithm/ranges_is_permutation.h> |
| 1969 | # include <__algorithm/ranges_is_sorted.h> |
| 1970 | # include <__algorithm/ranges_is_sorted_until.h> |
| 1971 | # include <__algorithm/ranges_lexicographical_compare.h> |
| 1972 | # include <__algorithm/ranges_lower_bound.h> |
| 1973 | # include <__algorithm/ranges_make_heap.h> |
| 1974 | # include <__algorithm/ranges_max.h> |
| 1975 | # include <__algorithm/ranges_max_element.h> |
| 1976 | # include <__algorithm/ranges_merge.h> |
| 1977 | # include <__algorithm/ranges_min.h> |
| 1978 | # include <__algorithm/ranges_min_element.h> |
| 1979 | # include <__algorithm/ranges_minmax.h> |
| 1980 | # include <__algorithm/ranges_minmax_element.h> |
| 1981 | # include <__algorithm/ranges_mismatch.h> |
| 1982 | # include <__algorithm/ranges_move.h> |
| 1983 | # include <__algorithm/ranges_move_backward.h> |
| 1984 | # include <__algorithm/ranges_next_permutation.h> |
| 1985 | # include <__algorithm/ranges_none_of.h> |
| 1986 | # include <__algorithm/ranges_nth_element.h> |
| 1987 | # include <__algorithm/ranges_partial_sort.h> |
| 1988 | # include <__algorithm/ranges_partial_sort_copy.h> |
| 1989 | # include <__algorithm/ranges_partition.h> |
| 1990 | # include <__algorithm/ranges_partition_copy.h> |
| 1991 | # include <__algorithm/ranges_partition_point.h> |
| 1992 | # include <__algorithm/ranges_pop_heap.h> |
| 1993 | # include <__algorithm/ranges_prev_permutation.h> |
| 1994 | # include <__algorithm/ranges_push_heap.h> |
| 1995 | # include <__algorithm/ranges_remove.h> |
| 1996 | # include <__algorithm/ranges_remove_copy.h> |
| 1997 | # include <__algorithm/ranges_remove_copy_if.h> |
| 1998 | # include <__algorithm/ranges_remove_if.h> |
| 1999 | # include <__algorithm/ranges_replace.h> |
| 2000 | # include <__algorithm/ranges_replace_copy.h> |
| 2001 | # include <__algorithm/ranges_replace_copy_if.h> |
| 2002 | # include <__algorithm/ranges_replace_if.h> |
| 2003 | # include <__algorithm/ranges_reverse.h> |
| 2004 | # include <__algorithm/ranges_reverse_copy.h> |
| 2005 | # include <__algorithm/ranges_rotate.h> |
| 2006 | # include <__algorithm/ranges_rotate_copy.h> |
| 2007 | # include <__algorithm/ranges_sample.h> |
| 2008 | # include <__algorithm/ranges_search.h> |
| 2009 | # include <__algorithm/ranges_search_n.h> |
| 2010 | # include <__algorithm/ranges_set_difference.h> |
| 2011 | # include <__algorithm/ranges_set_intersection.h> |
| 2012 | # include <__algorithm/ranges_set_symmetric_difference.h> |
| 2013 | # include <__algorithm/ranges_set_union.h> |
| 2014 | # include <__algorithm/ranges_shuffle.h> |
| 2015 | # include <__algorithm/ranges_sort.h> |
| 2016 | # include <__algorithm/ranges_sort_heap.h> |
| 2017 | # include <__algorithm/ranges_stable_partition.h> |
| 2018 | # include <__algorithm/ranges_stable_sort.h> |
| 2019 | # include <__algorithm/ranges_swap_ranges.h> |
| 2020 | # include <__algorithm/ranges_transform.h> |
| 2021 | # include <__algorithm/ranges_unique.h> |
| 2022 | # include <__algorithm/ranges_unique_copy.h> |
| 2023 | # include <__algorithm/ranges_upper_bound.h> |
| 2024 | # include <__algorithm/shift_left.h> |
| 2025 | # include <__algorithm/shift_right.h> |
| 2026 | # endif |
Nikolas Klauser | d5c654b | 2024-04-14 13:52:56 | [diff] [blame] | 2027 | |
Nikolas Klauser | c166a9c | 2024-12-10 15:02:12 | [diff] [blame] | 2028 | # if _LIBCPP_STD_VER >= 23 |
| 2029 | # include <__algorithm/ranges_contains_subrange.h> |
| 2030 | # include <__algorithm/ranges_ends_with.h> |
| 2031 | # include <__algorithm/ranges_find_last.h> |
| 2032 | # include <__algorithm/ranges_fold.h> |
| 2033 | # include <__algorithm/ranges_starts_with.h> |
| 2034 | # endif // _LIBCPP_STD_VER >= 23 |
Nikolas Klauser | d5c654b | 2024-04-14 13:52:56 | [diff] [blame] | 2035 | |
Nikolas Klauser | c166a9c | 2024-12-10 15:02:12 | [diff] [blame] | 2036 | # include <version> |
Nikolas Klauser | d5c654b | 2024-04-14 13:52:56 | [diff] [blame] | 2037 | |
Nikolas Klauser | db1978b | 2022-06-16 20:43:46 | [diff] [blame] | 2038 | // standard-mandated includes |
Nikolas Klauser | 473a160 | 2022-09-22 16:05:08 | [diff] [blame] | 2039 | |
| 2040 | // [algorithm.syn] |
Nikolas Klauser | c166a9c | 2024-12-10 15:02:12 | [diff] [blame] | 2041 | # include <initializer_list> |
Nikolas Klauser | db1978b | 2022-06-16 20:43:46 | [diff] [blame] | 2042 | |
Nikolas Klauser | c166a9c | 2024-12-10 15:02:12 | [diff] [blame] | 2043 | # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 2044 | # pragma GCC system_header |
| 2045 | # endif |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 2046 | |
Nikolas Klauser | c166a9c | 2024-12-10 15:02:12 | [diff] [blame] | 2047 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER == 14 |
| 2048 | # include <execution> |
| 2049 | # endif |
Nikolas Klauser | d5c654b | 2024-04-14 13:52:56 | [diff] [blame] | 2050 | |
Nikolas Klauser | c166a9c | 2024-12-10 15:02:12 | [diff] [blame] | 2051 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 |
| 2052 | # include <atomic> |
| 2053 | # include <bit> |
| 2054 | # include <concepts> |
| 2055 | # include <cstdlib> |
| 2056 | # include <cstring> |
| 2057 | # include <iterator> |
| 2058 | # include <memory> |
| 2059 | # include <stdexcept> |
| 2060 | # include <type_traits> |
| 2061 | # include <utility> |
| 2062 | # endif |
Nikolas Klauser | b9a2658 | 2024-12-21 12:01:48 | [diff] [blame] | 2063 | #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) |
Mark de Wever | e31c2a1 | 2022-09-02 15:53:28 | [diff] [blame] | 2064 | |
Louis Dionne | 4cd6ca1 | 2021-04-20 16:03:32 | [diff] [blame] | 2065 | #endif // _LIBCPP_ALGORITHM |