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 { |
Nikolas Klauser | 1e77b39 | 2022-02-11 16:01:58 | [diff] [blame] | 22 | template <class I, class F> |
Nikolas Klauser | 807766b | 2022-02-21 21:48:36 | [diff] [blame] | 23 | struct in_fun_result; // since C++20 |
Nikolas Klauser | 1e77b39 | 2022-02-11 16:01:58 | [diff] [blame] | 24 | |
Nikolas Klauser | d3729bb | 2022-01-14 01:55:51 | [diff] [blame] | 25 | template <class I1, class I2> |
Nikolas Klauser | 807766b | 2022-02-21 21:48:36 | [diff] [blame] | 26 | struct in_in_result; // since C++20 |
Nikolas Klauser | f3514af | 2022-01-25 10:21:47 | [diff] [blame] | 27 | |
| 28 | template <class I1, class I2, class O> |
Nikolas Klauser | 807766b | 2022-02-21 21:48:36 | [diff] [blame] | 29 | struct in_in_out_result; // since C++20 |
Nikolas Klauser | 610979b | 2022-02-03 01:17:03 | [diff] [blame] | 30 | |
| 31 | template <class I, class O1, class O2> |
| 32 | struct in_out_out_result; // since C++20 |
Nikolas Klauser | 1e77b39 | 2022-02-11 16:01:58 | [diff] [blame] | 33 | |
Nikolas Klauser | 807766b | 2022-02-21 21:48:36 | [diff] [blame] | 34 | template <class I1, class I2> |
| 35 | struct min_max_result; // since C++20 |
| 36 | |
Nikolas Klauser | 68f4131 | 2022-02-21 22:07:02 | [diff] [blame] | 37 | template <class I> |
| 38 | struct in_found_result; // since C++20 |
| 39 | |
Nikolas Klauser | 3b470d1 | 2022-02-11 12:11:57 | [diff] [blame] | 40 | template<forward_iterator I, sentinel_for<I> S, class Proj = identity, |
| 41 | indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> // since C++20 |
| 42 | constexpr I min_element(I first, S last, Comp comp = {}, Proj proj = {}); |
| 43 | |
| 44 | template<forward_range R, class Proj = identity, |
| 45 | indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> // since C++20 |
| 46 | constexpr borrowed_iterator_t<R> min_element(R&& r, Comp comp = {}, Proj proj = {}); |
Nikolas Klauser | c2cd15a | 2022-03-08 22:12:35 | [diff] [blame] | 47 | |
Nikolas Klauser | 40f7fca3 | 2022-05-22 11:43:37 | [diff] [blame] | 48 | template<forward_iterator I, sentinel_for<I> S, class Proj = identity, |
| 49 | indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> |
| 50 | constexpr I ranges::max_element(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 |
| 51 | |
| 52 | template<forward_range R, class Proj = identity, |
| 53 | indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> |
| 54 | constexpr borrowed_iterator_t<R> ranges::max_element(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 |
| 55 | |
Nikolas Klauser | c2cd15a | 2022-03-08 22:12:35 | [diff] [blame] | 56 | template <input_iterator I1, sentinel_for<_I1> S1, input_iterator I2, sentinel_for<_I2> S2, |
| 57 | class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> |
| 58 | requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2> |
| 59 | constexpr mismatch_result<_I1, _I2> |
| 60 | mismatch()(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}) // since C++20 |
| 61 | |
| 62 | template <input_range R1, input_range R2, |
| 63 | class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> |
| 64 | requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2> |
| 65 | constexpr mismatch_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>> |
| 66 | 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] | 67 | |
Nikolas Klauser | ee0f8c4 | 2022-03-12 00:45:35 | [diff] [blame] | 68 | requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*> |
| 69 | constexpr I find(I first, S last, const T& value, Proj proj = {}); // since C++20 |
| 70 | |
| 71 | template<input_range R, class T, class Proj = identity> |
| 72 | requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*> |
| 73 | constexpr borrowed_iterator_t<R> |
| 74 | find(R&& r, const T& value, Proj proj = {}); // since C++20 |
| 75 | |
| 76 | template<input_iterator I, sentinel_for<I> S, class Proj = identity, |
| 77 | indirect_unary_predicate<projected<I, Proj>> Pred> |
| 78 | constexpr I find_if(I first, S last, Pred pred, Proj proj = {}); // since C++20 |
| 79 | |
| 80 | template<input_range R, class Proj = identity, |
| 81 | indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> |
| 82 | constexpr borrowed_iterator_t<R> |
| 83 | find_if(R&& r, Pred pred, Proj proj = {}); // since C++20 |
| 84 | |
| 85 | template<input_iterator I, sentinel_for<I> S, class Proj = identity, |
| 86 | indirect_unary_predicate<projected<I, Proj>> Pred> |
| 87 | constexpr I find_if_not(I first, S last, Pred pred, Proj proj = {}); // since C++20 |
| 88 | |
| 89 | template<input_range R, class Proj = identity, |
| 90 | indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> |
| 91 | constexpr borrowed_iterator_t<R> |
| 92 | find_if_not(R&& r, Pred pred, Proj proj = {}); // since C++20 |
Nikolas Klauser | f83d833 | 2022-03-18 01:57:08 | [diff] [blame] | 93 | |
Nikolas Klauser | e476df5 | 2022-04-03 07:17:01 | [diff] [blame] | 94 | template<class T, class Proj = identity, |
| 95 | indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less> |
| 96 | 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] | 97 | |
Nikolas Klauser | e476df5 | 2022-04-03 07:17:01 | [diff] [blame] | 98 | template<copyable T, class Proj = identity, |
| 99 | indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less> |
| 100 | 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] | 101 | |
| 102 | template<input_range R, class Proj = identity, |
| 103 | indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> |
| 104 | requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*> |
| 105 | constexpr range_value_t<R> |
| 106 | min(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 |
Nikolas Klauser | e476df5 | 2022-04-03 07:17:01 | [diff] [blame] | 107 | |
| 108 | template<class T, class Proj = identity, |
| 109 | indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less> |
| 110 | constexpr const T& max(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20 |
| 111 | |
| 112 | template<copyable T, class Proj = identity, |
| 113 | indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less> |
| 114 | constexpr T max(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20 |
| 115 | |
| 116 | template<input_range R, class Proj = identity, |
| 117 | indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> |
| 118 | requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*> |
| 119 | constexpr range_value_t<R> |
| 120 | max(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 |
Nikolas Klauser | 3ba8548 | 2022-04-05 09:05:36 | [diff] [blame] | 121 | |
| 122 | template<class I, class O> |
| 123 | using unary_transform_result = in_out_result<I, O>; // since C++20 |
| 124 | |
| 125 | template<class I1, class I2, class O> |
| 126 | using binary_transform_result = in_in_out_result<I1, I2, O>; // since C++20 |
| 127 | |
| 128 | template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, |
| 129 | copy_constructible F, class Proj = identity> |
| 130 | requires indirectly_writable<O, indirect_result_t<F&, projected<I, Proj>>> |
| 131 | constexpr ranges::unary_transform_result<I, O> |
| 132 | transform(I first1, S last1, O result, F op, Proj proj = {}); // since C++20 |
| 133 | |
| 134 | template<input_range R, weakly_incrementable O, copy_constructible F, |
| 135 | class Proj = identity> |
| 136 | requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R>, Proj>>> |
| 137 | constexpr ranges::unary_transform_result<borrowed_iterator_t<R>, O> |
| 138 | transform(R&& r, O result, F op, Proj proj = {}); // since C++20 |
| 139 | |
| 140 | template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, |
| 141 | weakly_incrementable O, copy_constructible F, class Proj1 = identity, |
| 142 | class Proj2 = identity> |
| 143 | requires indirectly_writable<O, indirect_result_t<F&, projected<I1, Proj1>, |
| 144 | projected<I2, Proj2>>> |
| 145 | constexpr ranges::binary_transform_result<I1, I2, O> |
| 146 | transform(I1 first1, S1 last1, I2 first2, S2 last2, O result, |
| 147 | F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 |
| 148 | |
| 149 | template<input_range R1, input_range R2, weakly_incrementable O, |
| 150 | copy_constructible F, class Proj1 = identity, class Proj2 = identity> |
| 151 | requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R1>, Proj1>, |
| 152 | projected<iterator_t<R2>, Proj2>>> |
| 153 | constexpr ranges::binary_transform_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O> |
| 154 | transform(R1&& r1, R2&& r2, O result, |
| 155 | F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 |
Nikolas Klauser | 1306b10 | 2022-04-07 11:02:02 | [diff] [blame] | 156 | |
| 157 | template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity> |
| 158 | requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*> |
| 159 | constexpr iter_difference_t<I> |
| 160 | count(I first, S last, const T& value, Proj proj = {}); // since C++20 |
| 161 | |
| 162 | template<input_range R, class T, class Proj = identity> |
| 163 | requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*> |
| 164 | constexpr range_difference_t<R> |
| 165 | count(R&& r, const T& value, Proj proj = {}); // since C++20 |
| 166 | |
| 167 | template<input_iterator I, sentinel_for<I> S, class Proj = identity, |
| 168 | indirect_unary_predicate<projected<I, Proj>> Pred> |
| 169 | constexpr iter_difference_t<I> |
| 170 | count_if(I first, S last, Pred pred, Proj proj = {}); // since C++20 |
| 171 | |
| 172 | template<input_range R, class Proj = identity, |
| 173 | indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> |
| 174 | constexpr range_difference_t<R> |
| 175 | count_if(R&& r, Pred pred, Proj proj = {}); // since C++20 |
Nikolas Klauser | 58d9ab7 | 2022-04-13 20:59:09 | [diff] [blame] | 176 | |
| 177 | template<class T, class Proj = identity, |
| 178 | indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less> |
| 179 | constexpr ranges::minmax_result<const T&> |
| 180 | minmax(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20 |
| 181 | |
| 182 | template<copyable T, class Proj = identity, |
| 183 | indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less> |
| 184 | constexpr ranges::minmax_result<T> |
| 185 | minmax(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20 |
| 186 | |
| 187 | template<input_range R, class Proj = identity, |
| 188 | indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> |
| 189 | requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*> |
| 190 | constexpr ranges::minmax_result<range_value_t<R>> |
| 191 | minmax(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 |
| 192 | |
| 193 | template<forward_iterator I, sentinel_for<I> S, class Proj = identity, |
| 194 | indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> |
| 195 | constexpr ranges::minmax_element_result<I> |
| 196 | minmax_element(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 |
| 197 | |
| 198 | template<forward_range R, class Proj = identity, |
| 199 | indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> |
| 200 | constexpr ranges::minmax_element_result<borrowed_iterator_t<R>> |
| 201 | minmax_element(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 |
Nikolas Klauser | 1d83750 | 2022-04-15 11:43:40 | [diff] [blame] | 202 | |
| 203 | template<class I, class O> |
| 204 | using copy_result = in_out_result<I, O>; // since C++20 |
| 205 | |
| 206 | template<class I, class O> |
| 207 | using copy_n_result = in_out_result<I, O>; // since C++20 |
| 208 | |
| 209 | template<class I, class O> |
| 210 | using copy_if_result = in_out_result<I, O>; // since C++20 |
| 211 | |
| 212 | template<class I1, class I2> |
| 213 | using copy_backward_result = in_out_result<I1, I2>; // since C++20 |
| 214 | |
| 215 | template<input_iterator I, sentinel_for<I> S, weakly_incrementable O> |
| 216 | requires indirectly_copyable<I, O> |
| 217 | constexpr ranges::copy_result<I, O> ranges::copy(I first, S last, O result); // since C++20 |
| 218 | |
| 219 | template<input_range R, weakly_incrementable O> |
| 220 | requires indirectly_copyable<iterator_t<R>, O> |
| 221 | constexpr ranges::copy_result<borrowed_iterator_t<R>, O> ranges::copy(R&& r, O result); // since C++20 |
| 222 | |
| 223 | template<input_iterator I, weakly_incrementable O> |
| 224 | requires indirectly_copyable<I, O> |
| 225 | constexpr ranges::copy_n_result<I, O> |
| 226 | ranges::copy_n(I first, iter_difference_t<I> n, O result); // since C++20 |
| 227 | |
| 228 | template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Proj = identity, |
| 229 | indirect_unary_predicate<projected<I, Proj>> Pred> |
| 230 | requires indirectly_copyable<I, O> |
| 231 | constexpr ranges::copy_if_result<I, O> |
| 232 | ranges::copy_if(I first, S last, O result, Pred pred, Proj proj = {}); // since C++20 |
| 233 | |
| 234 | template<input_range R, weakly_incrementable O, class Proj = identity, |
| 235 | indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> |
| 236 | requires indirectly_copyable<iterator_t<R>, O> |
| 237 | constexpr ranges::copy_if_result<borrowed_iterator_t<R>, O> |
| 238 | ranges::copy_if(R&& r, O result, Pred pred, Proj proj = {}); // since C++20 |
| 239 | |
| 240 | template<bidirectional_iterator I1, sentinel_for<I1> S1, bidirectional_iterator I2> |
| 241 | requires indirectly_copyable<I1, I2> |
| 242 | constexpr ranges::copy_backward_result<I1, I2> |
| 243 | ranges::copy_backward(I1 first, S1 last, I2 result); // since C++20 |
| 244 | |
| 245 | template<bidirectional_range R, bidirectional_iterator I> |
| 246 | requires indirectly_copyable<iterator_t<R>, I> |
| 247 | constexpr ranges::copy_backward_result<borrowed_iterator_t<R>, I> |
| 248 | ranges::copy_backward(R&& r, I result); // since C++20 |
Nikolas Klauser | 80045e9 | 2022-05-04 18:27:07 | [diff] [blame] | 249 | |
| 250 | template<class I, class F> |
| 251 | using for_each_result = in_fun_result<I, F>; // since C++20 |
| 252 | |
| 253 | template<input_iterator I, sentinel_for<I> S, class Proj = identity, |
| 254 | indirectly_unary_invocable<projected<I, Proj>> Fun> |
| 255 | constexpr ranges::for_each_result<I, Fun> |
| 256 | ranges::for_each(I first, S last, Fun f, Proj proj = {}); // since C++20 |
| 257 | |
| 258 | template<input_range R, class Proj = identity, |
| 259 | indirectly_unary_invocable<projected<iterator_t<R>, Proj>> Fun> |
| 260 | constexpr ranges::for_each_result<borrowed_iterator_t<R>, Fun> |
| 261 | ranges::for_each(R&& r, Fun f, Proj proj = {}); // since C++20 |
| 262 | |
| 263 | template<input_iterator I, class Proj = identity, |
| 264 | indirectly_unary_invocable<projected<I, Proj>> Fun> |
| 265 | constexpr ranges::for_each_n_result<I, Fun> |
| 266 | 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] | 267 | |
| 268 | template<input_iterator I, sentinel_for<I> S, class Proj = identity, |
| 269 | indirect_unary_predicate<projected<I, Proj>> Pred> |
| 270 | constexpr bool ranges::is_partitioned(I first, S last, Pred pred, Proj proj = {}); // since C++20 |
| 271 | |
| 272 | template<input_range R, class Proj = identity, |
| 273 | indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> |
| 274 | constexpr bool ranges::is_partitioned(R&& r, Pred pred, Proj proj = {}); // since C++20 |
| 275 | |
Nikolas Klauser | 1d1a191 | 2022-05-24 08:32:50 | [diff] [blame] | 276 | |
| 277 | template<bidirectional_iterator I, sentinel_for<I> S> |
| 278 | requires permutable<I> |
| 279 | constexpr I ranges::reverse(I first, S last); // since C++20 |
| 280 | |
| 281 | template<bidirectional_range R> |
| 282 | requires permutable<iterator_t<R>> |
| 283 | constexpr borrowed_iterator_t<R> ranges::reverse(R&& r); // since C++20 |
| 284 | |
Konstantin Varlamov | ff3989e | 2022-06-16 22:20:53 | [diff] [blame] | 285 | template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less, |
| 286 | class Proj = identity> |
| 287 | requires sortable<I, Comp, Proj> |
| 288 | constexpr I |
| 289 | sort(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 |
| 290 | |
| 291 | template<random_access_range R, class Comp = ranges::less, class Proj = identity> |
| 292 | requires sortable<iterator_t<R>, Comp, Proj> |
| 293 | constexpr borrowed_iterator_t<R> |
| 294 | sort(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 |
| 295 | |
Nikolas Klauser | 7af89a3 | 2022-05-21 16:26:29 | [diff] [blame] | 296 | template<class T, output_iterator<const T&> O, sentinel_for<O> S> |
| 297 | constexpr O ranges::fill(O first, S last, const T& value); // since C++20 |
| 298 | |
| 299 | template<class T, output_range<const T&> R> |
| 300 | constexpr borrowed_iterator_t<R> ranges::fill(R&& r, const T& value); // since C++20 |
| 301 | |
| 302 | template<class T, output_iterator<const T&> O> |
| 303 | 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] | 304 | |
| 305 | template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, |
| 306 | class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> |
| 307 | requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2> |
| 308 | constexpr bool ranges::equal(I1 first1, S1 last1, I2 first2, S2 last2, |
| 309 | Pred pred = {}, |
| 310 | Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 |
| 311 | |
| 312 | template<input_range R1, input_range R2, class Pred = ranges::equal_to, |
| 313 | class Proj1 = identity, class Proj2 = identity> |
| 314 | requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2> |
| 315 | constexpr bool ranges::equal(R1&& r1, R2&& r2, Pred pred = {}, |
| 316 | Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 |
| 317 | |
Nikolas Klauser | 0e3dc1a | 2022-05-26 14:42:46 | [diff] [blame] | 318 | template<input_iterator I, sentinel_for<I> S, class Proj = identity, |
| 319 | indirect_unary_predicate<projected<I, Proj>> Pred> |
| 320 | constexpr bool ranges::all_of(I first, S last, Pred pred, Proj proj = {}); // since C++20 |
| 321 | |
| 322 | template<input_range R, class Proj = identity, |
| 323 | indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> |
| 324 | constexpr bool ranges::all_of(R&& r, Pred pred, Proj proj = {}); // since C++20 |
| 325 | |
| 326 | template<input_iterator I, sentinel_for<I> S, class Proj = identity, |
| 327 | indirect_unary_predicate<projected<I, Proj>> Pred> |
| 328 | constexpr bool ranges::any_of(I first, S last, Pred pred, Proj proj = {}); // since C++20 |
| 329 | |
| 330 | template<input_range R, class Proj = identity, |
| 331 | indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> |
| 332 | constexpr bool ranges::any_of(R&& r, Pred pred, Proj proj = {}); // since C++20 |
| 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::none_of(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::none_of(R&& r, Pred pred, Proj proj = {}); // since C++20 |
| 341 | |
Nikolas Klauser | 11e3ad2 | 2022-05-26 14:08:55 | [diff] [blame] | 342 | template<forward_iterator I, sentinel_for<I> S, class Proj = identity, |
| 343 | indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> |
| 344 | constexpr bool ranges::is_sorted(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 |
| 345 | |
| 346 | template<forward_range R, class Proj = identity, |
| 347 | indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> |
| 348 | constexpr bool ranges::is_sorted(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 |
| 349 | |
| 350 | template<forward_iterator I, sentinel_for<I> S, class Proj = identity, |
| 351 | indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> |
| 352 | constexpr I ranges::is_sorted_until(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 |
| 353 | |
| 354 | template<forward_range R, class Proj = identity, |
| 355 | indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> |
| 356 | constexpr borrowed_iterator_t<R> |
| 357 | ranges::is_sorted_until(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 |
Nikolas Klauser | 8171586 | 2022-06-05 19:15:16 | [diff] [blame] | 358 | |
| 359 | template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity, |
| 360 | indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less> |
| 361 | constexpr I upper_bound(I first, S last, const T& value, Comp comp = {}, Proj proj = {}); // since C++20 |
| 362 | |
| 363 | template<forward_range R, class T, class Proj = identity, |
| 364 | indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp = |
| 365 | ranges::less> |
| 366 | constexpr borrowed_iterator_t<R> |
| 367 | upper_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20 |
| 368 | |
| 369 | template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity, |
| 370 | indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less> |
| 371 | constexpr I lower_bound(I first, S last, const T& value, Comp comp = {}, |
| 372 | Proj proj = {}); // since C++20 |
| 373 | template<forward_range R, class T, class Proj = identity, |
| 374 | indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp = |
| 375 | ranges::less> |
| 376 | constexpr borrowed_iterator_t<R> |
| 377 | lower_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20 |
| 378 | |
| 379 | template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity, |
| 380 | indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less> |
| 381 | constexpr bool binary_search(I first, S last, const T& value, Comp comp = {}, |
| 382 | Proj proj = {}); // since C++20 |
Nikolas Klauser | b79b2b6 | 2022-06-06 11:57:34 | [diff] [blame] | 383 | |
Nikolas Klauser | 8171586 | 2022-06-05 19:15:16 | [diff] [blame] | 384 | template<forward_range R, class T, class Proj = identity, |
| 385 | indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp = |
| 386 | ranges::less> |
| 387 | constexpr bool binary_search(R&& r, const T& value, Comp comp = {}, |
| 388 | Proj proj = {}); // since C++20 |
Nikolas Klauser | b79b2b6 | 2022-06-06 11:57:34 | [diff] [blame] | 389 | template<input_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2, |
| 390 | class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> |
| 391 | requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2> |
| 392 | constexpr I1 ranges::find_first_of(I1 first1, S1 last1, I2 first2, S2 last2, |
| 393 | Pred pred = {}, |
| 394 | Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 |
| 395 | |
| 396 | template<input_range R1, forward_range R2, |
| 397 | class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> |
| 398 | requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2> |
| 399 | constexpr borrowed_iterator_t<R1> |
| 400 | ranges::find_first_of(R1&& r1, R2&& r2, |
| 401 | Pred pred = {}, |
| 402 | Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 |
Nikolas Klauser | 8171586 | 2022-06-05 19:15:16 | [diff] [blame] | 403 | |
Nikolas Klauser | 916e905 | 2022-06-08 10:14:12 | [diff] [blame] | 404 | template<forward_iterator I, sentinel_for<I> S, class Proj = identity, |
| 405 | indirect_binary_predicate<projected<I, Proj>, |
| 406 | projected<I, Proj>> Pred = ranges::equal_to> |
| 407 | constexpr I ranges::adjacent_find(I first, S last, Pred pred = {}, Proj proj = {}); // since C+20 |
| 408 | |
| 409 | template<forward_range R, class Proj = identity, |
| 410 | indirect_binary_predicate<projected<iterator_t<R>, Proj>, |
| 411 | projected<iterator_t<R>, Proj>> Pred = ranges::equal_to> |
| 412 | constexpr borrowed_iterator_t<R> ranges::adjacent_find(R&& r, Pred pred = {}, Proj proj = {}); // since C++20 |
| 413 | |
Nikolas Klauser | ff6d5de | 2022-06-07 07:42:10 | [diff] [blame] | 414 | template<input_iterator I, sentinel_for<I> S, class T1, class T2, class Proj = identity> |
| 415 | requires indirectly_writable<I, const T2&> && |
| 416 | indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*> |
| 417 | constexpr I |
| 418 | ranges::replace(I first, S last, const T1& old_value, const T2& new_value, Proj proj = {}); // since C++20 |
| 419 | |
| 420 | template<input_range R, class T1, class T2, class Proj = identity> |
| 421 | requires indirectly_writable<iterator_t<R>, const T2&> && |
| 422 | indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T1*> |
| 423 | constexpr borrowed_iterator_t<R> |
| 424 | ranges::replace(R&& r, const T1& old_value, const T2& new_value, Proj proj = {}); // since C++20 |
| 425 | |
| 426 | template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity, |
| 427 | indirect_unary_predicate<projected<I, Proj>> Pred> |
| 428 | requires indirectly_writable<I, const T&> |
| 429 | constexpr I ranges::replace_if(I first, S last, Pred pred, const T& new_value, Proj proj = {}); // since C++20 |
| 430 | |
| 431 | template<input_range R, class T, class Proj = identity, |
| 432 | indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> |
| 433 | requires indirectly_writable<iterator_t<R>, const T&> |
| 434 | constexpr borrowed_iterator_t<R> |
| 435 | ranges::replace_if(R&& r, Pred pred, const T& new_value, Proj proj = {}); // since C++20 |
| 436 | |
Nikolas Klauser | afd5a4f | 2022-06-15 14:24:43 | [diff] [blame] | 437 | template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, |
| 438 | class Proj1 = identity, class Proj2 = identity, |
| 439 | indirect_strict_weak_order<projected<I1, Proj1>, |
| 440 | projected<I2, Proj2>> Comp = ranges::less> |
| 441 | constexpr bool |
| 442 | ranges::lexicographical_compare(I1 first1, S1 last1, I2 first2, S2 last2, |
| 443 | Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 |
| 444 | |
| 445 | template<input_range R1, input_range R2, class Proj1 = identity, |
| 446 | class Proj2 = identity, |
| 447 | indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>, |
| 448 | projected<iterator_t<R2>, Proj2>> Comp = ranges::less> |
| 449 | constexpr bool |
| 450 | ranges::lexicographical_compare(R1&& r1, R2&& r2, Comp comp = {}, |
| 451 | Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 |
| 452 | |
Nikolas Klauser | 2c3bbac | 2022-06-23 10:23:41 | [diff] [blame^] | 453 | template<bidirectional_iterator I1, sentinel_for<I1> S1, bidirectional_iterator I2> |
| 454 | requires indirectly_movable<I1, I2> |
| 455 | constexpr ranges::move_backward_result<I1, I2> |
| 456 | ranges::move_backward(I1 first, S1 last, I2 result); // since C++20 |
| 457 | |
| 458 | template<bidirectional_range R, bidirectional_iterator I> |
| 459 | requires indirectly_movable<iterator_t<R>, I> |
| 460 | constexpr ranges::move_backward_result<borrowed_iterator_t<R>, I> |
| 461 | ranges::move_backward(R&& r, I result); // since C++20 |
| 462 | |
| 463 | template<input_iterator I, sentinel_for<I> S, weakly_incrementable O> |
| 464 | requires indirectly_movable<I, O> |
| 465 | constexpr ranges::move_result<I, O> |
| 466 | ranges::move(I first, S last, O result); // since C++20 |
| 467 | |
| 468 | template<input_range R, weakly_incrementable O> |
| 469 | requires indirectly_movable<iterator_t<R>, O> |
| 470 | constexpr ranges::move_result<borrowed_iterator_t<R>, O> |
| 471 | ranges::move(R&& r, O result); // since C++20 |
| 472 | |
| 473 | |
Nikolas Klauser | d3729bb | 2022-01-14 01:55:51 | [diff] [blame] | 474 | } |
| 475 | |
Marshall Clow | 706ffef | 2018-01-15 17:20:36 | [diff] [blame] | 476 | constexpr bool // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 477 | all_of(InputIterator first, InputIterator last, Predicate pred); |
| 478 | |
| 479 | template <class InputIterator, class Predicate> |
Marshall Clow | 706ffef | 2018-01-15 17:20:36 | [diff] [blame] | 480 | constexpr bool // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 481 | any_of(InputIterator first, InputIterator last, Predicate pred); |
| 482 | |
| 483 | template <class InputIterator, class Predicate> |
Marshall Clow | 706ffef | 2018-01-15 17:20:36 | [diff] [blame] | 484 | constexpr bool // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 485 | none_of(InputIterator first, InputIterator last, Predicate pred); |
| 486 | |
| 487 | template <class InputIterator, class Function> |
Marshall Clow | 1b9a4ff | 2018-01-22 20:44:33 | [diff] [blame] | 488 | constexpr Function // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 489 | for_each(InputIterator first, InputIterator last, Function f); |
| 490 | |
Marshall Clow | d5c65ff | 2017-05-25 02:29:54 | [diff] [blame] | 491 | template<class InputIterator, class Size, class Function> |
Marshall Clow | 1b9a4ff | 2018-01-22 20:44:33 | [diff] [blame] | 492 | constexpr InputIterator // constexpr in C++20 |
| 493 | for_each_n(InputIterator first, Size n, Function f); // C++17 |
Marshall Clow | d5c65ff | 2017-05-25 02:29:54 | [diff] [blame] | 494 | |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 495 | template <class InputIterator, class T> |
Marshall Clow | 8694428 | 2018-01-15 19:26:05 | [diff] [blame] | 496 | constexpr InputIterator // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 497 | find(InputIterator first, InputIterator last, const T& value); |
| 498 | |
| 499 | template <class InputIterator, class Predicate> |
Marshall Clow | 8694428 | 2018-01-15 19:26:05 | [diff] [blame] | 500 | constexpr InputIterator // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 501 | find_if(InputIterator first, InputIterator last, Predicate pred); |
| 502 | |
| 503 | template<class InputIterator, class Predicate> |
Arthur O'Dwyer | b8bc4e1 | 2020-12-03 01:02:18 | [diff] [blame] | 504 | constexpr InputIterator // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 505 | find_if_not(InputIterator first, InputIterator last, Predicate pred); |
| 506 | |
| 507 | template <class ForwardIterator1, class ForwardIterator2> |
Arthur O'Dwyer | b8bc4e1 | 2020-12-03 01:02:18 | [diff] [blame] | 508 | constexpr ForwardIterator1 // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 509 | find_end(ForwardIterator1 first1, ForwardIterator1 last1, |
| 510 | ForwardIterator2 first2, ForwardIterator2 last2); |
| 511 | |
| 512 | template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate> |
Arthur O'Dwyer | b8bc4e1 | 2020-12-03 01:02:18 | [diff] [blame] | 513 | constexpr ForwardIterator1 // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 514 | find_end(ForwardIterator1 first1, ForwardIterator1 last1, |
| 515 | ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred); |
| 516 | |
| 517 | template <class ForwardIterator1, class ForwardIterator2> |
Marshall Clow | 8694428 | 2018-01-15 19:26:05 | [diff] [blame] | 518 | constexpr ForwardIterator1 // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 519 | find_first_of(ForwardIterator1 first1, ForwardIterator1 last1, |
| 520 | ForwardIterator2 first2, ForwardIterator2 last2); |
| 521 | |
| 522 | template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate> |
Marshall Clow | 8694428 | 2018-01-15 19:26:05 | [diff] [blame] | 523 | constexpr ForwardIterator1 // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 524 | find_first_of(ForwardIterator1 first1, ForwardIterator1 last1, |
| 525 | ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred); |
| 526 | |
| 527 | template <class ForwardIterator> |
Marshall Clow | 8694428 | 2018-01-15 19:26:05 | [diff] [blame] | 528 | constexpr ForwardIterator // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 529 | adjacent_find(ForwardIterator first, ForwardIterator last); |
| 530 | |
| 531 | template <class ForwardIterator, class BinaryPredicate> |
Marshall Clow | 8694428 | 2018-01-15 19:26:05 | [diff] [blame] | 532 | constexpr ForwardIterator // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 533 | adjacent_find(ForwardIterator first, ForwardIterator last, BinaryPredicate pred); |
| 534 | |
| 535 | template <class InputIterator, class T> |
Marshall Clow | 056f15e | 2018-01-15 19:40:34 | [diff] [blame] | 536 | constexpr typename iterator_traits<InputIterator>::difference_type // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 537 | count(InputIterator first, InputIterator last, const T& value); |
| 538 | |
| 539 | template <class InputIterator, class Predicate> |
Marshall Clow | 056f15e | 2018-01-15 19:40:34 | [diff] [blame] | 540 | constexpr typename iterator_traits<InputIterator>::difference_type // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 541 | count_if(InputIterator first, InputIterator last, Predicate pred); |
| 542 | |
| 543 | template <class InputIterator1, class InputIterator2> |
Marshall Clow | 6538e28d | 2018-01-16 02:04:10 | [diff] [blame] | 544 | constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 545 | mismatch(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2); |
| 546 | |
Marshall Clow | 0b0bbd2 | 2013-05-09 21:14:23 | [diff] [blame] | 547 | template <class InputIterator1, class InputIterator2> |
Marshall Clow | 6538e28d | 2018-01-16 02:04:10 | [diff] [blame] | 548 | constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20 |
Aditya Kumar | 331fb80 | 2016-08-25 11:52:38 | [diff] [blame] | 549 | mismatch(InputIterator1 first1, InputIterator1 last1, |
Marshall Clow | 0b0bbd2 | 2013-05-09 21:14:23 | [diff] [blame] | 550 | InputIterator2 first2, InputIterator2 last2); // **C++14** |
| 551 | |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 552 | template <class InputIterator1, class InputIterator2, class BinaryPredicate> |
Marshall Clow | 6538e28d | 2018-01-16 02:04:10 | [diff] [blame] | 553 | constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 554 | mismatch(InputIterator1 first1, InputIterator1 last1, |
| 555 | InputIterator2 first2, BinaryPredicate pred); |
| 556 | |
Marshall Clow | 0b0bbd2 | 2013-05-09 21:14:23 | [diff] [blame] | 557 | template <class InputIterator1, class InputIterator2, class BinaryPredicate> |
Marshall Clow | 6538e28d | 2018-01-16 02:04:10 | [diff] [blame] | 558 | constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20 |
Marshall Clow | 0b0bbd2 | 2013-05-09 21:14:23 | [diff] [blame] | 559 | mismatch(InputIterator1 first1, InputIterator1 last1, |
| 560 | InputIterator2 first2, InputIterator2 last2, |
| 561 | BinaryPredicate pred); // **C++14** |
| 562 | |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 563 | template <class InputIterator1, class InputIterator2> |
Marshall Clow | 6538e28d | 2018-01-16 02:04:10 | [diff] [blame] | 564 | constexpr bool // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 565 | equal(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2); |
| 566 | |
Marshall Clow | 0b0bbd2 | 2013-05-09 21:14:23 | [diff] [blame] | 567 | template <class InputIterator1, class InputIterator2> |
Marshall Clow | 6538e28d | 2018-01-16 02:04:10 | [diff] [blame] | 568 | constexpr bool // constexpr in C++20 |
Aditya Kumar | 331fb80 | 2016-08-25 11:52:38 | [diff] [blame] | 569 | equal(InputIterator1 first1, InputIterator1 last1, |
Marshall Clow | 0b0bbd2 | 2013-05-09 21:14:23 | [diff] [blame] | 570 | InputIterator2 first2, InputIterator2 last2); // **C++14** |
| 571 | |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 572 | template <class InputIterator1, class InputIterator2, class BinaryPredicate> |
Marshall Clow | 6538e28d | 2018-01-16 02:04:10 | [diff] [blame] | 573 | constexpr bool // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 574 | equal(InputIterator1 first1, InputIterator1 last1, |
| 575 | InputIterator2 first2, BinaryPredicate pred); |
| 576 | |
Marshall Clow | 0b0bbd2 | 2013-05-09 21:14:23 | [diff] [blame] | 577 | template <class InputIterator1, class InputIterator2, class BinaryPredicate> |
Marshall Clow | 6538e28d | 2018-01-16 02:04:10 | [diff] [blame] | 578 | constexpr bool // constexpr in C++20 |
Marshall Clow | 0b0bbd2 | 2013-05-09 21:14:23 | [diff] [blame] | 579 | equal(InputIterator1 first1, InputIterator1 last1, |
| 580 | InputIterator2 first2, InputIterator2 last2, |
| 581 | BinaryPredicate pred); // **C++14** |
| 582 | |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 583 | template<class ForwardIterator1, class ForwardIterator2> |
Marshall Clow | 49c7643 | 2018-01-15 16:16:32 | [diff] [blame] | 584 | constexpr bool // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 585 | is_permutation(ForwardIterator1 first1, ForwardIterator1 last1, |
| 586 | ForwardIterator2 first2); |
| 587 | |
Marshall Clow | 0b0bbd2 | 2013-05-09 21:14:23 | [diff] [blame] | 588 | template<class ForwardIterator1, class ForwardIterator2> |
Marshall Clow | 49c7643 | 2018-01-15 16:16:32 | [diff] [blame] | 589 | constexpr bool // constexpr in C++20 |
Marshall Clow | 0b0bbd2 | 2013-05-09 21:14:23 | [diff] [blame] | 590 | is_permutation(ForwardIterator1 first1, ForwardIterator1 last1, |
| 591 | ForwardIterator2 first2, ForwardIterator2 last2); // **C++14** |
| 592 | |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 593 | template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate> |
Marshall Clow | 49c7643 | 2018-01-15 16:16:32 | [diff] [blame] | 594 | constexpr bool // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 595 | is_permutation(ForwardIterator1 first1, ForwardIterator1 last1, |
| 596 | ForwardIterator2 first2, BinaryPredicate pred); |
| 597 | |
Marshall Clow | 0b0bbd2 | 2013-05-09 21:14:23 | [diff] [blame] | 598 | template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate> |
Marshall Clow | 49c7643 | 2018-01-15 16:16:32 | [diff] [blame] | 599 | constexpr bool // constexpr in C++20 |
Marshall Clow | 0b0bbd2 | 2013-05-09 21:14:23 | [diff] [blame] | 600 | is_permutation(ForwardIterator1 first1, ForwardIterator1 last1, |
| 601 | ForwardIterator2 first2, ForwardIterator2 last2, |
| 602 | BinaryPredicate pred); // **C++14** |
| 603 | |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 604 | template <class ForwardIterator1, class ForwardIterator2> |
Marshall Clow | 12f0a77 | 2018-01-16 15:48:27 | [diff] [blame] | 605 | constexpr ForwardIterator1 // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 606 | search(ForwardIterator1 first1, ForwardIterator1 last1, |
| 607 | ForwardIterator2 first2, ForwardIterator2 last2); |
| 608 | |
| 609 | template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate> |
Marshall Clow | 12f0a77 | 2018-01-16 15:48:27 | [diff] [blame] | 610 | constexpr ForwardIterator1 // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 611 | search(ForwardIterator1 first1, ForwardIterator1 last1, |
| 612 | ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred); |
| 613 | |
| 614 | template <class ForwardIterator, class Size, class T> |
Marshall Clow | 12f0a77 | 2018-01-16 15:48:27 | [diff] [blame] | 615 | constexpr ForwardIterator // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 616 | search_n(ForwardIterator first, ForwardIterator last, Size count, const T& value); |
| 617 | |
| 618 | template <class ForwardIterator, class Size, class T, class BinaryPredicate> |
Marshall Clow | 12f0a77 | 2018-01-16 15:48:27 | [diff] [blame] | 619 | constexpr ForwardIterator // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 620 | search_n(ForwardIterator first, ForwardIterator last, |
| 621 | Size count, const T& value, BinaryPredicate pred); |
| 622 | |
| 623 | template <class InputIterator, class OutputIterator> |
Louis Dionne | 13c90a5 | 2019-11-06 12:02:41 | [diff] [blame] | 624 | constexpr OutputIterator // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 625 | copy(InputIterator first, InputIterator last, OutputIterator result); |
| 626 | |
| 627 | template<class InputIterator, class OutputIterator, class Predicate> |
Louis Dionne | 13c90a5 | 2019-11-06 12:02:41 | [diff] [blame] | 628 | constexpr OutputIterator // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 629 | copy_if(InputIterator first, InputIterator last, |
| 630 | OutputIterator result, Predicate pred); |
| 631 | |
| 632 | template<class InputIterator, class Size, class OutputIterator> |
Louis Dionne | 13c90a5 | 2019-11-06 12:02:41 | [diff] [blame] | 633 | constexpr OutputIterator // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 634 | copy_n(InputIterator first, Size n, OutputIterator result); |
| 635 | |
| 636 | template <class BidirectionalIterator1, class BidirectionalIterator2> |
Louis Dionne | 13c90a5 | 2019-11-06 12:02:41 | [diff] [blame] | 637 | constexpr BidirectionalIterator2 // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 638 | copy_backward(BidirectionalIterator1 first, BidirectionalIterator1 last, |
| 639 | BidirectionalIterator2 result); |
| 640 | |
| 641 | template <class ForwardIterator1, class ForwardIterator2> |
Arthur O'Dwyer | b8bc4e1 | 2020-12-03 01:02:18 | [diff] [blame] | 642 | constexpr ForwardIterator2 // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 643 | swap_ranges(ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2); |
| 644 | |
Nikolas Klauser | 9d90531 | 2022-02-10 12:33:03 | [diff] [blame] | 645 | template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2> |
| 646 | requires indirectly_swappable<I1, I2> |
| 647 | constexpr ranges::swap_ranges_result<I1, I2> |
| 648 | ranges::swap_ranges(I1 first1, S1 last1, I2 first2, S2 last2); |
| 649 | |
| 650 | template<input_range R1, input_range R2> |
| 651 | requires indirectly_swappable<iterator_t<R1>, iterator_t<R2>> |
| 652 | constexpr ranges::swap_ranges_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>> |
| 653 | ranges::swap_ranges(R1&& r1, R2&& r2); |
| 654 | |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 655 | template <class ForwardIterator1, class ForwardIterator2> |
Arthur O'Dwyer | b8bc4e1 | 2020-12-03 01:02:18 | [diff] [blame] | 656 | constexpr void // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 657 | iter_swap(ForwardIterator1 a, ForwardIterator2 b); |
| 658 | |
| 659 | template <class InputIterator, class OutputIterator, class UnaryOperation> |
Marshall Clow | 99894b6 | 2018-01-19 17:45:39 | [diff] [blame] | 660 | constexpr OutputIterator // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 661 | transform(InputIterator first, InputIterator last, OutputIterator result, UnaryOperation op); |
| 662 | |
| 663 | template <class InputIterator1, class InputIterator2, class OutputIterator, class BinaryOperation> |
Marshall Clow | 99894b6 | 2018-01-19 17:45:39 | [diff] [blame] | 664 | constexpr OutputIterator // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 665 | transform(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, |
| 666 | OutputIterator result, BinaryOperation binary_op); |
| 667 | |
| 668 | template <class ForwardIterator, class T> |
Marshall Clow | 12c7423 | 2018-01-19 18:07:29 | [diff] [blame] | 669 | constexpr void // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 670 | replace(ForwardIterator first, ForwardIterator last, const T& old_value, const T& new_value); |
| 671 | |
| 672 | template <class ForwardIterator, class Predicate, class T> |
Marshall Clow | 12c7423 | 2018-01-19 18:07:29 | [diff] [blame] | 673 | constexpr void // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 674 | replace_if(ForwardIterator first, ForwardIterator last, Predicate pred, const T& new_value); |
| 675 | |
| 676 | template <class InputIterator, class OutputIterator, class T> |
Marshall Clow | 12c7423 | 2018-01-19 18:07:29 | [diff] [blame] | 677 | constexpr OutputIterator // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 678 | replace_copy(InputIterator first, InputIterator last, OutputIterator result, |
| 679 | const T& old_value, const T& new_value); |
| 680 | |
| 681 | template <class InputIterator, class OutputIterator, class Predicate, class T> |
Marshall Clow | 12c7423 | 2018-01-19 18:07:29 | [diff] [blame] | 682 | constexpr OutputIterator // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 683 | replace_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred, const T& new_value); |
| 684 | |
| 685 | template <class ForwardIterator, class T> |
Marshall Clow | 4bfb931 | 2018-01-20 20:14:32 | [diff] [blame] | 686 | constexpr void // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 687 | fill(ForwardIterator first, ForwardIterator last, const T& value); |
| 688 | |
| 689 | template <class OutputIterator, class Size, class T> |
Marshall Clow | 4bfb931 | 2018-01-20 20:14:32 | [diff] [blame] | 690 | constexpr OutputIterator // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 691 | fill_n(OutputIterator first, Size n, const T& value); |
| 692 | |
| 693 | template <class ForwardIterator, class Generator> |
Marshall Clow | 4bfb931 | 2018-01-20 20:14:32 | [diff] [blame] | 694 | constexpr void // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 695 | generate(ForwardIterator first, ForwardIterator last, Generator gen); |
| 696 | |
| 697 | template <class OutputIterator, class Size, class Generator> |
Marshall Clow | 4bfb931 | 2018-01-20 20:14:32 | [diff] [blame] | 698 | constexpr OutputIterator // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 699 | generate_n(OutputIterator first, Size n, Generator gen); |
| 700 | |
| 701 | template <class ForwardIterator, class T> |
Marshall Clow | e8ea829 | 2018-01-22 21:43:04 | [diff] [blame] | 702 | constexpr ForwardIterator // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 703 | remove(ForwardIterator first, ForwardIterator last, const T& value); |
| 704 | |
| 705 | template <class ForwardIterator, class Predicate> |
Marshall Clow | e8ea829 | 2018-01-22 21:43:04 | [diff] [blame] | 706 | constexpr ForwardIterator // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 707 | remove_if(ForwardIterator first, ForwardIterator last, Predicate pred); |
| 708 | |
| 709 | template <class InputIterator, class OutputIterator, class T> |
Marshall Clow | e8ea829 | 2018-01-22 21:43:04 | [diff] [blame] | 710 | constexpr OutputIterator // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 711 | remove_copy(InputIterator first, InputIterator last, OutputIterator result, const T& value); |
| 712 | |
| 713 | template <class InputIterator, class OutputIterator, class Predicate> |
Marshall Clow | e8ea829 | 2018-01-22 21:43:04 | [diff] [blame] | 714 | constexpr OutputIterator // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 715 | remove_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred); |
| 716 | |
| 717 | template <class ForwardIterator> |
Arthur O'Dwyer | b8bc4e1 | 2020-12-03 01:02:18 | [diff] [blame] | 718 | constexpr ForwardIterator // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 719 | unique(ForwardIterator first, ForwardIterator last); |
| 720 | |
| 721 | template <class ForwardIterator, class BinaryPredicate> |
Arthur O'Dwyer | b8bc4e1 | 2020-12-03 01:02:18 | [diff] [blame] | 722 | constexpr ForwardIterator // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 723 | unique(ForwardIterator first, ForwardIterator last, BinaryPredicate pred); |
| 724 | |
| 725 | template <class InputIterator, class OutputIterator> |
Arthur O'Dwyer | b8bc4e1 | 2020-12-03 01:02:18 | [diff] [blame] | 726 | constexpr OutputIterator // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 727 | unique_copy(InputIterator first, InputIterator last, OutputIterator result); |
| 728 | |
| 729 | template <class InputIterator, class OutputIterator, class BinaryPredicate> |
Arthur O'Dwyer | b8bc4e1 | 2020-12-03 01:02:18 | [diff] [blame] | 730 | constexpr OutputIterator // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 731 | unique_copy(InputIterator first, InputIterator last, OutputIterator result, BinaryPredicate pred); |
| 732 | |
| 733 | template <class BidirectionalIterator> |
Arthur O'Dwyer | f851db3 | 2020-12-17 05:01:08 | [diff] [blame] | 734 | constexpr void // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 735 | reverse(BidirectionalIterator first, BidirectionalIterator last); |
| 736 | |
| 737 | template <class BidirectionalIterator, class OutputIterator> |
Marshall Clow | e8ea829 | 2018-01-22 21:43:04 | [diff] [blame] | 738 | constexpr OutputIterator // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 739 | reverse_copy(BidirectionalIterator first, BidirectionalIterator last, OutputIterator result); |
| 740 | |
| 741 | template <class ForwardIterator> |
Arthur O'Dwyer | b8bc4e1 | 2020-12-03 01:02:18 | [diff] [blame] | 742 | constexpr ForwardIterator // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 743 | rotate(ForwardIterator first, ForwardIterator middle, ForwardIterator last); |
| 744 | |
| 745 | template <class ForwardIterator, class OutputIterator> |
Arthur O'Dwyer | b8bc4e1 | 2020-12-03 01:02:18 | [diff] [blame] | 746 | constexpr OutputIterator // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 747 | rotate_copy(ForwardIterator first, ForwardIterator middle, ForwardIterator last, OutputIterator result); |
| 748 | |
| 749 | template <class RandomAccessIterator> |
| 750 | void |
Marshall Clow | 0f37a41 | 2017-03-23 13:43:37 | [diff] [blame] | 751 | 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] | 752 | |
| 753 | template <class RandomAccessIterator, class RandomNumberGenerator> |
| 754 | void |
Marshall Clow | 06965c1 | 2014-03-03 06:14:19 | [diff] [blame] | 755 | random_shuffle(RandomAccessIterator first, RandomAccessIterator last, |
Marshall Clow | 0f37a41 | 2017-03-23 13:43:37 | [diff] [blame] | 756 | RandomNumberGenerator& rand); // deprecated in C++14, removed in C++17 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 757 | |
Eric Fiselier | e715470 | 2016-08-28 22:14:37 | [diff] [blame] | 758 | template<class PopulationIterator, class SampleIterator, |
| 759 | class Distance, class UniformRandomBitGenerator> |
| 760 | SampleIterator sample(PopulationIterator first, PopulationIterator last, |
| 761 | SampleIterator out, Distance n, |
| 762 | UniformRandomBitGenerator&& g); // C++17 |
| 763 | |
Howard Hinnant | f9d540b | 2010-05-26 17:49:34 | [diff] [blame] | 764 | template<class RandomAccessIterator, class UniformRandomNumberGenerator> |
| 765 | void shuffle(RandomAccessIterator first, RandomAccessIterator last, |
Howard Hinnant | fb34010 | 2010-11-18 01:47:02 | [diff] [blame] | 766 | UniformRandomNumberGenerator&& g); |
Howard Hinnant | f9d540b | 2010-05-26 17:49:34 | [diff] [blame] | 767 | |
Arthur O'Dwyer | 3fbd3ea | 2020-12-26 06:39:03 | [diff] [blame] | 768 | template<class ForwardIterator> |
| 769 | constexpr ForwardIterator |
| 770 | shift_left(ForwardIterator first, ForwardIterator last, |
| 771 | typename iterator_traits<ForwardIterator>::difference_type n); // C++20 |
| 772 | |
| 773 | template<class ForwardIterator> |
| 774 | constexpr ForwardIterator |
| 775 | shift_right(ForwardIterator first, ForwardIterator last, |
| 776 | typename iterator_traits<ForwardIterator>::difference_type n); // C++20 |
| 777 | |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 778 | template <class InputIterator, class Predicate> |
Marshall Clow | 49c7643 | 2018-01-15 16:16:32 | [diff] [blame] | 779 | constexpr bool // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 780 | is_partitioned(InputIterator first, InputIterator last, Predicate pred); |
| 781 | |
| 782 | template <class ForwardIterator, class Predicate> |
Arthur O'Dwyer | f851db3 | 2020-12-17 05:01:08 | [diff] [blame] | 783 | constexpr ForwardIterator // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 784 | partition(ForwardIterator first, ForwardIterator last, Predicate pred); |
| 785 | |
| 786 | template <class InputIterator, class OutputIterator1, |
| 787 | class OutputIterator2, class Predicate> |
Marshall Clow | 1b9a4ff | 2018-01-22 20:44:33 | [diff] [blame] | 788 | constexpr pair<OutputIterator1, OutputIterator2> // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 789 | partition_copy(InputIterator first, InputIterator last, |
| 790 | OutputIterator1 out_true, OutputIterator2 out_false, |
| 791 | Predicate pred); |
| 792 | |
| 793 | template <class ForwardIterator, class Predicate> |
| 794 | ForwardIterator |
| 795 | stable_partition(ForwardIterator first, ForwardIterator last, Predicate pred); |
| 796 | |
| 797 | template<class ForwardIterator, class Predicate> |
Marshall Clow | d57c03d | 2018-01-16 02:34:41 | [diff] [blame] | 798 | constexpr ForwardIterator // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 799 | partition_point(ForwardIterator first, ForwardIterator last, Predicate pred); |
| 800 | |
| 801 | template <class ForwardIterator> |
Marshall Clow | 49c7643 | 2018-01-15 16:16:32 | [diff] [blame] | 802 | constexpr bool // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 803 | is_sorted(ForwardIterator first, ForwardIterator last); |
| 804 | |
| 805 | template <class ForwardIterator, class Compare> |
Arthur O'Dwyer | b8bc4e1 | 2020-12-03 01:02:18 | [diff] [blame] | 806 | constexpr bool // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 807 | is_sorted(ForwardIterator first, ForwardIterator last, Compare comp); |
| 808 | |
| 809 | template<class ForwardIterator> |
Marshall Clow | 056f15e | 2018-01-15 19:40:34 | [diff] [blame] | 810 | constexpr ForwardIterator // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 811 | is_sorted_until(ForwardIterator first, ForwardIterator last); |
| 812 | |
| 813 | template <class ForwardIterator, class Compare> |
Marshall Clow | 056f15e | 2018-01-15 19:40:34 | [diff] [blame] | 814 | constexpr ForwardIterator // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 815 | is_sorted_until(ForwardIterator first, ForwardIterator last, Compare comp); |
| 816 | |
| 817 | template <class RandomAccessIterator> |
Arthur O'Dwyer | 493f140 | 2020-12-20 20:21:42 | [diff] [blame] | 818 | constexpr void // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 819 | sort(RandomAccessIterator first, RandomAccessIterator last); |
| 820 | |
| 821 | template <class RandomAccessIterator, class Compare> |
Arthur O'Dwyer | 493f140 | 2020-12-20 20:21:42 | [diff] [blame] | 822 | constexpr void // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 823 | sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp); |
| 824 | |
| 825 | template <class RandomAccessIterator> |
| 826 | void |
| 827 | stable_sort(RandomAccessIterator first, RandomAccessIterator last); |
| 828 | |
| 829 | template <class RandomAccessIterator, class Compare> |
| 830 | void |
| 831 | stable_sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp); |
| 832 | |
| 833 | template <class RandomAccessIterator> |
Arthur O'Dwyer | 5386aa2 | 2020-12-17 05:26:18 | [diff] [blame] | 834 | constexpr void // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 835 | partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last); |
| 836 | |
| 837 | template <class RandomAccessIterator, class Compare> |
Arthur O'Dwyer | 5386aa2 | 2020-12-17 05:26:18 | [diff] [blame] | 838 | constexpr void // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 839 | partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last, Compare comp); |
| 840 | |
| 841 | template <class InputIterator, class RandomAccessIterator> |
Arthur O'Dwyer | 5386aa2 | 2020-12-17 05:26:18 | [diff] [blame] | 842 | constexpr RandomAccessIterator // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 843 | partial_sort_copy(InputIterator first, InputIterator last, |
| 844 | RandomAccessIterator result_first, RandomAccessIterator result_last); |
| 845 | |
| 846 | template <class InputIterator, class RandomAccessIterator, class Compare> |
Arthur O'Dwyer | 5386aa2 | 2020-12-17 05:26:18 | [diff] [blame] | 847 | constexpr RandomAccessIterator // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 848 | partial_sort_copy(InputIterator first, InputIterator last, |
| 849 | RandomAccessIterator result_first, RandomAccessIterator result_last, Compare comp); |
| 850 | |
| 851 | template <class RandomAccessIterator> |
Arthur O'Dwyer | 5d95656 | 2021-02-04 23:12:52 | [diff] [blame] | 852 | constexpr void // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 853 | nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last); |
| 854 | |
| 855 | template <class RandomAccessIterator, class Compare> |
Arthur O'Dwyer | 5d95656 | 2021-02-04 23:12:52 | [diff] [blame] | 856 | constexpr void // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 857 | nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last, Compare comp); |
| 858 | |
| 859 | template <class ForwardIterator, class T> |
Marshall Clow | d57c03d | 2018-01-16 02:34:41 | [diff] [blame] | 860 | constexpr ForwardIterator // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 861 | lower_bound(ForwardIterator first, ForwardIterator last, const T& value); |
| 862 | |
| 863 | template <class ForwardIterator, class T, class Compare> |
Marshall Clow | d57c03d | 2018-01-16 02:34:41 | [diff] [blame] | 864 | constexpr ForwardIterator // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 865 | lower_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp); |
| 866 | |
| 867 | template <class ForwardIterator, class T> |
Marshall Clow | d57c03d | 2018-01-16 02:34:41 | [diff] [blame] | 868 | constexpr ForwardIterator // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 869 | upper_bound(ForwardIterator first, ForwardIterator last, const T& value); |
| 870 | |
| 871 | template <class ForwardIterator, class T, class Compare> |
Marshall Clow | d57c03d | 2018-01-16 02:34:41 | [diff] [blame] | 872 | constexpr ForwardIterator // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 873 | upper_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp); |
| 874 | |
| 875 | template <class ForwardIterator, class T> |
Marshall Clow | d57c03d | 2018-01-16 02:34:41 | [diff] [blame] | 876 | constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 877 | equal_range(ForwardIterator first, ForwardIterator last, const T& value); |
| 878 | |
| 879 | template <class ForwardIterator, class T, class Compare> |
Marshall Clow | d57c03d | 2018-01-16 02:34:41 | [diff] [blame] | 880 | constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 881 | equal_range(ForwardIterator first, ForwardIterator last, const T& value, Compare comp); |
| 882 | |
| 883 | template <class ForwardIterator, class T> |
Marshall Clow | d57c03d | 2018-01-16 02:34:41 | [diff] [blame] | 884 | constexpr bool // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 885 | binary_search(ForwardIterator first, ForwardIterator last, const T& value); |
| 886 | |
| 887 | template <class ForwardIterator, class T, class Compare> |
Marshall Clow | 8da1a48 | 2018-01-22 23:10:40 | [diff] [blame] | 888 | constexpr bool // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 889 | binary_search(ForwardIterator first, ForwardIterator last, const T& value, Compare comp); |
| 890 | |
| 891 | template <class InputIterator1, class InputIterator2, class OutputIterator> |
Arthur O'Dwyer | 14098cf | 2020-12-04 18:47:12 | [diff] [blame] | 892 | constexpr OutputIterator // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 893 | merge(InputIterator1 first1, InputIterator1 last1, |
| 894 | InputIterator2 first2, InputIterator2 last2, OutputIterator result); |
| 895 | |
| 896 | template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare> |
Arthur O'Dwyer | 14098cf | 2020-12-04 18:47:12 | [diff] [blame] | 897 | constexpr OutputIterator // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 898 | merge(InputIterator1 first1, InputIterator1 last1, |
| 899 | InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp); |
| 900 | |
| 901 | template <class BidirectionalIterator> |
| 902 | void |
| 903 | inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last); |
| 904 | |
| 905 | template <class BidirectionalIterator, class Compare> |
| 906 | void |
| 907 | inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last, Compare comp); |
| 908 | |
| 909 | template <class InputIterator1, class InputIterator2> |
Marshall Clow | 8da1a48 | 2018-01-22 23:10:40 | [diff] [blame] | 910 | constexpr bool // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 911 | includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2); |
| 912 | |
| 913 | template <class InputIterator1, class InputIterator2, class Compare> |
Marshall Clow | 8da1a48 | 2018-01-22 23:10:40 | [diff] [blame] | 914 | constexpr bool // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 915 | includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, Compare comp); |
| 916 | |
| 917 | template <class InputIterator1, class InputIterator2, class OutputIterator> |
Arthur O'Dwyer | 14098cf | 2020-12-04 18:47:12 | [diff] [blame] | 918 | constexpr OutputIterator // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 919 | set_union(InputIterator1 first1, InputIterator1 last1, |
| 920 | InputIterator2 first2, InputIterator2 last2, OutputIterator result); |
| 921 | |
| 922 | template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare> |
Arthur O'Dwyer | 14098cf | 2020-12-04 18:47:12 | [diff] [blame] | 923 | constexpr OutputIterator // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 924 | set_union(InputIterator1 first1, InputIterator1 last1, |
| 925 | InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp); |
| 926 | |
| 927 | template <class InputIterator1, class InputIterator2, class OutputIterator> |
Marshall Clow | 8da1a48 | 2018-01-22 23:10:40 | [diff] [blame] | 928 | constexpr OutputIterator // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 929 | set_intersection(InputIterator1 first1, InputIterator1 last1, |
| 930 | InputIterator2 first2, InputIterator2 last2, OutputIterator result); |
| 931 | |
| 932 | template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare> |
Marshall Clow | 8da1a48 | 2018-01-22 23:10:40 | [diff] [blame] | 933 | constexpr OutputIterator // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 934 | set_intersection(InputIterator1 first1, InputIterator1 last1, |
| 935 | InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp); |
| 936 | |
| 937 | template <class InputIterator1, class InputIterator2, class OutputIterator> |
Arthur O'Dwyer | 14098cf | 2020-12-04 18:47:12 | [diff] [blame] | 938 | constexpr OutputIterator // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 939 | set_difference(InputIterator1 first1, InputIterator1 last1, |
| 940 | InputIterator2 first2, InputIterator2 last2, OutputIterator result); |
| 941 | |
| 942 | template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare> |
Arthur O'Dwyer | 14098cf | 2020-12-04 18:47:12 | [diff] [blame] | 943 | constexpr OutputIterator // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 944 | set_difference(InputIterator1 first1, InputIterator1 last1, |
| 945 | InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp); |
| 946 | |
| 947 | template <class InputIterator1, class InputIterator2, class OutputIterator> |
Arthur O'Dwyer | 14098cf | 2020-12-04 18:47:12 | [diff] [blame] | 948 | constexpr OutputIterator // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 949 | set_symmetric_difference(InputIterator1 first1, InputIterator1 last1, |
| 950 | InputIterator2 first2, InputIterator2 last2, OutputIterator result); |
| 951 | |
| 952 | template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare> |
Arthur O'Dwyer | 14098cf | 2020-12-04 18:47:12 | [diff] [blame] | 953 | constexpr OutputIterator // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 954 | set_symmetric_difference(InputIterator1 first1, InputIterator1 last1, |
| 955 | InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp); |
| 956 | |
| 957 | template <class RandomAccessIterator> |
Arthur O'Dwyer | 5386aa2 | 2020-12-17 05:26:18 | [diff] [blame] | 958 | constexpr void // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 959 | push_heap(RandomAccessIterator first, RandomAccessIterator last); |
| 960 | |
| 961 | template <class RandomAccessIterator, class Compare> |
Arthur O'Dwyer | 5386aa2 | 2020-12-17 05:26:18 | [diff] [blame] | 962 | constexpr void // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 963 | push_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp); |
| 964 | |
| 965 | template <class RandomAccessIterator> |
Arthur O'Dwyer | 5386aa2 | 2020-12-17 05:26:18 | [diff] [blame] | 966 | constexpr void // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 967 | pop_heap(RandomAccessIterator first, RandomAccessIterator last); |
| 968 | |
| 969 | template <class RandomAccessIterator, class Compare> |
Arthur O'Dwyer | 5386aa2 | 2020-12-17 05:26:18 | [diff] [blame] | 970 | constexpr void // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 971 | pop_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp); |
| 972 | |
| 973 | template <class RandomAccessIterator> |
Arthur O'Dwyer | 5386aa2 | 2020-12-17 05:26:18 | [diff] [blame] | 974 | constexpr void // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 975 | make_heap(RandomAccessIterator first, RandomAccessIterator last); |
| 976 | |
| 977 | template <class RandomAccessIterator, class Compare> |
Arthur O'Dwyer | 5386aa2 | 2020-12-17 05:26:18 | [diff] [blame] | 978 | constexpr void // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 979 | make_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp); |
| 980 | |
| 981 | template <class RandomAccessIterator> |
Arthur O'Dwyer | 5386aa2 | 2020-12-17 05:26:18 | [diff] [blame] | 982 | constexpr void // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 983 | sort_heap(RandomAccessIterator first, RandomAccessIterator last); |
| 984 | |
| 985 | template <class RandomAccessIterator, class Compare> |
Arthur O'Dwyer | 5386aa2 | 2020-12-17 05:26:18 | [diff] [blame] | 986 | constexpr void // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 987 | sort_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp); |
| 988 | |
Howard Hinnant | b3371f6 | 2010-08-22 00:02:43 | [diff] [blame] | 989 | template <class RandomAccessIterator> |
Marshall Clow | 49c7643 | 2018-01-15 16:16:32 | [diff] [blame] | 990 | constexpr bool // constexpr in C++20 |
Howard Hinnant | b3371f6 | 2010-08-22 00:02:43 | [diff] [blame] | 991 | is_heap(RandomAccessIterator first, RandomAccessiterator last); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 992 | |
Howard Hinnant | b3371f6 | 2010-08-22 00:02:43 | [diff] [blame] | 993 | template <class RandomAccessIterator, class Compare> |
Marshall Clow | 49c7643 | 2018-01-15 16:16:32 | [diff] [blame] | 994 | constexpr bool // constexpr in C++20 |
Howard Hinnant | b3371f6 | 2010-08-22 00:02:43 | [diff] [blame] | 995 | is_heap(RandomAccessIterator first, RandomAccessiterator last, Compare comp); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 996 | |
Howard Hinnant | b3371f6 | 2010-08-22 00:02:43 | [diff] [blame] | 997 | template <class RandomAccessIterator> |
Marshall Clow | 49c7643 | 2018-01-15 16:16:32 | [diff] [blame] | 998 | constexpr RandomAccessIterator // constexpr in C++20 |
Howard Hinnant | b3371f6 | 2010-08-22 00:02:43 | [diff] [blame] | 999 | is_heap_until(RandomAccessIterator first, RandomAccessiterator last); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1000 | |
Howard Hinnant | b3371f6 | 2010-08-22 00:02:43 | [diff] [blame] | 1001 | template <class RandomAccessIterator, class Compare> |
Marshall Clow | 49c7643 | 2018-01-15 16:16:32 | [diff] [blame] | 1002 | constexpr RandomAccessIterator // constexpr in C++20 |
Howard Hinnant | b3371f6 | 2010-08-22 00:02:43 | [diff] [blame] | 1003 | is_heap_until(RandomAccessIterator first, RandomAccessiterator last, Compare comp); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1004 | |
Howard Hinnant | 4eb27b7 | 2010-08-21 20:10:01 | [diff] [blame] | 1005 | template <class ForwardIterator> |
Arthur O'Dwyer | b8bc4e1 | 2020-12-03 01:02:18 | [diff] [blame] | 1006 | constexpr ForwardIterator // constexpr in C++14 |
| 1007 | min_element(ForwardIterator first, ForwardIterator last); |
Howard Hinnant | 4eb27b7 | 2010-08-21 20:10:01 | [diff] [blame] | 1008 | |
| 1009 | template <class ForwardIterator, class Compare> |
Arthur O'Dwyer | b8bc4e1 | 2020-12-03 01:02:18 | [diff] [blame] | 1010 | constexpr ForwardIterator // constexpr in C++14 |
| 1011 | min_element(ForwardIterator first, ForwardIterator last, Compare comp); |
Howard Hinnant | 4eb27b7 | 2010-08-21 20:10:01 | [diff] [blame] | 1012 | |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1013 | template <class T> |
Arthur O'Dwyer | b8bc4e1 | 2020-12-03 01:02:18 | [diff] [blame] | 1014 | constexpr const T& // constexpr in C++14 |
| 1015 | min(const T& a, const T& b); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1016 | |
| 1017 | template <class T, class Compare> |
Arthur O'Dwyer | b8bc4e1 | 2020-12-03 01:02:18 | [diff] [blame] | 1018 | constexpr const T& // constexpr in C++14 |
| 1019 | min(const T& a, const T& b, Compare comp); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1020 | |
Howard Hinnant | 4eb27b7 | 2010-08-21 20:10:01 | [diff] [blame] | 1021 | template<class T> |
Arthur O'Dwyer | b8bc4e1 | 2020-12-03 01:02:18 | [diff] [blame] | 1022 | constexpr T // constexpr in C++14 |
| 1023 | min(initializer_list<T> t); |
Howard Hinnant | 4eb27b7 | 2010-08-21 20:10:01 | [diff] [blame] | 1024 | |
| 1025 | template<class T, class Compare> |
Arthur O'Dwyer | b8bc4e1 | 2020-12-03 01:02:18 | [diff] [blame] | 1026 | constexpr T // constexpr in C++14 |
| 1027 | min(initializer_list<T> t, Compare comp); |
Howard Hinnant | 4eb27b7 | 2010-08-21 20:10:01 | [diff] [blame] | 1028 | |
Marshall Clow | 146c14a | 2016-03-07 22:43:49 | [diff] [blame] | 1029 | template<class T> |
Arthur O'Dwyer | b8bc4e1 | 2020-12-03 01:02:18 | [diff] [blame] | 1030 | 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] | 1031 | |
| 1032 | template<class T, class Compare> |
Arthur O'Dwyer | b8bc4e1 | 2020-12-03 01:02:18 | [diff] [blame] | 1033 | 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] | 1034 | |
Howard Hinnant | 4eb27b7 | 2010-08-21 20:10:01 | [diff] [blame] | 1035 | template <class ForwardIterator> |
Arthur O'Dwyer | b8bc4e1 | 2020-12-03 01:02:18 | [diff] [blame] | 1036 | constexpr ForwardIterator // constexpr in C++14 |
| 1037 | max_element(ForwardIterator first, ForwardIterator last); |
Howard Hinnant | 4eb27b7 | 2010-08-21 20:10:01 | [diff] [blame] | 1038 | |
| 1039 | template <class ForwardIterator, class Compare> |
Arthur O'Dwyer | b8bc4e1 | 2020-12-03 01:02:18 | [diff] [blame] | 1040 | constexpr ForwardIterator // constexpr in C++14 |
| 1041 | max_element(ForwardIterator first, ForwardIterator last, Compare comp); |
Howard Hinnant | 4eb27b7 | 2010-08-21 20:10:01 | [diff] [blame] | 1042 | |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1043 | template <class T> |
Arthur O'Dwyer | b8bc4e1 | 2020-12-03 01:02:18 | [diff] [blame] | 1044 | constexpr const T& // constexpr in C++14 |
| 1045 | max(const T& a, const T& b); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1046 | |
| 1047 | template <class T, class Compare> |
Arthur O'Dwyer | b8bc4e1 | 2020-12-03 01:02:18 | [diff] [blame] | 1048 | constexpr const T& // constexpr in C++14 |
| 1049 | max(const T& a, const T& b, Compare comp); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1050 | |
Howard Hinnant | 4eb27b7 | 2010-08-21 20:10:01 | [diff] [blame] | 1051 | template<class T> |
Arthur O'Dwyer | b8bc4e1 | 2020-12-03 01:02:18 | [diff] [blame] | 1052 | constexpr T // constexpr in C++14 |
| 1053 | max(initializer_list<T> t); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1054 | |
Howard Hinnant | 4eb27b7 | 2010-08-21 20:10:01 | [diff] [blame] | 1055 | template<class T, class Compare> |
Arthur O'Dwyer | b8bc4e1 | 2020-12-03 01:02:18 | [diff] [blame] | 1056 | constexpr T // constexpr in C++14 |
| 1057 | max(initializer_list<T> t, Compare comp); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1058 | |
Howard Hinnant | 4eb27b7 | 2010-08-21 20:10:01 | [diff] [blame] | 1059 | template<class ForwardIterator> |
Arthur O'Dwyer | b8bc4e1 | 2020-12-03 01:02:18 | [diff] [blame] | 1060 | constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++14 |
| 1061 | minmax_element(ForwardIterator first, ForwardIterator last); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1062 | |
Howard Hinnant | 4eb27b7 | 2010-08-21 20:10:01 | [diff] [blame] | 1063 | template<class ForwardIterator, class Compare> |
Arthur O'Dwyer | b8bc4e1 | 2020-12-03 01:02:18 | [diff] [blame] | 1064 | constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++14 |
| 1065 | minmax_element(ForwardIterator first, ForwardIterator last, Compare comp); |
Howard Hinnant | 4eb27b7 | 2010-08-21 20:10:01 | [diff] [blame] | 1066 | |
| 1067 | template<class T> |
Arthur O'Dwyer | b8bc4e1 | 2020-12-03 01:02:18 | [diff] [blame] | 1068 | constexpr pair<const T&, const T&> // constexpr in C++14 |
| 1069 | minmax(const T& a, const T& b); |
Howard Hinnant | 4eb27b7 | 2010-08-21 20:10:01 | [diff] [blame] | 1070 | |
| 1071 | template<class T, class Compare> |
Arthur O'Dwyer | b8bc4e1 | 2020-12-03 01:02:18 | [diff] [blame] | 1072 | constexpr pair<const T&, const T&> // constexpr in C++14 |
| 1073 | minmax(const T& a, const T& b, Compare comp); |
Howard Hinnant | 4eb27b7 | 2010-08-21 20:10:01 | [diff] [blame] | 1074 | |
| 1075 | template<class T> |
Arthur O'Dwyer | b8bc4e1 | 2020-12-03 01:02:18 | [diff] [blame] | 1076 | constexpr pair<T, T> // constexpr in C++14 |
| 1077 | minmax(initializer_list<T> t); |
Howard Hinnant | 4eb27b7 | 2010-08-21 20:10:01 | [diff] [blame] | 1078 | |
| 1079 | template<class T, class Compare> |
Arthur O'Dwyer | b8bc4e1 | 2020-12-03 01:02:18 | [diff] [blame] | 1080 | constexpr pair<T, T> // constexpr in C++14 |
| 1081 | minmax(initializer_list<T> t, Compare comp); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1082 | |
| 1083 | template <class InputIterator1, class InputIterator2> |
Marshall Clow | 1b9a4ff | 2018-01-22 20:44:33 | [diff] [blame] | 1084 | constexpr bool // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1085 | lexicographical_compare(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2); |
| 1086 | |
| 1087 | template <class InputIterator1, class InputIterator2, class Compare> |
Marshall Clow | 1b9a4ff | 2018-01-22 20:44:33 | [diff] [blame] | 1088 | constexpr bool // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1089 | lexicographical_compare(InputIterator1 first1, InputIterator1 last1, |
| 1090 | InputIterator2 first2, InputIterator2 last2, Compare comp); |
| 1091 | |
| 1092 | template <class BidirectionalIterator> |
Arthur O'Dwyer | f851db3 | 2020-12-17 05:01:08 | [diff] [blame] | 1093 | constexpr bool // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1094 | next_permutation(BidirectionalIterator first, BidirectionalIterator last); |
| 1095 | |
| 1096 | template <class BidirectionalIterator, class Compare> |
Arthur O'Dwyer | f851db3 | 2020-12-17 05:01:08 | [diff] [blame] | 1097 | constexpr bool // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1098 | next_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp); |
| 1099 | |
| 1100 | template <class BidirectionalIterator> |
Arthur O'Dwyer | f851db3 | 2020-12-17 05:01:08 | [diff] [blame] | 1101 | constexpr bool // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1102 | prev_permutation(BidirectionalIterator first, BidirectionalIterator last); |
| 1103 | |
| 1104 | template <class BidirectionalIterator, class Compare> |
Arthur O'Dwyer | f851db3 | 2020-12-17 05:01:08 | [diff] [blame] | 1105 | constexpr bool // constexpr in C++20 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1106 | prev_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1107 | } // std |
| 1108 | |
| 1109 | */ |
| 1110 | |
Louis Dionne | 385cc25 | 2022-03-25 16:55:36 | [diff] [blame] | 1111 | #include <__assert> // all public C++ headers provide the assertion handler |
Arthur O'Dwyer | ea2206d | 2022-02-04 18:09:30 | [diff] [blame] | 1112 | #include <__bits> |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1113 | #include <__config> |
Louis Dionne | 134723e | 2021-06-17 15:30:11 | [diff] [blame] | 1114 | #include <__debug> |
Howard Hinnant | a1d07d5 | 2012-07-26 17:09:09 | [diff] [blame] | 1115 | #include <cstddef> |
Arthur O'Dwyer | bfbd73f | 2021-05-19 15:57:04 | [diff] [blame] | 1116 | #include <cstring> |
Arthur O'Dwyer | bfbd73f | 2021-05-19 15:57:04 | [diff] [blame] | 1117 | #include <memory> |
| 1118 | #include <type_traits> |
Marshall Clow | f56972e | 2018-09-12 19:41:40 | [diff] [blame] | 1119 | #include <version> |
Howard Hinnant | 5d1a701 | 2013-08-14 18:00:20 | [diff] [blame] | 1120 | |
Louis Dionne | 134723e | 2021-06-17 15:30:11 | [diff] [blame] | 1121 | #include <__algorithm/adjacent_find.h> |
| 1122 | #include <__algorithm/all_of.h> |
| 1123 | #include <__algorithm/any_of.h> |
| 1124 | #include <__algorithm/binary_search.h> |
| 1125 | #include <__algorithm/clamp.h> |
| 1126 | #include <__algorithm/comp.h> |
| 1127 | #include <__algorithm/comp_ref_type.h> |
| 1128 | #include <__algorithm/copy.h> |
| 1129 | #include <__algorithm/copy_backward.h> |
| 1130 | #include <__algorithm/copy_if.h> |
| 1131 | #include <__algorithm/copy_n.h> |
| 1132 | #include <__algorithm/count.h> |
| 1133 | #include <__algorithm/count_if.h> |
| 1134 | #include <__algorithm/equal.h> |
| 1135 | #include <__algorithm/equal_range.h> |
Louis Dionne | 134723e | 2021-06-17 15:30:11 | [diff] [blame] | 1136 | #include <__algorithm/fill.h> |
Arthur O'Dwyer | 4d81a46 | 2022-01-07 14:45:05 | [diff] [blame] | 1137 | #include <__algorithm/fill_n.h> |
Louis Dionne | 134723e | 2021-06-17 15:30:11 | [diff] [blame] | 1138 | #include <__algorithm/find.h> |
| 1139 | #include <__algorithm/find_end.h> |
| 1140 | #include <__algorithm/find_first_of.h> |
| 1141 | #include <__algorithm/find_if.h> |
| 1142 | #include <__algorithm/find_if_not.h> |
| 1143 | #include <__algorithm/for_each.h> |
| 1144 | #include <__algorithm/for_each_n.h> |
Louis Dionne | 134723e | 2021-06-17 15:30:11 | [diff] [blame] | 1145 | #include <__algorithm/generate.h> |
Arthur O'Dwyer | 4d81a46 | 2022-01-07 14:45:05 | [diff] [blame] | 1146 | #include <__algorithm/generate_n.h> |
Louis Dionne | 134723e | 2021-06-17 15:30:11 | [diff] [blame] | 1147 | #include <__algorithm/half_positive.h> |
Nikolas Klauser | 68f4131 | 2022-02-21 22:07:02 | [diff] [blame] | 1148 | #include <__algorithm/in_found_result.h> |
Nikolas Klauser | 1e77b39 | 2022-02-11 16:01:58 | [diff] [blame] | 1149 | #include <__algorithm/in_fun_result.h> |
Nikolas Klauser | f3514af | 2022-01-25 10:21:47 | [diff] [blame] | 1150 | #include <__algorithm/in_in_out_result.h> |
Nikolas Klauser | d3729bb | 2022-01-14 01:55:51 | [diff] [blame] | 1151 | #include <__algorithm/in_in_result.h> |
Nikolas Klauser | 610979b | 2022-02-03 01:17:03 | [diff] [blame] | 1152 | #include <__algorithm/in_out_out_result.h> |
Konstantin Varlamov | 8d23b74 | 2022-01-11 06:49:37 | [diff] [blame] | 1153 | #include <__algorithm/in_out_result.h> |
Louis Dionne | 134723e | 2021-06-17 15:30:11 | [diff] [blame] | 1154 | #include <__algorithm/includes.h> |
| 1155 | #include <__algorithm/inplace_merge.h> |
| 1156 | #include <__algorithm/is_heap.h> |
| 1157 | #include <__algorithm/is_heap_until.h> |
| 1158 | #include <__algorithm/is_partitioned.h> |
| 1159 | #include <__algorithm/is_permutation.h> |
| 1160 | #include <__algorithm/is_sorted.h> |
| 1161 | #include <__algorithm/is_sorted_until.h> |
Christopher Di Bella | 6adbc83 | 2021-06-05 02:47:47 | [diff] [blame] | 1162 | #include <__algorithm/iter_swap.h> |
Louis Dionne | 134723e | 2021-06-17 15:30:11 | [diff] [blame] | 1163 | #include <__algorithm/lexicographical_compare.h> |
| 1164 | #include <__algorithm/lower_bound.h> |
| 1165 | #include <__algorithm/make_heap.h> |
| 1166 | #include <__algorithm/max.h> |
| 1167 | #include <__algorithm/max_element.h> |
| 1168 | #include <__algorithm/merge.h> |
| 1169 | #include <__algorithm/min.h> |
| 1170 | #include <__algorithm/min_element.h> |
Nikolas Klauser | 807766b | 2022-02-21 21:48:36 | [diff] [blame] | 1171 | #include <__algorithm/min_max_result.h> |
Louis Dionne | 134723e | 2021-06-17 15:30:11 | [diff] [blame] | 1172 | #include <__algorithm/minmax.h> |
| 1173 | #include <__algorithm/minmax_element.h> |
| 1174 | #include <__algorithm/mismatch.h> |
| 1175 | #include <__algorithm/move.h> |
| 1176 | #include <__algorithm/move_backward.h> |
| 1177 | #include <__algorithm/next_permutation.h> |
| 1178 | #include <__algorithm/none_of.h> |
| 1179 | #include <__algorithm/nth_element.h> |
| 1180 | #include <__algorithm/partial_sort.h> |
| 1181 | #include <__algorithm/partial_sort_copy.h> |
| 1182 | #include <__algorithm/partition.h> |
| 1183 | #include <__algorithm/partition_copy.h> |
| 1184 | #include <__algorithm/partition_point.h> |
| 1185 | #include <__algorithm/pop_heap.h> |
| 1186 | #include <__algorithm/prev_permutation.h> |
| 1187 | #include <__algorithm/push_heap.h> |
Nikolas Klauser | 916e905 | 2022-06-08 10:14:12 | [diff] [blame] | 1188 | #include <__algorithm/ranges_adjacent_find.h> |
Nikolas Klauser | 0e3dc1a | 2022-05-26 14:42:46 | [diff] [blame] | 1189 | #include <__algorithm/ranges_all_of.h> |
| 1190 | #include <__algorithm/ranges_any_of.h> |
Nikolas Klauser | 8171586 | 2022-06-05 19:15:16 | [diff] [blame] | 1191 | #include <__algorithm/ranges_binary_search.h> |
Nikolas Klauser | 1d83750 | 2022-04-15 11:43:40 | [diff] [blame] | 1192 | #include <__algorithm/ranges_copy.h> |
| 1193 | #include <__algorithm/ranges_copy_backward.h> |
| 1194 | #include <__algorithm/ranges_copy_if.h> |
| 1195 | #include <__algorithm/ranges_copy_n.h> |
Nikolas Klauser | 1306b10 | 2022-04-07 11:02:02 | [diff] [blame] | 1196 | #include <__algorithm/ranges_count.h> |
| 1197 | #include <__algorithm/ranges_count_if.h> |
Nikolas Klauser | 569d663 | 2022-05-25 09:09:43 | [diff] [blame] | 1198 | #include <__algorithm/ranges_equal.h> |
Nikolas Klauser | 7af89a3 | 2022-05-21 16:26:29 | [diff] [blame] | 1199 | #include <__algorithm/ranges_fill.h> |
| 1200 | #include <__algorithm/ranges_fill_n.h> |
Nikolas Klauser | ee0f8c4 | 2022-03-12 00:45:35 | [diff] [blame] | 1201 | #include <__algorithm/ranges_find.h> |
Nikolas Klauser | b79b2b6 | 2022-06-06 11:57:34 | [diff] [blame] | 1202 | #include <__algorithm/ranges_find_first_of.h> |
Nikolas Klauser | ee0f8c4 | 2022-03-12 00:45:35 | [diff] [blame] | 1203 | #include <__algorithm/ranges_find_if.h> |
| 1204 | #include <__algorithm/ranges_find_if_not.h> |
Nikolas Klauser | 80045e9 | 2022-05-04 18:27:07 | [diff] [blame] | 1205 | #include <__algorithm/ranges_for_each.h> |
| 1206 | #include <__algorithm/ranges_for_each_n.h> |
Nikolas Klauser | 37ba1b9 | 2022-05-04 12:19:09 | [diff] [blame] | 1207 | #include <__algorithm/ranges_is_partitioned.h> |
Nikolas Klauser | 11e3ad2 | 2022-05-26 14:08:55 | [diff] [blame] | 1208 | #include <__algorithm/ranges_is_sorted.h> |
| 1209 | #include <__algorithm/ranges_is_sorted_until.h> |
Nikolas Klauser | afd5a4f | 2022-06-15 14:24:43 | [diff] [blame] | 1210 | #include <__algorithm/ranges_lexicographical_compare.h> |
Nikolas Klauser | 8171586 | 2022-06-05 19:15:16 | [diff] [blame] | 1211 | #include <__algorithm/ranges_lower_bound.h> |
Nikolas Klauser | e476df5 | 2022-04-03 07:17:01 | [diff] [blame] | 1212 | #include <__algorithm/ranges_max.h> |
Nikolas Klauser | 205557c | 2022-03-07 16:01:52 | [diff] [blame] | 1213 | #include <__algorithm/ranges_max_element.h> |
Nikolas Klauser | f83d833 | 2022-03-18 01:57:08 | [diff] [blame] | 1214 | #include <__algorithm/ranges_min.h> |
Nikolas Klauser | 3b470d1 | 2022-02-11 12:11:57 | [diff] [blame] | 1215 | #include <__algorithm/ranges_min_element.h> |
Nikolas Klauser | 58d9ab7 | 2022-04-13 20:59:09 | [diff] [blame] | 1216 | #include <__algorithm/ranges_minmax.h> |
| 1217 | #include <__algorithm/ranges_minmax_element.h> |
Nikolas Klauser | c2cd15a | 2022-03-08 22:12:35 | [diff] [blame] | 1218 | #include <__algorithm/ranges_mismatch.h> |
Nikolas Klauser | 2c3bbac | 2022-06-23 10:23:41 | [diff] [blame^] | 1219 | #include <__algorithm/ranges_move.h> |
| 1220 | #include <__algorithm/ranges_move_backward.h> |
Nikolas Klauser | 0e3dc1a | 2022-05-26 14:42:46 | [diff] [blame] | 1221 | #include <__algorithm/ranges_none_of.h> |
Nikolas Klauser | ff6d5de | 2022-06-07 07:42:10 | [diff] [blame] | 1222 | #include <__algorithm/ranges_replace.h> |
| 1223 | #include <__algorithm/ranges_replace_if.h> |
Nikolas Klauser | 1d1a191 | 2022-05-24 08:32:50 | [diff] [blame] | 1224 | #include <__algorithm/ranges_reverse.h> |
Konstantin Varlamov | ff3989e | 2022-06-16 22:20:53 | [diff] [blame] | 1225 | #include <__algorithm/ranges_sort.h> |
Nikolas Klauser | 9d90531 | 2022-02-10 12:33:03 | [diff] [blame] | 1226 | #include <__algorithm/ranges_swap_ranges.h> |
Nikolas Klauser | 3ba8548 | 2022-04-05 09:05:36 | [diff] [blame] | 1227 | #include <__algorithm/ranges_transform.h> |
Nikolas Klauser | 8171586 | 2022-06-05 19:15:16 | [diff] [blame] | 1228 | #include <__algorithm/ranges_upper_bound.h> |
Louis Dionne | 134723e | 2021-06-17 15:30:11 | [diff] [blame] | 1229 | #include <__algorithm/remove.h> |
| 1230 | #include <__algorithm/remove_copy.h> |
| 1231 | #include <__algorithm/remove_copy_if.h> |
| 1232 | #include <__algorithm/remove_if.h> |
| 1233 | #include <__algorithm/replace.h> |
| 1234 | #include <__algorithm/replace_copy.h> |
| 1235 | #include <__algorithm/replace_copy_if.h> |
| 1236 | #include <__algorithm/replace_if.h> |
| 1237 | #include <__algorithm/reverse.h> |
| 1238 | #include <__algorithm/reverse_copy.h> |
| 1239 | #include <__algorithm/rotate.h> |
| 1240 | #include <__algorithm/rotate_copy.h> |
| 1241 | #include <__algorithm/sample.h> |
| 1242 | #include <__algorithm/search.h> |
| 1243 | #include <__algorithm/search_n.h> |
| 1244 | #include <__algorithm/set_difference.h> |
| 1245 | #include <__algorithm/set_intersection.h> |
| 1246 | #include <__algorithm/set_symmetric_difference.h> |
| 1247 | #include <__algorithm/set_union.h> |
| 1248 | #include <__algorithm/shift_left.h> |
| 1249 | #include <__algorithm/shift_right.h> |
| 1250 | #include <__algorithm/shuffle.h> |
| 1251 | #include <__algorithm/sift_down.h> |
| 1252 | #include <__algorithm/sort.h> |
| 1253 | #include <__algorithm/sort_heap.h> |
| 1254 | #include <__algorithm/stable_partition.h> |
| 1255 | #include <__algorithm/stable_sort.h> |
Christopher Di Bella | 6adbc83 | 2021-06-05 02:47:47 | [diff] [blame] | 1256 | #include <__algorithm/swap_ranges.h> |
Louis Dionne | 134723e | 2021-06-17 15:30:11 | [diff] [blame] | 1257 | #include <__algorithm/transform.h> |
Louis Dionne | 134723e | 2021-06-17 15:30:11 | [diff] [blame] | 1258 | #include <__algorithm/unique.h> |
Arthur O'Dwyer | 4d81a46 | 2022-01-07 14:45:05 | [diff] [blame] | 1259 | #include <__algorithm/unique_copy.h> |
Louis Dionne | 134723e | 2021-06-17 15:30:11 | [diff] [blame] | 1260 | #include <__algorithm/unwrap_iter.h> |
| 1261 | #include <__algorithm/upper_bound.h> |
Eric Fiselier | c1bd919 | 2014-08-10 23:53:08 | [diff] [blame] | 1262 | |
Nikolas Klauser | db1978b | 2022-06-16 20:43:46 | [diff] [blame] | 1263 | // standard-mandated includes |
| 1264 | #include <initializer_list> |
| 1265 | |
Howard Hinnant | 073458b | 2011-10-17 20:05:10 | [diff] [blame] | 1266 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
Arthur O'Dwyer | fa6b9e4 | 2022-02-02 01:16:40 | [diff] [blame] | 1267 | # pragma GCC system_header |
Howard Hinnant | 073458b | 2011-10-17 20:05:10 | [diff] [blame] | 1268 | #endif |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1269 | |
Louis Dionne | 0a06eb9 | 2019-08-05 18:29:14 | [diff] [blame] | 1270 | #if defined(_LIBCPP_HAS_PARALLEL_ALGORITHMS) && _LIBCPP_STD_VER >= 17 |
Louis Dionne | 9568924 | 2019-08-06 21:11:24 | [diff] [blame] | 1271 | # include <__pstl_algorithm> |
Louis Dionne | 0a06eb9 | 2019-08-05 18:29:14 | [diff] [blame] | 1272 | #endif |
| 1273 | |
Louis Dionne | 4cd6ca1 | 2021-04-20 16:03:32 | [diff] [blame] | 1274 | #endif // _LIBCPP_ALGORITHM |