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