Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1 | // -*- C++ -*- |
Louis Dionne | 9bd9388 | 2021-11-17 16:25:01 -0500 | [diff] [blame] | 2 | //===----------------------------------------------------------------------===// |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 3 | // |
Chandler Carruth | d201210 | 2019-01-19 10:56:40 +0000 | [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 | c51e102 | 2010-05-11 19:42:16 +0000 | [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 | f74be4e | 2022-01-14 02:55:51 +0100 | [diff] [blame] | 21 | namespace ranges { |
Nikolas Klauser | 671b475 | 2022-02-11 17:01:58 +0100 | [diff] [blame] | 22 | template <class I, class F> |
Nikolas Klauser | 2e26316 | 2022-02-21 22:48:36 +0100 | [diff] [blame] | 23 | struct in_fun_result; // since C++20 |
Nikolas Klauser | 671b475 | 2022-02-11 17:01:58 +0100 | [diff] [blame] | 24 | |
Nikolas Klauser | f74be4e | 2022-01-14 02:55:51 +0100 | [diff] [blame] | 25 | template <class I1, class I2> |
Nikolas Klauser | 2e26316 | 2022-02-21 22:48:36 +0100 | [diff] [blame] | 26 | struct in_in_result; // since C++20 |
Nikolas Klauser | 05e2cd8 | 2022-01-25 11:21:47 +0100 | [diff] [blame] | 27 | |
| 28 | template <class I1, class I2, class O> |
Nikolas Klauser | 2e26316 | 2022-02-21 22:48:36 +0100 | [diff] [blame] | 29 | struct in_in_out_result; // since C++20 |
Nikolas Klauser | 61ce816 | 2022-02-03 02:17:03 +0100 | [diff] [blame] | 30 | |
| 31 | template <class I, class O1, class O2> |
| 32 | struct in_out_out_result; // since C++20 |
Nikolas Klauser | 671b475 | 2022-02-11 17:01:58 +0100 | [diff] [blame] | 33 | |
Nikolas Klauser | 2e26316 | 2022-02-21 22:48:36 +0100 | [diff] [blame] | 34 | template <class I1, class I2> |
| 35 | struct min_max_result; // since C++20 |
| 36 | |
Nikolas Klauser | dd5ad21 | 2022-02-21 23:07:02 +0100 | [diff] [blame] | 37 | template <class I> |
| 38 | struct in_found_result; // since C++20 |
| 39 | |
Nikolas Klauser | 0a62a17 | 2022-02-11 13:11:57 +0100 | [diff] [blame] | 40 | template<forward_iterator I, sentinel_for<I> S, class Proj = identity, |
| 41 | indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> // since C++20 |
| 42 | constexpr I min_element(I first, S last, Comp comp = {}, Proj proj = {}); |
| 43 | |
| 44 | template<forward_range R, class Proj = identity, |
| 45 | indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> // since C++20 |
| 46 | constexpr borrowed_iterator_t<R> min_element(R&& r, Comp comp = {}, Proj proj = {}); |
Nikolas Klauser | 12fc9bf | 2022-03-08 23:12:35 +0100 | [diff] [blame] | 47 | |
| 48 | template <input_iterator I1, sentinel_for<_I1> S1, input_iterator I2, sentinel_for<_I2> S2, |
| 49 | class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> |
| 50 | requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2> |
| 51 | constexpr mismatch_result<_I1, _I2> |
| 52 | mismatch()(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}) // since C++20 |
| 53 | |
| 54 | template <input_range R1, input_range R2, |
| 55 | class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> |
| 56 | requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2> |
| 57 | constexpr mismatch_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>> |
| 58 | mismatch(R1&& r1, R2&& r2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}) // since C++20 |
Nikolas Klauser | 37d076e | 2022-03-12 01:45:35 +0100 | [diff] [blame] | 59 | |
Nikolas Klauser | 37d076e | 2022-03-12 01:45:35 +0100 | [diff] [blame] | 60 | requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*> |
| 61 | constexpr I find(I first, S last, const T& value, Proj proj = {}); // since C++20 |
| 62 | |
| 63 | template<input_range R, class T, class Proj = identity> |
| 64 | requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*> |
| 65 | constexpr borrowed_iterator_t<R> |
| 66 | find(R&& r, const T& value, Proj proj = {}); // since C++20 |
| 67 | |
| 68 | template<input_iterator I, sentinel_for<I> S, class Proj = identity, |
| 69 | indirect_unary_predicate<projected<I, Proj>> Pred> |
| 70 | constexpr I find_if(I first, S last, Pred pred, Proj proj = {}); // since C++20 |
| 71 | |
| 72 | template<input_range R, class Proj = identity, |
| 73 | indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> |
| 74 | constexpr borrowed_iterator_t<R> |
| 75 | find_if(R&& r, Pred pred, Proj proj = {}); // since C++20 |
| 76 | |
| 77 | template<input_iterator I, sentinel_for<I> S, class Proj = identity, |
| 78 | indirect_unary_predicate<projected<I, Proj>> Pred> |
| 79 | constexpr I find_if_not(I first, S last, Pred pred, Proj proj = {}); // since C++20 |
| 80 | |
| 81 | template<input_range R, class Proj = identity, |
| 82 | indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> |
| 83 | constexpr borrowed_iterator_t<R> |
| 84 | find_if_not(R&& r, Pred pred, Proj proj = {}); // since C++20 |
Nikolas Klauser | 3559e45 | 2022-03-18 02:57:08 +0100 | [diff] [blame] | 85 | |
Nikolas Klauser | 573cd6f | 2022-04-03 09:17:01 +0200 | [diff] [blame] | 86 | template<class T, class Proj = identity, |
| 87 | indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less> |
| 88 | constexpr const T& min(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20 |
Nikolas Klauser | 3559e45 | 2022-03-18 02:57:08 +0100 | [diff] [blame] | 89 | |
Nikolas Klauser | 573cd6f | 2022-04-03 09:17:01 +0200 | [diff] [blame] | 90 | template<copyable T, class Proj = identity, |
| 91 | indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less> |
| 92 | constexpr T min(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20 |
Nikolas Klauser | 3559e45 | 2022-03-18 02:57:08 +0100 | [diff] [blame] | 93 | |
| 94 | template<input_range R, class Proj = identity, |
| 95 | indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> |
| 96 | requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*> |
| 97 | constexpr range_value_t<R> |
| 98 | min(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 |
Nikolas Klauser | 573cd6f | 2022-04-03 09:17:01 +0200 | [diff] [blame] | 99 | |
| 100 | template<class T, class Proj = identity, |
| 101 | indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less> |
| 102 | constexpr const T& max(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20 |
| 103 | |
| 104 | template<copyable T, class Proj = identity, |
| 105 | indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less> |
| 106 | constexpr T max(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20 |
| 107 | |
| 108 | template<input_range R, class Proj = identity, |
| 109 | indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> |
| 110 | requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*> |
| 111 | constexpr range_value_t<R> |
| 112 | max(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 |
Nikolas Klauser | 559a177 | 2022-04-05 11:05:36 +0200 | [diff] [blame] | 113 | |
| 114 | template<class I, class O> |
| 115 | using unary_transform_result = in_out_result<I, O>; // since C++20 |
| 116 | |
| 117 | template<class I1, class I2, class O> |
| 118 | using binary_transform_result = in_in_out_result<I1, I2, O>; // since C++20 |
| 119 | |
| 120 | template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, |
| 121 | copy_constructible F, class Proj = identity> |
| 122 | requires indirectly_writable<O, indirect_result_t<F&, projected<I, Proj>>> |
| 123 | constexpr ranges::unary_transform_result<I, O> |
| 124 | transform(I first1, S last1, O result, F op, Proj proj = {}); // since C++20 |
| 125 | |
| 126 | template<input_range R, weakly_incrementable O, copy_constructible F, |
| 127 | class Proj = identity> |
| 128 | requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R>, Proj>>> |
| 129 | constexpr ranges::unary_transform_result<borrowed_iterator_t<R>, O> |
| 130 | transform(R&& r, O result, F op, Proj proj = {}); // since C++20 |
| 131 | |
| 132 | template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, |
| 133 | weakly_incrementable O, copy_constructible F, class Proj1 = identity, |
| 134 | class Proj2 = identity> |
| 135 | requires indirectly_writable<O, indirect_result_t<F&, projected<I1, Proj1>, |
| 136 | projected<I2, Proj2>>> |
| 137 | constexpr ranges::binary_transform_result<I1, I2, O> |
| 138 | transform(I1 first1, S1 last1, I2 first2, S2 last2, O result, |
| 139 | F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 |
| 140 | |
| 141 | template<input_range R1, input_range R2, weakly_incrementable O, |
| 142 | copy_constructible F, class Proj1 = identity, class Proj2 = identity> |
| 143 | requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R1>, Proj1>, |
| 144 | projected<iterator_t<R2>, Proj2>>> |
| 145 | constexpr ranges::binary_transform_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O> |
| 146 | transform(R1&& r1, R2&& r2, O result, |
| 147 | F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 |
Nikolas Klauser | f74be4e | 2022-01-14 02:55:51 +0100 | [diff] [blame] | 148 | } |
| 149 | |
Marshall Clow | d607fdb | 2018-01-15 17:20:36 +0000 | [diff] [blame] | 150 | constexpr bool // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 151 | all_of(InputIterator first, InputIterator last, Predicate pred); |
| 152 | |
| 153 | template <class InputIterator, class Predicate> |
Marshall Clow | d607fdb | 2018-01-15 17:20:36 +0000 | [diff] [blame] | 154 | constexpr bool // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 155 | any_of(InputIterator first, InputIterator last, Predicate pred); |
| 156 | |
| 157 | template <class InputIterator, class Predicate> |
Marshall Clow | d607fdb | 2018-01-15 17:20:36 +0000 | [diff] [blame] | 158 | constexpr bool // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 159 | none_of(InputIterator first, InputIterator last, Predicate pred); |
| 160 | |
| 161 | template <class InputIterator, class Function> |
Marshall Clow | 5492c8a | 2018-01-22 20:44:33 +0000 | [diff] [blame] | 162 | constexpr Function // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 163 | for_each(InputIterator first, InputIterator last, Function f); |
| 164 | |
Marshall Clow | de0169c | 2017-05-25 02:29:54 +0000 | [diff] [blame] | 165 | template<class InputIterator, class Size, class Function> |
Marshall Clow | 5492c8a | 2018-01-22 20:44:33 +0000 | [diff] [blame] | 166 | constexpr InputIterator // constexpr in C++20 |
| 167 | for_each_n(InputIterator first, Size n, Function f); // C++17 |
Marshall Clow | de0169c | 2017-05-25 02:29:54 +0000 | [diff] [blame] | 168 | |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 169 | template <class InputIterator, class T> |
Marshall Clow | ee0161e | 2018-01-15 19:26:05 +0000 | [diff] [blame] | 170 | constexpr InputIterator // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 171 | find(InputIterator first, InputIterator last, const T& value); |
| 172 | |
| 173 | template <class InputIterator, class Predicate> |
Marshall Clow | ee0161e | 2018-01-15 19:26:05 +0000 | [diff] [blame] | 174 | constexpr InputIterator // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 175 | find_if(InputIterator first, InputIterator last, Predicate pred); |
| 176 | |
| 177 | template<class InputIterator, class Predicate> |
Arthur O'Dwyer | 20353a7 | 2020-12-02 20:02:18 -0500 | [diff] [blame] | 178 | constexpr InputIterator // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 179 | find_if_not(InputIterator first, InputIterator last, Predicate pred); |
| 180 | |
| 181 | template <class ForwardIterator1, class ForwardIterator2> |
Arthur O'Dwyer | 20353a7 | 2020-12-02 20:02:18 -0500 | [diff] [blame] | 182 | constexpr ForwardIterator1 // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 183 | find_end(ForwardIterator1 first1, ForwardIterator1 last1, |
| 184 | ForwardIterator2 first2, ForwardIterator2 last2); |
| 185 | |
| 186 | template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate> |
Arthur O'Dwyer | 20353a7 | 2020-12-02 20:02:18 -0500 | [diff] [blame] | 187 | constexpr ForwardIterator1 // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 188 | find_end(ForwardIterator1 first1, ForwardIterator1 last1, |
| 189 | ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred); |
| 190 | |
| 191 | template <class ForwardIterator1, class ForwardIterator2> |
Marshall Clow | ee0161e | 2018-01-15 19:26:05 +0000 | [diff] [blame] | 192 | constexpr ForwardIterator1 // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 193 | find_first_of(ForwardIterator1 first1, ForwardIterator1 last1, |
| 194 | ForwardIterator2 first2, ForwardIterator2 last2); |
| 195 | |
| 196 | template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate> |
Marshall Clow | ee0161e | 2018-01-15 19:26:05 +0000 | [diff] [blame] | 197 | constexpr ForwardIterator1 // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 198 | find_first_of(ForwardIterator1 first1, ForwardIterator1 last1, |
| 199 | ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred); |
| 200 | |
| 201 | template <class ForwardIterator> |
Marshall Clow | ee0161e | 2018-01-15 19:26:05 +0000 | [diff] [blame] | 202 | constexpr ForwardIterator // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 203 | adjacent_find(ForwardIterator first, ForwardIterator last); |
| 204 | |
| 205 | template <class ForwardIterator, class BinaryPredicate> |
Marshall Clow | ee0161e | 2018-01-15 19:26:05 +0000 | [diff] [blame] | 206 | constexpr ForwardIterator // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 207 | adjacent_find(ForwardIterator first, ForwardIterator last, BinaryPredicate pred); |
| 208 | |
| 209 | template <class InputIterator, class T> |
Marshall Clow | 3c0558f | 2018-01-15 19:40:34 +0000 | [diff] [blame] | 210 | constexpr typename iterator_traits<InputIterator>::difference_type // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 211 | count(InputIterator first, InputIterator last, const T& value); |
| 212 | |
| 213 | template <class InputIterator, class Predicate> |
Marshall Clow | 3c0558f | 2018-01-15 19:40:34 +0000 | [diff] [blame] | 214 | constexpr typename iterator_traits<InputIterator>::difference_type // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 215 | count_if(InputIterator first, InputIterator last, Predicate pred); |
| 216 | |
| 217 | template <class InputIterator1, class InputIterator2> |
Marshall Clow | 30bf302 | 2018-01-16 02:04:10 +0000 | [diff] [blame] | 218 | constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 219 | mismatch(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2); |
| 220 | |
Marshall Clow | 96b42b2 | 2013-05-09 21:14:23 +0000 | [diff] [blame] | 221 | template <class InputIterator1, class InputIterator2> |
Marshall Clow | 30bf302 | 2018-01-16 02:04:10 +0000 | [diff] [blame] | 222 | constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20 |
Aditya Kumar | 3a0179a | 2016-08-25 11:52:38 +0000 | [diff] [blame] | 223 | mismatch(InputIterator1 first1, InputIterator1 last1, |
Marshall Clow | 96b42b2 | 2013-05-09 21:14:23 +0000 | [diff] [blame] | 224 | InputIterator2 first2, InputIterator2 last2); // **C++14** |
| 225 | |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 226 | template <class InputIterator1, class InputIterator2, class BinaryPredicate> |
Marshall Clow | 30bf302 | 2018-01-16 02:04:10 +0000 | [diff] [blame] | 227 | constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 228 | mismatch(InputIterator1 first1, InputIterator1 last1, |
| 229 | InputIterator2 first2, BinaryPredicate pred); |
| 230 | |
Marshall Clow | 96b42b2 | 2013-05-09 21:14:23 +0000 | [diff] [blame] | 231 | template <class InputIterator1, class InputIterator2, class BinaryPredicate> |
Marshall Clow | 30bf302 | 2018-01-16 02:04:10 +0000 | [diff] [blame] | 232 | constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20 |
Marshall Clow | 96b42b2 | 2013-05-09 21:14:23 +0000 | [diff] [blame] | 233 | mismatch(InputIterator1 first1, InputIterator1 last1, |
| 234 | InputIterator2 first2, InputIterator2 last2, |
| 235 | BinaryPredicate pred); // **C++14** |
| 236 | |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 237 | template <class InputIterator1, class InputIterator2> |
Marshall Clow | 30bf302 | 2018-01-16 02:04:10 +0000 | [diff] [blame] | 238 | constexpr bool // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 239 | equal(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2); |
| 240 | |
Marshall Clow | 96b42b2 | 2013-05-09 21:14:23 +0000 | [diff] [blame] | 241 | template <class InputIterator1, class InputIterator2> |
Marshall Clow | 30bf302 | 2018-01-16 02:04:10 +0000 | [diff] [blame] | 242 | constexpr bool // constexpr in C++20 |
Aditya Kumar | 3a0179a | 2016-08-25 11:52:38 +0000 | [diff] [blame] | 243 | equal(InputIterator1 first1, InputIterator1 last1, |
Marshall Clow | 96b42b2 | 2013-05-09 21:14:23 +0000 | [diff] [blame] | 244 | InputIterator2 first2, InputIterator2 last2); // **C++14** |
| 245 | |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 246 | template <class InputIterator1, class InputIterator2, class BinaryPredicate> |
Marshall Clow | 30bf302 | 2018-01-16 02:04:10 +0000 | [diff] [blame] | 247 | constexpr bool // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 248 | equal(InputIterator1 first1, InputIterator1 last1, |
| 249 | InputIterator2 first2, BinaryPredicate pred); |
| 250 | |
Marshall Clow | 96b42b2 | 2013-05-09 21:14:23 +0000 | [diff] [blame] | 251 | template <class InputIterator1, class InputIterator2, class BinaryPredicate> |
Marshall Clow | 30bf302 | 2018-01-16 02:04:10 +0000 | [diff] [blame] | 252 | constexpr bool // constexpr in C++20 |
Marshall Clow | 96b42b2 | 2013-05-09 21:14:23 +0000 | [diff] [blame] | 253 | equal(InputIterator1 first1, InputIterator1 last1, |
| 254 | InputIterator2 first2, InputIterator2 last2, |
| 255 | BinaryPredicate pred); // **C++14** |
| 256 | |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 257 | template<class ForwardIterator1, class ForwardIterator2> |
Marshall Clow | 96d050a | 2018-01-15 16:16:32 +0000 | [diff] [blame] | 258 | constexpr bool // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 259 | is_permutation(ForwardIterator1 first1, ForwardIterator1 last1, |
| 260 | ForwardIterator2 first2); |
| 261 | |
Marshall Clow | 96b42b2 | 2013-05-09 21:14:23 +0000 | [diff] [blame] | 262 | template<class ForwardIterator1, class ForwardIterator2> |
Marshall Clow | 96d050a | 2018-01-15 16:16:32 +0000 | [diff] [blame] | 263 | constexpr bool // constexpr in C++20 |
Marshall Clow | 96b42b2 | 2013-05-09 21:14:23 +0000 | [diff] [blame] | 264 | is_permutation(ForwardIterator1 first1, ForwardIterator1 last1, |
| 265 | ForwardIterator2 first2, ForwardIterator2 last2); // **C++14** |
| 266 | |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 267 | template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate> |
Marshall Clow | 96d050a | 2018-01-15 16:16:32 +0000 | [diff] [blame] | 268 | constexpr bool // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 269 | is_permutation(ForwardIterator1 first1, ForwardIterator1 last1, |
| 270 | ForwardIterator2 first2, BinaryPredicate pred); |
| 271 | |
Marshall Clow | 96b42b2 | 2013-05-09 21:14:23 +0000 | [diff] [blame] | 272 | template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate> |
Marshall Clow | 96d050a | 2018-01-15 16:16:32 +0000 | [diff] [blame] | 273 | constexpr bool // constexpr in C++20 |
Marshall Clow | 96b42b2 | 2013-05-09 21:14:23 +0000 | [diff] [blame] | 274 | is_permutation(ForwardIterator1 first1, ForwardIterator1 last1, |
| 275 | ForwardIterator2 first2, ForwardIterator2 last2, |
| 276 | BinaryPredicate pred); // **C++14** |
| 277 | |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 278 | template <class ForwardIterator1, class ForwardIterator2> |
Marshall Clow | 323fc5b | 2018-01-16 15:48:27 +0000 | [diff] [blame] | 279 | constexpr ForwardIterator1 // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 280 | search(ForwardIterator1 first1, ForwardIterator1 last1, |
| 281 | ForwardIterator2 first2, ForwardIterator2 last2); |
| 282 | |
| 283 | template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate> |
Marshall Clow | 323fc5b | 2018-01-16 15:48:27 +0000 | [diff] [blame] | 284 | constexpr ForwardIterator1 // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 285 | search(ForwardIterator1 first1, ForwardIterator1 last1, |
| 286 | ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred); |
| 287 | |
| 288 | template <class ForwardIterator, class Size, class T> |
Marshall Clow | 323fc5b | 2018-01-16 15:48:27 +0000 | [diff] [blame] | 289 | constexpr ForwardIterator // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 290 | search_n(ForwardIterator first, ForwardIterator last, Size count, const T& value); |
| 291 | |
| 292 | template <class ForwardIterator, class Size, class T, class BinaryPredicate> |
Marshall Clow | 323fc5b | 2018-01-16 15:48:27 +0000 | [diff] [blame] | 293 | constexpr ForwardIterator // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 294 | search_n(ForwardIterator first, ForwardIterator last, |
| 295 | Size count, const T& value, BinaryPredicate pred); |
| 296 | |
| 297 | template <class InputIterator, class OutputIterator> |
Louis Dionne | 65b433b | 2019-11-06 12:02:41 +0000 | [diff] [blame] | 298 | constexpr OutputIterator // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 299 | copy(InputIterator first, InputIterator last, OutputIterator result); |
| 300 | |
| 301 | template<class InputIterator, class OutputIterator, class Predicate> |
Louis Dionne | 65b433b | 2019-11-06 12:02:41 +0000 | [diff] [blame] | 302 | constexpr OutputIterator // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 303 | copy_if(InputIterator first, InputIterator last, |
| 304 | OutputIterator result, Predicate pred); |
| 305 | |
| 306 | template<class InputIterator, class Size, class OutputIterator> |
Louis Dionne | 65b433b | 2019-11-06 12:02:41 +0000 | [diff] [blame] | 307 | constexpr OutputIterator // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 308 | copy_n(InputIterator first, Size n, OutputIterator result); |
| 309 | |
| 310 | template <class BidirectionalIterator1, class BidirectionalIterator2> |
Louis Dionne | 65b433b | 2019-11-06 12:02:41 +0000 | [diff] [blame] | 311 | constexpr BidirectionalIterator2 // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 312 | copy_backward(BidirectionalIterator1 first, BidirectionalIterator1 last, |
| 313 | BidirectionalIterator2 result); |
| 314 | |
| 315 | template <class ForwardIterator1, class ForwardIterator2> |
Arthur O'Dwyer | 20353a7 | 2020-12-02 20:02:18 -0500 | [diff] [blame] | 316 | constexpr ForwardIterator2 // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 317 | swap_ranges(ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2); |
| 318 | |
Nikolas Klauser | 4ceab5f | 2022-02-10 13:33:03 +0100 | [diff] [blame] | 319 | template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2> |
| 320 | requires indirectly_swappable<I1, I2> |
| 321 | constexpr ranges::swap_ranges_result<I1, I2> |
| 322 | ranges::swap_ranges(I1 first1, S1 last1, I2 first2, S2 last2); |
| 323 | |
| 324 | template<input_range R1, input_range R2> |
| 325 | requires indirectly_swappable<iterator_t<R1>, iterator_t<R2>> |
| 326 | constexpr ranges::swap_ranges_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>> |
| 327 | ranges::swap_ranges(R1&& r1, R2&& r2); |
| 328 | |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 329 | template <class ForwardIterator1, class ForwardIterator2> |
Arthur O'Dwyer | 20353a7 | 2020-12-02 20:02:18 -0500 | [diff] [blame] | 330 | constexpr void // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 331 | iter_swap(ForwardIterator1 a, ForwardIterator2 b); |
| 332 | |
| 333 | template <class InputIterator, class OutputIterator, class UnaryOperation> |
Marshall Clow | 31427c6 | 2018-01-19 17:45:39 +0000 | [diff] [blame] | 334 | constexpr OutputIterator // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 335 | transform(InputIterator first, InputIterator last, OutputIterator result, UnaryOperation op); |
| 336 | |
| 337 | template <class InputIterator1, class InputIterator2, class OutputIterator, class BinaryOperation> |
Marshall Clow | 31427c6 | 2018-01-19 17:45:39 +0000 | [diff] [blame] | 338 | constexpr OutputIterator // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 339 | transform(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, |
| 340 | OutputIterator result, BinaryOperation binary_op); |
| 341 | |
| 342 | template <class ForwardIterator, class T> |
Marshall Clow | 01bbbd2 | 2018-01-19 18:07:29 +0000 | [diff] [blame] | 343 | constexpr void // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 344 | replace(ForwardIterator first, ForwardIterator last, const T& old_value, const T& new_value); |
| 345 | |
| 346 | template <class ForwardIterator, class Predicate, class T> |
Marshall Clow | 01bbbd2 | 2018-01-19 18:07:29 +0000 | [diff] [blame] | 347 | constexpr void // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 348 | replace_if(ForwardIterator first, ForwardIterator last, Predicate pred, const T& new_value); |
| 349 | |
| 350 | template <class InputIterator, class OutputIterator, class T> |
Marshall Clow | 01bbbd2 | 2018-01-19 18:07:29 +0000 | [diff] [blame] | 351 | constexpr OutputIterator // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 352 | replace_copy(InputIterator first, InputIterator last, OutputIterator result, |
| 353 | const T& old_value, const T& new_value); |
| 354 | |
| 355 | template <class InputIterator, class OutputIterator, class Predicate, class T> |
Marshall Clow | 01bbbd2 | 2018-01-19 18:07:29 +0000 | [diff] [blame] | 356 | constexpr OutputIterator // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 357 | replace_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred, const T& new_value); |
| 358 | |
| 359 | template <class ForwardIterator, class T> |
Marshall Clow | e9cdc5c | 2018-01-20 20:14:32 +0000 | [diff] [blame] | 360 | constexpr void // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 361 | fill(ForwardIterator first, ForwardIterator last, const T& value); |
| 362 | |
| 363 | template <class OutputIterator, class Size, class T> |
Marshall Clow | e9cdc5c | 2018-01-20 20:14:32 +0000 | [diff] [blame] | 364 | constexpr OutputIterator // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 365 | fill_n(OutputIterator first, Size n, const T& value); |
| 366 | |
| 367 | template <class ForwardIterator, class Generator> |
Marshall Clow | e9cdc5c | 2018-01-20 20:14:32 +0000 | [diff] [blame] | 368 | constexpr void // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 369 | generate(ForwardIterator first, ForwardIterator last, Generator gen); |
| 370 | |
| 371 | template <class OutputIterator, class Size, class Generator> |
Marshall Clow | e9cdc5c | 2018-01-20 20:14:32 +0000 | [diff] [blame] | 372 | constexpr OutputIterator // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 373 | generate_n(OutputIterator first, Size n, Generator gen); |
| 374 | |
| 375 | template <class ForwardIterator, class T> |
Marshall Clow | 7c0fbd8 | 2018-01-22 21:43:04 +0000 | [diff] [blame] | 376 | constexpr ForwardIterator // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 377 | remove(ForwardIterator first, ForwardIterator last, const T& value); |
| 378 | |
| 379 | template <class ForwardIterator, class Predicate> |
Marshall Clow | 7c0fbd8 | 2018-01-22 21:43:04 +0000 | [diff] [blame] | 380 | constexpr ForwardIterator // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 381 | remove_if(ForwardIterator first, ForwardIterator last, Predicate pred); |
| 382 | |
| 383 | template <class InputIterator, class OutputIterator, class T> |
Marshall Clow | 7c0fbd8 | 2018-01-22 21:43:04 +0000 | [diff] [blame] | 384 | constexpr OutputIterator // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 385 | remove_copy(InputIterator first, InputIterator last, OutputIterator result, const T& value); |
| 386 | |
| 387 | template <class InputIterator, class OutputIterator, class Predicate> |
Marshall Clow | 7c0fbd8 | 2018-01-22 21:43:04 +0000 | [diff] [blame] | 388 | constexpr OutputIterator // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 389 | remove_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred); |
| 390 | |
| 391 | template <class ForwardIterator> |
Arthur O'Dwyer | 20353a7 | 2020-12-02 20:02:18 -0500 | [diff] [blame] | 392 | constexpr ForwardIterator // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 393 | unique(ForwardIterator first, ForwardIterator last); |
| 394 | |
| 395 | template <class ForwardIterator, class BinaryPredicate> |
Arthur O'Dwyer | 20353a7 | 2020-12-02 20:02:18 -0500 | [diff] [blame] | 396 | constexpr ForwardIterator // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 397 | unique(ForwardIterator first, ForwardIterator last, BinaryPredicate pred); |
| 398 | |
| 399 | template <class InputIterator, class OutputIterator> |
Arthur O'Dwyer | 20353a7 | 2020-12-02 20:02:18 -0500 | [diff] [blame] | 400 | constexpr OutputIterator // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 401 | unique_copy(InputIterator first, InputIterator last, OutputIterator result); |
| 402 | |
| 403 | template <class InputIterator, class OutputIterator, class BinaryPredicate> |
Arthur O'Dwyer | 20353a7 | 2020-12-02 20:02:18 -0500 | [diff] [blame] | 404 | constexpr OutputIterator // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 405 | unique_copy(InputIterator first, InputIterator last, OutputIterator result, BinaryPredicate pred); |
| 406 | |
| 407 | template <class BidirectionalIterator> |
Arthur O'Dwyer | e50e747 | 2020-12-17 00:01:08 -0500 | [diff] [blame] | 408 | constexpr void // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 409 | reverse(BidirectionalIterator first, BidirectionalIterator last); |
| 410 | |
| 411 | template <class BidirectionalIterator, class OutputIterator> |
Marshall Clow | 7c0fbd8 | 2018-01-22 21:43:04 +0000 | [diff] [blame] | 412 | constexpr OutputIterator // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 413 | reverse_copy(BidirectionalIterator first, BidirectionalIterator last, OutputIterator result); |
| 414 | |
| 415 | template <class ForwardIterator> |
Arthur O'Dwyer | 20353a7 | 2020-12-02 20:02:18 -0500 | [diff] [blame] | 416 | constexpr ForwardIterator // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 417 | rotate(ForwardIterator first, ForwardIterator middle, ForwardIterator last); |
| 418 | |
| 419 | template <class ForwardIterator, class OutputIterator> |
Arthur O'Dwyer | 20353a7 | 2020-12-02 20:02:18 -0500 | [diff] [blame] | 420 | constexpr OutputIterator // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 421 | rotate_copy(ForwardIterator first, ForwardIterator middle, ForwardIterator last, OutputIterator result); |
| 422 | |
| 423 | template <class RandomAccessIterator> |
| 424 | void |
Marshall Clow | fac06e5 | 2017-03-23 13:43:37 +0000 | [diff] [blame] | 425 | random_shuffle(RandomAccessIterator first, RandomAccessIterator last); // deprecated in C++14, removed in C++17 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 426 | |
| 427 | template <class RandomAccessIterator, class RandomNumberGenerator> |
| 428 | void |
Marshall Clow | 83f3539 | 2014-03-03 06:14:19 +0000 | [diff] [blame] | 429 | random_shuffle(RandomAccessIterator first, RandomAccessIterator last, |
Marshall Clow | fac06e5 | 2017-03-23 13:43:37 +0000 | [diff] [blame] | 430 | RandomNumberGenerator& rand); // deprecated in C++14, removed in C++17 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 431 | |
Eric Fiselier | 1208fcd | 2016-08-28 22:14:37 +0000 | [diff] [blame] | 432 | template<class PopulationIterator, class SampleIterator, |
| 433 | class Distance, class UniformRandomBitGenerator> |
| 434 | SampleIterator sample(PopulationIterator first, PopulationIterator last, |
| 435 | SampleIterator out, Distance n, |
| 436 | UniformRandomBitGenerator&& g); // C++17 |
| 437 | |
Howard Hinnant | 578ac0f | 2010-05-26 17:49:34 +0000 | [diff] [blame] | 438 | template<class RandomAccessIterator, class UniformRandomNumberGenerator> |
| 439 | void shuffle(RandomAccessIterator first, RandomAccessIterator last, |
Howard Hinnant | a5e7178 | 2010-11-18 01:47:02 +0000 | [diff] [blame] | 440 | UniformRandomNumberGenerator&& g); |
Howard Hinnant | 578ac0f | 2010-05-26 17:49:34 +0000 | [diff] [blame] | 441 | |
Arthur O'Dwyer | cea050d | 2020-12-26 01:39:03 -0500 | [diff] [blame] | 442 | template<class ForwardIterator> |
| 443 | constexpr ForwardIterator |
| 444 | shift_left(ForwardIterator first, ForwardIterator last, |
| 445 | typename iterator_traits<ForwardIterator>::difference_type n); // C++20 |
| 446 | |
| 447 | template<class ForwardIterator> |
| 448 | constexpr ForwardIterator |
| 449 | shift_right(ForwardIterator first, ForwardIterator last, |
| 450 | typename iterator_traits<ForwardIterator>::difference_type n); // C++20 |
| 451 | |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 452 | template <class InputIterator, class Predicate> |
Marshall Clow | 96d050a | 2018-01-15 16:16:32 +0000 | [diff] [blame] | 453 | constexpr bool // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 454 | is_partitioned(InputIterator first, InputIterator last, Predicate pred); |
| 455 | |
| 456 | template <class ForwardIterator, class Predicate> |
Arthur O'Dwyer | e50e747 | 2020-12-17 00:01:08 -0500 | [diff] [blame] | 457 | constexpr ForwardIterator // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 458 | partition(ForwardIterator first, ForwardIterator last, Predicate pred); |
| 459 | |
| 460 | template <class InputIterator, class OutputIterator1, |
| 461 | class OutputIterator2, class Predicate> |
Marshall Clow | 5492c8a | 2018-01-22 20:44:33 +0000 | [diff] [blame] | 462 | constexpr pair<OutputIterator1, OutputIterator2> // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 463 | partition_copy(InputIterator first, InputIterator last, |
| 464 | OutputIterator1 out_true, OutputIterator2 out_false, |
| 465 | Predicate pred); |
| 466 | |
| 467 | template <class ForwardIterator, class Predicate> |
| 468 | ForwardIterator |
| 469 | stable_partition(ForwardIterator first, ForwardIterator last, Predicate pred); |
| 470 | |
| 471 | template<class ForwardIterator, class Predicate> |
Marshall Clow | e00916c | 2018-01-16 02:34:41 +0000 | [diff] [blame] | 472 | constexpr ForwardIterator // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 473 | partition_point(ForwardIterator first, ForwardIterator last, Predicate pred); |
| 474 | |
| 475 | template <class ForwardIterator> |
Marshall Clow | 96d050a | 2018-01-15 16:16:32 +0000 | [diff] [blame] | 476 | constexpr bool // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 477 | is_sorted(ForwardIterator first, ForwardIterator last); |
| 478 | |
| 479 | template <class ForwardIterator, class Compare> |
Arthur O'Dwyer | 20353a7 | 2020-12-02 20:02:18 -0500 | [diff] [blame] | 480 | constexpr bool // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 481 | is_sorted(ForwardIterator first, ForwardIterator last, Compare comp); |
| 482 | |
| 483 | template<class ForwardIterator> |
Marshall Clow | 3c0558f | 2018-01-15 19:40:34 +0000 | [diff] [blame] | 484 | constexpr ForwardIterator // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 485 | is_sorted_until(ForwardIterator first, ForwardIterator last); |
| 486 | |
| 487 | template <class ForwardIterator, class Compare> |
Marshall Clow | 3c0558f | 2018-01-15 19:40:34 +0000 | [diff] [blame] | 488 | constexpr ForwardIterator // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 489 | is_sorted_until(ForwardIterator first, ForwardIterator last, Compare comp); |
| 490 | |
| 491 | template <class RandomAccessIterator> |
Arthur O'Dwyer | 1bb0f67 | 2020-12-20 15:21:42 -0500 | [diff] [blame] | 492 | constexpr void // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 493 | sort(RandomAccessIterator first, RandomAccessIterator last); |
| 494 | |
| 495 | template <class RandomAccessIterator, class Compare> |
Arthur O'Dwyer | 1bb0f67 | 2020-12-20 15:21:42 -0500 | [diff] [blame] | 496 | constexpr void // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 497 | sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp); |
| 498 | |
| 499 | template <class RandomAccessIterator> |
| 500 | void |
| 501 | stable_sort(RandomAccessIterator first, RandomAccessIterator last); |
| 502 | |
| 503 | template <class RandomAccessIterator, class Compare> |
| 504 | void |
| 505 | stable_sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp); |
| 506 | |
| 507 | template <class RandomAccessIterator> |
Arthur O'Dwyer | 2dfea5d | 2020-12-17 00:26:18 -0500 | [diff] [blame] | 508 | constexpr void // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 509 | partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last); |
| 510 | |
| 511 | template <class RandomAccessIterator, class Compare> |
Arthur O'Dwyer | 2dfea5d | 2020-12-17 00:26:18 -0500 | [diff] [blame] | 512 | constexpr void // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 513 | partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last, Compare comp); |
| 514 | |
| 515 | template <class InputIterator, class RandomAccessIterator> |
Arthur O'Dwyer | 2dfea5d | 2020-12-17 00:26:18 -0500 | [diff] [blame] | 516 | constexpr RandomAccessIterator // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 517 | partial_sort_copy(InputIterator first, InputIterator last, |
| 518 | RandomAccessIterator result_first, RandomAccessIterator result_last); |
| 519 | |
| 520 | template <class InputIterator, class RandomAccessIterator, class Compare> |
Arthur O'Dwyer | 2dfea5d | 2020-12-17 00:26:18 -0500 | [diff] [blame] | 521 | constexpr RandomAccessIterator // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 522 | partial_sort_copy(InputIterator first, InputIterator last, |
| 523 | RandomAccessIterator result_first, RandomAccessIterator result_last, Compare comp); |
| 524 | |
| 525 | template <class RandomAccessIterator> |
Arthur O'Dwyer | 4f5717b | 2021-02-04 18:12:52 -0500 | [diff] [blame] | 526 | constexpr void // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 527 | nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last); |
| 528 | |
| 529 | template <class RandomAccessIterator, class Compare> |
Arthur O'Dwyer | 4f5717b | 2021-02-04 18:12:52 -0500 | [diff] [blame] | 530 | constexpr void // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 531 | nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last, Compare comp); |
| 532 | |
| 533 | template <class ForwardIterator, class T> |
Marshall Clow | e00916c | 2018-01-16 02:34:41 +0000 | [diff] [blame] | 534 | constexpr ForwardIterator // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 535 | lower_bound(ForwardIterator first, ForwardIterator last, const T& value); |
| 536 | |
| 537 | template <class ForwardIterator, class T, class Compare> |
Marshall Clow | e00916c | 2018-01-16 02:34:41 +0000 | [diff] [blame] | 538 | constexpr ForwardIterator // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 539 | lower_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp); |
| 540 | |
| 541 | template <class ForwardIterator, class T> |
Marshall Clow | e00916c | 2018-01-16 02:34:41 +0000 | [diff] [blame] | 542 | constexpr ForwardIterator // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 543 | upper_bound(ForwardIterator first, ForwardIterator last, const T& value); |
| 544 | |
| 545 | template <class ForwardIterator, class T, class Compare> |
Marshall Clow | e00916c | 2018-01-16 02:34:41 +0000 | [diff] [blame] | 546 | constexpr ForwardIterator // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 547 | upper_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp); |
| 548 | |
| 549 | template <class ForwardIterator, class T> |
Marshall Clow | e00916c | 2018-01-16 02:34:41 +0000 | [diff] [blame] | 550 | constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 551 | equal_range(ForwardIterator first, ForwardIterator last, const T& value); |
| 552 | |
| 553 | template <class ForwardIterator, class T, class Compare> |
Marshall Clow | e00916c | 2018-01-16 02:34:41 +0000 | [diff] [blame] | 554 | constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 555 | equal_range(ForwardIterator first, ForwardIterator last, const T& value, Compare comp); |
| 556 | |
| 557 | template <class ForwardIterator, class T> |
Marshall Clow | e00916c | 2018-01-16 02:34:41 +0000 | [diff] [blame] | 558 | constexpr bool // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 559 | binary_search(ForwardIterator first, ForwardIterator last, const T& value); |
| 560 | |
| 561 | template <class ForwardIterator, class T, class Compare> |
Marshall Clow | c0b7f97 | 2018-01-22 23:10:40 +0000 | [diff] [blame] | 562 | constexpr bool // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 563 | binary_search(ForwardIterator first, ForwardIterator last, const T& value, Compare comp); |
| 564 | |
| 565 | template <class InputIterator1, class InputIterator2, class OutputIterator> |
Arthur O'Dwyer | 5afc569 | 2020-12-04 13:47:12 -0500 | [diff] [blame] | 566 | constexpr OutputIterator // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 567 | merge(InputIterator1 first1, InputIterator1 last1, |
| 568 | InputIterator2 first2, InputIterator2 last2, OutputIterator result); |
| 569 | |
| 570 | template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare> |
Arthur O'Dwyer | 5afc569 | 2020-12-04 13:47:12 -0500 | [diff] [blame] | 571 | constexpr OutputIterator // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 572 | merge(InputIterator1 first1, InputIterator1 last1, |
| 573 | InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp); |
| 574 | |
| 575 | template <class BidirectionalIterator> |
| 576 | void |
| 577 | inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last); |
| 578 | |
| 579 | template <class BidirectionalIterator, class Compare> |
| 580 | void |
| 581 | inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last, Compare comp); |
| 582 | |
| 583 | template <class InputIterator1, class InputIterator2> |
Marshall Clow | c0b7f97 | 2018-01-22 23:10:40 +0000 | [diff] [blame] | 584 | constexpr bool // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 585 | includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2); |
| 586 | |
| 587 | template <class InputIterator1, class InputIterator2, class Compare> |
Marshall Clow | c0b7f97 | 2018-01-22 23:10:40 +0000 | [diff] [blame] | 588 | constexpr bool // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 589 | includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, Compare comp); |
| 590 | |
| 591 | template <class InputIterator1, class InputIterator2, class OutputIterator> |
Arthur O'Dwyer | 5afc569 | 2020-12-04 13:47:12 -0500 | [diff] [blame] | 592 | constexpr OutputIterator // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 593 | set_union(InputIterator1 first1, InputIterator1 last1, |
| 594 | InputIterator2 first2, InputIterator2 last2, OutputIterator result); |
| 595 | |
| 596 | template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare> |
Arthur O'Dwyer | 5afc569 | 2020-12-04 13:47:12 -0500 | [diff] [blame] | 597 | constexpr OutputIterator // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 598 | set_union(InputIterator1 first1, InputIterator1 last1, |
| 599 | InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp); |
| 600 | |
| 601 | template <class InputIterator1, class InputIterator2, class OutputIterator> |
Marshall Clow | c0b7f97 | 2018-01-22 23:10:40 +0000 | [diff] [blame] | 602 | constexpr OutputIterator // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 603 | set_intersection(InputIterator1 first1, InputIterator1 last1, |
| 604 | InputIterator2 first2, InputIterator2 last2, OutputIterator result); |
| 605 | |
| 606 | template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare> |
Marshall Clow | c0b7f97 | 2018-01-22 23:10:40 +0000 | [diff] [blame] | 607 | constexpr OutputIterator // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 608 | set_intersection(InputIterator1 first1, InputIterator1 last1, |
| 609 | InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp); |
| 610 | |
| 611 | template <class InputIterator1, class InputIterator2, class OutputIterator> |
Arthur O'Dwyer | 5afc569 | 2020-12-04 13:47:12 -0500 | [diff] [blame] | 612 | constexpr OutputIterator // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 613 | set_difference(InputIterator1 first1, InputIterator1 last1, |
| 614 | InputIterator2 first2, InputIterator2 last2, OutputIterator result); |
| 615 | |
| 616 | template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare> |
Arthur O'Dwyer | 5afc569 | 2020-12-04 13:47:12 -0500 | [diff] [blame] | 617 | constexpr OutputIterator // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 618 | set_difference(InputIterator1 first1, InputIterator1 last1, |
| 619 | InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp); |
| 620 | |
| 621 | template <class InputIterator1, class InputIterator2, class OutputIterator> |
Arthur O'Dwyer | 5afc569 | 2020-12-04 13:47:12 -0500 | [diff] [blame] | 622 | constexpr OutputIterator // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 623 | set_symmetric_difference(InputIterator1 first1, InputIterator1 last1, |
| 624 | InputIterator2 first2, InputIterator2 last2, OutputIterator result); |
| 625 | |
| 626 | template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare> |
Arthur O'Dwyer | 5afc569 | 2020-12-04 13:47:12 -0500 | [diff] [blame] | 627 | constexpr OutputIterator // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 628 | set_symmetric_difference(InputIterator1 first1, InputIterator1 last1, |
| 629 | InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp); |
| 630 | |
| 631 | template <class RandomAccessIterator> |
Arthur O'Dwyer | 2dfea5d | 2020-12-17 00:26:18 -0500 | [diff] [blame] | 632 | constexpr void // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 633 | push_heap(RandomAccessIterator first, RandomAccessIterator last); |
| 634 | |
| 635 | template <class RandomAccessIterator, class Compare> |
Arthur O'Dwyer | 2dfea5d | 2020-12-17 00:26:18 -0500 | [diff] [blame] | 636 | constexpr void // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 637 | push_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp); |
| 638 | |
| 639 | template <class RandomAccessIterator> |
Arthur O'Dwyer | 2dfea5d | 2020-12-17 00:26:18 -0500 | [diff] [blame] | 640 | constexpr void // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 641 | pop_heap(RandomAccessIterator first, RandomAccessIterator last); |
| 642 | |
| 643 | template <class RandomAccessIterator, class Compare> |
Arthur O'Dwyer | 2dfea5d | 2020-12-17 00:26:18 -0500 | [diff] [blame] | 644 | constexpr void // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 645 | pop_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp); |
| 646 | |
| 647 | template <class RandomAccessIterator> |
Arthur O'Dwyer | 2dfea5d | 2020-12-17 00:26:18 -0500 | [diff] [blame] | 648 | constexpr void // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 649 | make_heap(RandomAccessIterator first, RandomAccessIterator last); |
| 650 | |
| 651 | template <class RandomAccessIterator, class Compare> |
Arthur O'Dwyer | 2dfea5d | 2020-12-17 00:26:18 -0500 | [diff] [blame] | 652 | constexpr void // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 653 | make_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp); |
| 654 | |
| 655 | template <class RandomAccessIterator> |
Arthur O'Dwyer | 2dfea5d | 2020-12-17 00:26:18 -0500 | [diff] [blame] | 656 | constexpr void // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 657 | sort_heap(RandomAccessIterator first, RandomAccessIterator last); |
| 658 | |
| 659 | template <class RandomAccessIterator, class Compare> |
Arthur O'Dwyer | 2dfea5d | 2020-12-17 00:26:18 -0500 | [diff] [blame] | 660 | constexpr void // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 661 | sort_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp); |
| 662 | |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 663 | template <class RandomAccessIterator> |
Marshall Clow | 96d050a | 2018-01-15 16:16:32 +0000 | [diff] [blame] | 664 | constexpr bool // constexpr in C++20 |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 665 | is_heap(RandomAccessIterator first, RandomAccessiterator last); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 666 | |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 667 | template <class RandomAccessIterator, class Compare> |
Marshall Clow | 96d050a | 2018-01-15 16:16:32 +0000 | [diff] [blame] | 668 | constexpr bool // constexpr in C++20 |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 669 | is_heap(RandomAccessIterator first, RandomAccessiterator last, Compare comp); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 670 | |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 671 | template <class RandomAccessIterator> |
Marshall Clow | 96d050a | 2018-01-15 16:16:32 +0000 | [diff] [blame] | 672 | constexpr RandomAccessIterator // constexpr in C++20 |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 673 | is_heap_until(RandomAccessIterator first, RandomAccessiterator last); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 674 | |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 675 | template <class RandomAccessIterator, class Compare> |
Marshall Clow | 96d050a | 2018-01-15 16:16:32 +0000 | [diff] [blame] | 676 | constexpr RandomAccessIterator // constexpr in C++20 |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 677 | is_heap_until(RandomAccessIterator first, RandomAccessiterator last, Compare comp); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 678 | |
Howard Hinnant | b120e7a | 2010-08-21 20:10:01 +0000 | [diff] [blame] | 679 | template <class ForwardIterator> |
Arthur O'Dwyer | 20353a7 | 2020-12-02 20:02:18 -0500 | [diff] [blame] | 680 | constexpr ForwardIterator // constexpr in C++14 |
| 681 | min_element(ForwardIterator first, ForwardIterator last); |
Howard Hinnant | b120e7a | 2010-08-21 20:10:01 +0000 | [diff] [blame] | 682 | |
| 683 | template <class ForwardIterator, class Compare> |
Arthur O'Dwyer | 20353a7 | 2020-12-02 20:02:18 -0500 | [diff] [blame] | 684 | constexpr ForwardIterator // constexpr in C++14 |
| 685 | min_element(ForwardIterator first, ForwardIterator last, Compare comp); |
Howard Hinnant | b120e7a | 2010-08-21 20:10:01 +0000 | [diff] [blame] | 686 | |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 687 | template <class T> |
Arthur O'Dwyer | 20353a7 | 2020-12-02 20:02:18 -0500 | [diff] [blame] | 688 | constexpr const T& // constexpr in C++14 |
| 689 | min(const T& a, const T& b); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 690 | |
| 691 | template <class T, class Compare> |
Arthur O'Dwyer | 20353a7 | 2020-12-02 20:02:18 -0500 | [diff] [blame] | 692 | constexpr const T& // constexpr in C++14 |
| 693 | min(const T& a, const T& b, Compare comp); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 694 | |
Howard Hinnant | b120e7a | 2010-08-21 20:10:01 +0000 | [diff] [blame] | 695 | template<class T> |
Arthur O'Dwyer | 20353a7 | 2020-12-02 20:02:18 -0500 | [diff] [blame] | 696 | constexpr T // constexpr in C++14 |
| 697 | min(initializer_list<T> t); |
Howard Hinnant | b120e7a | 2010-08-21 20:10:01 +0000 | [diff] [blame] | 698 | |
| 699 | template<class T, class Compare> |
Arthur O'Dwyer | 20353a7 | 2020-12-02 20:02:18 -0500 | [diff] [blame] | 700 | constexpr T // constexpr in C++14 |
| 701 | min(initializer_list<T> t, Compare comp); |
Howard Hinnant | b120e7a | 2010-08-21 20:10:01 +0000 | [diff] [blame] | 702 | |
Marshall Clow | 3e18d0e | 2016-03-07 22:43:49 +0000 | [diff] [blame] | 703 | template<class T> |
Arthur O'Dwyer | 20353a7 | 2020-12-02 20:02:18 -0500 | [diff] [blame] | 704 | constexpr const T& clamp(const T& v, const T& lo, const T& hi); // C++17 |
Marshall Clow | 3e18d0e | 2016-03-07 22:43:49 +0000 | [diff] [blame] | 705 | |
| 706 | template<class T, class Compare> |
Arthur O'Dwyer | 20353a7 | 2020-12-02 20:02:18 -0500 | [diff] [blame] | 707 | constexpr const T& clamp(const T& v, const T& lo, const T& hi, Compare comp); // C++17 |
Marshall Clow | 3e18d0e | 2016-03-07 22:43:49 +0000 | [diff] [blame] | 708 | |
Howard Hinnant | b120e7a | 2010-08-21 20:10:01 +0000 | [diff] [blame] | 709 | template <class ForwardIterator> |
Arthur O'Dwyer | 20353a7 | 2020-12-02 20:02:18 -0500 | [diff] [blame] | 710 | constexpr ForwardIterator // constexpr in C++14 |
| 711 | max_element(ForwardIterator first, ForwardIterator last); |
Howard Hinnant | b120e7a | 2010-08-21 20:10:01 +0000 | [diff] [blame] | 712 | |
| 713 | template <class ForwardIterator, class Compare> |
Arthur O'Dwyer | 20353a7 | 2020-12-02 20:02:18 -0500 | [diff] [blame] | 714 | constexpr ForwardIterator // constexpr in C++14 |
| 715 | max_element(ForwardIterator first, ForwardIterator last, Compare comp); |
Howard Hinnant | b120e7a | 2010-08-21 20:10:01 +0000 | [diff] [blame] | 716 | |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 717 | template <class T> |
Arthur O'Dwyer | 20353a7 | 2020-12-02 20:02:18 -0500 | [diff] [blame] | 718 | constexpr const T& // constexpr in C++14 |
| 719 | max(const T& a, const T& b); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 720 | |
| 721 | template <class T, class Compare> |
Arthur O'Dwyer | 20353a7 | 2020-12-02 20:02:18 -0500 | [diff] [blame] | 722 | constexpr const T& // constexpr in C++14 |
| 723 | max(const T& a, const T& b, Compare comp); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 724 | |
Howard Hinnant | b120e7a | 2010-08-21 20:10:01 +0000 | [diff] [blame] | 725 | template<class T> |
Arthur O'Dwyer | 20353a7 | 2020-12-02 20:02:18 -0500 | [diff] [blame] | 726 | constexpr T // constexpr in C++14 |
| 727 | max(initializer_list<T> t); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 728 | |
Howard Hinnant | b120e7a | 2010-08-21 20:10:01 +0000 | [diff] [blame] | 729 | template<class T, class Compare> |
Arthur O'Dwyer | 20353a7 | 2020-12-02 20:02:18 -0500 | [diff] [blame] | 730 | constexpr T // constexpr in C++14 |
| 731 | max(initializer_list<T> t, Compare comp); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 732 | |
Howard Hinnant | b120e7a | 2010-08-21 20:10:01 +0000 | [diff] [blame] | 733 | template<class ForwardIterator> |
Arthur O'Dwyer | 20353a7 | 2020-12-02 20:02:18 -0500 | [diff] [blame] | 734 | constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++14 |
| 735 | minmax_element(ForwardIterator first, ForwardIterator last); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 736 | |
Howard Hinnant | b120e7a | 2010-08-21 20:10:01 +0000 | [diff] [blame] | 737 | template<class ForwardIterator, class Compare> |
Arthur O'Dwyer | 20353a7 | 2020-12-02 20:02:18 -0500 | [diff] [blame] | 738 | constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++14 |
| 739 | minmax_element(ForwardIterator first, ForwardIterator last, Compare comp); |
Howard Hinnant | b120e7a | 2010-08-21 20:10:01 +0000 | [diff] [blame] | 740 | |
| 741 | template<class T> |
Arthur O'Dwyer | 20353a7 | 2020-12-02 20:02:18 -0500 | [diff] [blame] | 742 | constexpr pair<const T&, const T&> // constexpr in C++14 |
| 743 | minmax(const T& a, const T& b); |
Howard Hinnant | b120e7a | 2010-08-21 20:10:01 +0000 | [diff] [blame] | 744 | |
| 745 | template<class T, class Compare> |
Arthur O'Dwyer | 20353a7 | 2020-12-02 20:02:18 -0500 | [diff] [blame] | 746 | constexpr pair<const T&, const T&> // constexpr in C++14 |
| 747 | minmax(const T& a, const T& b, Compare comp); |
Howard Hinnant | b120e7a | 2010-08-21 20:10:01 +0000 | [diff] [blame] | 748 | |
| 749 | template<class T> |
Arthur O'Dwyer | 20353a7 | 2020-12-02 20:02:18 -0500 | [diff] [blame] | 750 | constexpr pair<T, T> // constexpr in C++14 |
| 751 | minmax(initializer_list<T> t); |
Howard Hinnant | b120e7a | 2010-08-21 20:10:01 +0000 | [diff] [blame] | 752 | |
| 753 | template<class T, class Compare> |
Arthur O'Dwyer | 20353a7 | 2020-12-02 20:02:18 -0500 | [diff] [blame] | 754 | constexpr pair<T, T> // constexpr in C++14 |
| 755 | minmax(initializer_list<T> t, Compare comp); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 756 | |
| 757 | template <class InputIterator1, class InputIterator2> |
Marshall Clow | 5492c8a | 2018-01-22 20:44:33 +0000 | [diff] [blame] | 758 | constexpr bool // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 759 | lexicographical_compare(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2); |
| 760 | |
| 761 | template <class InputIterator1, class InputIterator2, class Compare> |
Marshall Clow | 5492c8a | 2018-01-22 20:44:33 +0000 | [diff] [blame] | 762 | constexpr bool // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 763 | lexicographical_compare(InputIterator1 first1, InputIterator1 last1, |
| 764 | InputIterator2 first2, InputIterator2 last2, Compare comp); |
| 765 | |
| 766 | template <class BidirectionalIterator> |
Arthur O'Dwyer | e50e747 | 2020-12-17 00:01:08 -0500 | [diff] [blame] | 767 | constexpr bool // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 768 | next_permutation(BidirectionalIterator first, BidirectionalIterator last); |
| 769 | |
| 770 | template <class BidirectionalIterator, class Compare> |
Arthur O'Dwyer | e50e747 | 2020-12-17 00:01:08 -0500 | [diff] [blame] | 771 | constexpr bool // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 772 | next_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp); |
| 773 | |
| 774 | template <class BidirectionalIterator> |
Arthur O'Dwyer | e50e747 | 2020-12-17 00:01:08 -0500 | [diff] [blame] | 775 | constexpr bool // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 776 | prev_permutation(BidirectionalIterator first, BidirectionalIterator last); |
| 777 | |
| 778 | template <class BidirectionalIterator, class Compare> |
Arthur O'Dwyer | e50e747 | 2020-12-17 00:01:08 -0500 | [diff] [blame] | 779 | constexpr bool // constexpr in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 780 | prev_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 781 | } // std |
| 782 | |
| 783 | */ |
| 784 | |
Louis Dionne | b4fce35 | 2022-03-25 12:55:36 -0400 | [diff] [blame] | 785 | #include <__assert> // all public C++ headers provide the assertion handler |
Arthur O'Dwyer | 3693d7a | 2022-02-04 13:09:30 -0500 | [diff] [blame] | 786 | #include <__bits> |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 787 | #include <__config> |
Louis Dionne | a60dd87 | 2021-06-17 11:30:11 -0400 | [diff] [blame] | 788 | #include <__debug> |
Howard Hinnant | 60e5cf4 | 2012-07-26 17:09:09 +0000 | [diff] [blame] | 789 | #include <cstddef> |
Arthur O'Dwyer | ef18160 | 2021-05-19 11:57:04 -0400 | [diff] [blame] | 790 | #include <cstring> |
| 791 | #include <functional> |
| 792 | #include <initializer_list> |
| 793 | #include <iterator> |
| 794 | #include <memory> |
| 795 | #include <type_traits> |
Marshall Clow | 0a1e750 | 2018-09-12 19:41:40 +0000 | [diff] [blame] | 796 | #include <version> |
Howard Hinnant | ea38295 | 2013-08-14 18:00:20 +0000 | [diff] [blame] | 797 | |
Louis Dionne | a60dd87 | 2021-06-17 11:30:11 -0400 | [diff] [blame] | 798 | #include <__algorithm/adjacent_find.h> |
| 799 | #include <__algorithm/all_of.h> |
| 800 | #include <__algorithm/any_of.h> |
| 801 | #include <__algorithm/binary_search.h> |
| 802 | #include <__algorithm/clamp.h> |
| 803 | #include <__algorithm/comp.h> |
| 804 | #include <__algorithm/comp_ref_type.h> |
| 805 | #include <__algorithm/copy.h> |
| 806 | #include <__algorithm/copy_backward.h> |
| 807 | #include <__algorithm/copy_if.h> |
| 808 | #include <__algorithm/copy_n.h> |
| 809 | #include <__algorithm/count.h> |
| 810 | #include <__algorithm/count_if.h> |
| 811 | #include <__algorithm/equal.h> |
| 812 | #include <__algorithm/equal_range.h> |
Louis Dionne | a60dd87 | 2021-06-17 11:30:11 -0400 | [diff] [blame] | 813 | #include <__algorithm/fill.h> |
Arthur O'Dwyer | 65077c0 | 2022-01-07 09:45:05 -0500 | [diff] [blame] | 814 | #include <__algorithm/fill_n.h> |
Louis Dionne | a60dd87 | 2021-06-17 11:30:11 -0400 | [diff] [blame] | 815 | #include <__algorithm/find.h> |
| 816 | #include <__algorithm/find_end.h> |
| 817 | #include <__algorithm/find_first_of.h> |
| 818 | #include <__algorithm/find_if.h> |
| 819 | #include <__algorithm/find_if_not.h> |
| 820 | #include <__algorithm/for_each.h> |
| 821 | #include <__algorithm/for_each_n.h> |
Louis Dionne | a60dd87 | 2021-06-17 11:30:11 -0400 | [diff] [blame] | 822 | #include <__algorithm/generate.h> |
Arthur O'Dwyer | 65077c0 | 2022-01-07 09:45:05 -0500 | [diff] [blame] | 823 | #include <__algorithm/generate_n.h> |
Louis Dionne | a60dd87 | 2021-06-17 11:30:11 -0400 | [diff] [blame] | 824 | #include <__algorithm/half_positive.h> |
Nikolas Klauser | dd5ad21 | 2022-02-21 23:07:02 +0100 | [diff] [blame] | 825 | #include <__algorithm/in_found_result.h> |
Nikolas Klauser | 671b475 | 2022-02-11 17:01:58 +0100 | [diff] [blame] | 826 | #include <__algorithm/in_fun_result.h> |
Nikolas Klauser | 05e2cd8 | 2022-01-25 11:21:47 +0100 | [diff] [blame] | 827 | #include <__algorithm/in_in_out_result.h> |
Nikolas Klauser | f74be4e | 2022-01-14 02:55:51 +0100 | [diff] [blame] | 828 | #include <__algorithm/in_in_result.h> |
Nikolas Klauser | 61ce816 | 2022-02-03 02:17:03 +0100 | [diff] [blame] | 829 | #include <__algorithm/in_out_out_result.h> |
Konstantin Varlamov | 7473681 | 2022-01-10 22:49:37 -0800 | [diff] [blame] | 830 | #include <__algorithm/in_out_result.h> |
Louis Dionne | a60dd87 | 2021-06-17 11:30:11 -0400 | [diff] [blame] | 831 | #include <__algorithm/includes.h> |
| 832 | #include <__algorithm/inplace_merge.h> |
| 833 | #include <__algorithm/is_heap.h> |
| 834 | #include <__algorithm/is_heap_until.h> |
| 835 | #include <__algorithm/is_partitioned.h> |
| 836 | #include <__algorithm/is_permutation.h> |
| 837 | #include <__algorithm/is_sorted.h> |
| 838 | #include <__algorithm/is_sorted_until.h> |
Christopher Di Bella | 41f26e8 | 2021-06-05 02:47:47 +0000 | [diff] [blame] | 839 | #include <__algorithm/iter_swap.h> |
Louis Dionne | a60dd87 | 2021-06-17 11:30:11 -0400 | [diff] [blame] | 840 | #include <__algorithm/lexicographical_compare.h> |
| 841 | #include <__algorithm/lower_bound.h> |
| 842 | #include <__algorithm/make_heap.h> |
| 843 | #include <__algorithm/max.h> |
| 844 | #include <__algorithm/max_element.h> |
| 845 | #include <__algorithm/merge.h> |
| 846 | #include <__algorithm/min.h> |
| 847 | #include <__algorithm/min_element.h> |
Nikolas Klauser | 2e26316 | 2022-02-21 22:48:36 +0100 | [diff] [blame] | 848 | #include <__algorithm/min_max_result.h> |
Louis Dionne | a60dd87 | 2021-06-17 11:30:11 -0400 | [diff] [blame] | 849 | #include <__algorithm/minmax.h> |
| 850 | #include <__algorithm/minmax_element.h> |
| 851 | #include <__algorithm/mismatch.h> |
| 852 | #include <__algorithm/move.h> |
| 853 | #include <__algorithm/move_backward.h> |
| 854 | #include <__algorithm/next_permutation.h> |
| 855 | #include <__algorithm/none_of.h> |
| 856 | #include <__algorithm/nth_element.h> |
| 857 | #include <__algorithm/partial_sort.h> |
| 858 | #include <__algorithm/partial_sort_copy.h> |
| 859 | #include <__algorithm/partition.h> |
| 860 | #include <__algorithm/partition_copy.h> |
| 861 | #include <__algorithm/partition_point.h> |
| 862 | #include <__algorithm/pop_heap.h> |
| 863 | #include <__algorithm/prev_permutation.h> |
| 864 | #include <__algorithm/push_heap.h> |
Nikolas Klauser | 37d076e | 2022-03-12 01:45:35 +0100 | [diff] [blame] | 865 | #include <__algorithm/ranges_find.h> |
| 866 | #include <__algorithm/ranges_find_if.h> |
| 867 | #include <__algorithm/ranges_find_if_not.h> |
Nikolas Klauser | 573cd6f | 2022-04-03 09:17:01 +0200 | [diff] [blame] | 868 | #include <__algorithm/ranges_max.h> |
Nikolas Klauser | f2a69ea | 2022-03-07 17:01:52 +0100 | [diff] [blame] | 869 | #include <__algorithm/ranges_max_element.h> |
Nikolas Klauser | 3559e45 | 2022-03-18 02:57:08 +0100 | [diff] [blame] | 870 | #include <__algorithm/ranges_min.h> |
Nikolas Klauser | 0a62a17 | 2022-02-11 13:11:57 +0100 | [diff] [blame] | 871 | #include <__algorithm/ranges_min_element.h> |
Nikolas Klauser | 12fc9bf | 2022-03-08 23:12:35 +0100 | [diff] [blame] | 872 | #include <__algorithm/ranges_mismatch.h> |
Nikolas Klauser | 4ceab5f | 2022-02-10 13:33:03 +0100 | [diff] [blame] | 873 | #include <__algorithm/ranges_swap_ranges.h> |
Nikolas Klauser | 559a177 | 2022-04-05 11:05:36 +0200 | [diff] [blame] | 874 | #include <__algorithm/ranges_transform.h> |
Louis Dionne | a60dd87 | 2021-06-17 11:30:11 -0400 | [diff] [blame] | 875 | #include <__algorithm/remove.h> |
| 876 | #include <__algorithm/remove_copy.h> |
| 877 | #include <__algorithm/remove_copy_if.h> |
| 878 | #include <__algorithm/remove_if.h> |
| 879 | #include <__algorithm/replace.h> |
| 880 | #include <__algorithm/replace_copy.h> |
| 881 | #include <__algorithm/replace_copy_if.h> |
| 882 | #include <__algorithm/replace_if.h> |
| 883 | #include <__algorithm/reverse.h> |
| 884 | #include <__algorithm/reverse_copy.h> |
| 885 | #include <__algorithm/rotate.h> |
| 886 | #include <__algorithm/rotate_copy.h> |
| 887 | #include <__algorithm/sample.h> |
| 888 | #include <__algorithm/search.h> |
| 889 | #include <__algorithm/search_n.h> |
| 890 | #include <__algorithm/set_difference.h> |
| 891 | #include <__algorithm/set_intersection.h> |
| 892 | #include <__algorithm/set_symmetric_difference.h> |
| 893 | #include <__algorithm/set_union.h> |
| 894 | #include <__algorithm/shift_left.h> |
| 895 | #include <__algorithm/shift_right.h> |
| 896 | #include <__algorithm/shuffle.h> |
| 897 | #include <__algorithm/sift_down.h> |
| 898 | #include <__algorithm/sort.h> |
| 899 | #include <__algorithm/sort_heap.h> |
| 900 | #include <__algorithm/stable_partition.h> |
| 901 | #include <__algorithm/stable_sort.h> |
Christopher Di Bella | 41f26e8 | 2021-06-05 02:47:47 +0000 | [diff] [blame] | 902 | #include <__algorithm/swap_ranges.h> |
Louis Dionne | a60dd87 | 2021-06-17 11:30:11 -0400 | [diff] [blame] | 903 | #include <__algorithm/transform.h> |
Louis Dionne | a60dd87 | 2021-06-17 11:30:11 -0400 | [diff] [blame] | 904 | #include <__algorithm/unique.h> |
Arthur O'Dwyer | 65077c0 | 2022-01-07 09:45:05 -0500 | [diff] [blame] | 905 | #include <__algorithm/unique_copy.h> |
Louis Dionne | a60dd87 | 2021-06-17 11:30:11 -0400 | [diff] [blame] | 906 | #include <__algorithm/unwrap_iter.h> |
| 907 | #include <__algorithm/upper_bound.h> |
Eric Fiselier | 14b6de9 | 2014-08-10 23:53:08 +0000 | [diff] [blame] | 908 | |
Howard Hinnant | aaaa52b | 2011-10-17 20:05:10 +0000 | [diff] [blame] | 909 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
Arthur O'Dwyer | 6eeaa00 | 2022-02-01 20:16:40 -0500 | [diff] [blame] | 910 | # pragma GCC system_header |
Howard Hinnant | aaaa52b | 2011-10-17 20:05:10 +0000 | [diff] [blame] | 911 | #endif |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 912 | |
Louis Dionne | 59d0b3c | 2019-08-05 18:29:14 +0000 | [diff] [blame] | 913 | #if defined(_LIBCPP_HAS_PARALLEL_ALGORITHMS) && _LIBCPP_STD_VER >= 17 |
Louis Dionne | d53d8c0 | 2019-08-06 21:11:24 +0000 | [diff] [blame] | 914 | # include <__pstl_algorithm> |
Louis Dionne | 59d0b3c | 2019-08-05 18:29:14 +0000 | [diff] [blame] | 915 | #endif |
| 916 | |
Louis Dionne | 2b1ceaa | 2021-04-20 12:03:32 -0400 | [diff] [blame] | 917 | #endif // _LIBCPP_ALGORITHM |