blob: 03b4faaee28445cbc4ed3e2d718f7dde2df47592 [file] [log] [blame]
Howard Hinnant3e519522010-05-11 19:42:161// -*- C++ -*-
Louis Dionneeb8650a2021-11-17 21:25:012//===----------------------------------------------------------------------===//
Howard Hinnant3e519522010-05-11 19:42:163//
Chandler Carruth57b08b02019-01-19 10:56:404// 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 Hinnant3e519522010-05-11 19:42:167//
8//===----------------------------------------------------------------------===//
9
10#ifndef _LIBCPP_ALGORITHM
11#define _LIBCPP_ALGORITHM
12
13/*
14 algorithm synopsis
15
16#include <initializer_list>
17
18namespace std
19{
20
Nikolas Klauserd3729bb2022-01-14 01:55:5121namespace ranges {
22 template <class I1, class I2>
23 struct in_in_result; // since C++20
24}
25
Howard Hinnant3e519522010-05-11 19:42:1626template <class InputIterator, class Predicate>
Marshall Clow706ffef2018-01-15 17:20:3627 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:1628 all_of(InputIterator first, InputIterator last, Predicate pred);
29
30template <class InputIterator, class Predicate>
Marshall Clow706ffef2018-01-15 17:20:3631 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:1632 any_of(InputIterator first, InputIterator last, Predicate pred);
33
34template <class InputIterator, class Predicate>
Marshall Clow706ffef2018-01-15 17:20:3635 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:1636 none_of(InputIterator first, InputIterator last, Predicate pred);
37
38template <class InputIterator, class Function>
Marshall Clow1b9a4ff2018-01-22 20:44:3339 constexpr Function // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:1640 for_each(InputIterator first, InputIterator last, Function f);
41
Marshall Clowd5c65ff2017-05-25 02:29:5442template<class InputIterator, class Size, class Function>
Marshall Clow1b9a4ff2018-01-22 20:44:3343 constexpr InputIterator // constexpr in C++20
44 for_each_n(InputIterator first, Size n, Function f); // C++17
Marshall Clowd5c65ff2017-05-25 02:29:5445
Howard Hinnant3e519522010-05-11 19:42:1646template <class InputIterator, class T>
Marshall Clow86944282018-01-15 19:26:0547 constexpr InputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:1648 find(InputIterator first, InputIterator last, const T& value);
49
50template <class InputIterator, class Predicate>
Marshall Clow86944282018-01-15 19:26:0551 constexpr InputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:1652 find_if(InputIterator first, InputIterator last, Predicate pred);
53
54template<class InputIterator, class Predicate>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:1855 constexpr InputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:1656 find_if_not(InputIterator first, InputIterator last, Predicate pred);
57
58template <class ForwardIterator1, class ForwardIterator2>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:1859 constexpr ForwardIterator1 // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:1660 find_end(ForwardIterator1 first1, ForwardIterator1 last1,
61 ForwardIterator2 first2, ForwardIterator2 last2);
62
63template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:1864 constexpr ForwardIterator1 // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:1665 find_end(ForwardIterator1 first1, ForwardIterator1 last1,
66 ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
67
68template <class ForwardIterator1, class ForwardIterator2>
Marshall Clow86944282018-01-15 19:26:0569 constexpr ForwardIterator1 // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:1670 find_first_of(ForwardIterator1 first1, ForwardIterator1 last1,
71 ForwardIterator2 first2, ForwardIterator2 last2);
72
73template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
Marshall Clow86944282018-01-15 19:26:0574 constexpr ForwardIterator1 // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:1675 find_first_of(ForwardIterator1 first1, ForwardIterator1 last1,
76 ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
77
78template <class ForwardIterator>
Marshall Clow86944282018-01-15 19:26:0579 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:1680 adjacent_find(ForwardIterator first, ForwardIterator last);
81
82template <class ForwardIterator, class BinaryPredicate>
Marshall Clow86944282018-01-15 19:26:0583 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:1684 adjacent_find(ForwardIterator first, ForwardIterator last, BinaryPredicate pred);
85
86template <class InputIterator, class T>
Marshall Clow056f15e2018-01-15 19:40:3487 constexpr typename iterator_traits<InputIterator>::difference_type // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:1688 count(InputIterator first, InputIterator last, const T& value);
89
90template <class InputIterator, class Predicate>
Marshall Clow056f15e2018-01-15 19:40:3491 constexpr typename iterator_traits<InputIterator>::difference_type // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:1692 count_if(InputIterator first, InputIterator last, Predicate pred);
93
94template <class InputIterator1, class InputIterator2>
Marshall Clow6538e28d2018-01-16 02:04:1095 constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:1696 mismatch(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2);
97
Marshall Clow0b0bbd22013-05-09 21:14:2398template <class InputIterator1, class InputIterator2>
Marshall Clow6538e28d2018-01-16 02:04:1099 constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20
Aditya Kumar331fb802016-08-25 11:52:38100 mismatch(InputIterator1 first1, InputIterator1 last1,
Marshall Clow0b0bbd22013-05-09 21:14:23101 InputIterator2 first2, InputIterator2 last2); // **C++14**
102
Howard Hinnant3e519522010-05-11 19:42:16103template <class InputIterator1, class InputIterator2, class BinaryPredicate>
Marshall Clow6538e28d2018-01-16 02:04:10104 constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16105 mismatch(InputIterator1 first1, InputIterator1 last1,
106 InputIterator2 first2, BinaryPredicate pred);
107
Marshall Clow0b0bbd22013-05-09 21:14:23108template <class InputIterator1, class InputIterator2, class BinaryPredicate>
Marshall Clow6538e28d2018-01-16 02:04:10109 constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20
Marshall Clow0b0bbd22013-05-09 21:14:23110 mismatch(InputIterator1 first1, InputIterator1 last1,
111 InputIterator2 first2, InputIterator2 last2,
112 BinaryPredicate pred); // **C++14**
113
Howard Hinnant3e519522010-05-11 19:42:16114template <class InputIterator1, class InputIterator2>
Marshall Clow6538e28d2018-01-16 02:04:10115 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16116 equal(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2);
117
Marshall Clow0b0bbd22013-05-09 21:14:23118template <class InputIterator1, class InputIterator2>
Marshall Clow6538e28d2018-01-16 02:04:10119 constexpr bool // constexpr in C++20
Aditya Kumar331fb802016-08-25 11:52:38120 equal(InputIterator1 first1, InputIterator1 last1,
Marshall Clow0b0bbd22013-05-09 21:14:23121 InputIterator2 first2, InputIterator2 last2); // **C++14**
122
Howard Hinnant3e519522010-05-11 19:42:16123template <class InputIterator1, class InputIterator2, class BinaryPredicate>
Marshall Clow6538e28d2018-01-16 02:04:10124 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16125 equal(InputIterator1 first1, InputIterator1 last1,
126 InputIterator2 first2, BinaryPredicate pred);
127
Marshall Clow0b0bbd22013-05-09 21:14:23128template <class InputIterator1, class InputIterator2, class BinaryPredicate>
Marshall Clow6538e28d2018-01-16 02:04:10129 constexpr bool // constexpr in C++20
Marshall Clow0b0bbd22013-05-09 21:14:23130 equal(InputIterator1 first1, InputIterator1 last1,
131 InputIterator2 first2, InputIterator2 last2,
132 BinaryPredicate pred); // **C++14**
133
Howard Hinnant3e519522010-05-11 19:42:16134template<class ForwardIterator1, class ForwardIterator2>
Marshall Clow49c76432018-01-15 16:16:32135 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16136 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
137 ForwardIterator2 first2);
138
Marshall Clow0b0bbd22013-05-09 21:14:23139template<class ForwardIterator1, class ForwardIterator2>
Marshall Clow49c76432018-01-15 16:16:32140 constexpr bool // constexpr in C++20
Marshall Clow0b0bbd22013-05-09 21:14:23141 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
142 ForwardIterator2 first2, ForwardIterator2 last2); // **C++14**
143
Howard Hinnant3e519522010-05-11 19:42:16144template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
Marshall Clow49c76432018-01-15 16:16:32145 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16146 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
147 ForwardIterator2 first2, BinaryPredicate pred);
148
Marshall Clow0b0bbd22013-05-09 21:14:23149template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
Marshall Clow49c76432018-01-15 16:16:32150 constexpr bool // constexpr in C++20
Marshall Clow0b0bbd22013-05-09 21:14:23151 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
152 ForwardIterator2 first2, ForwardIterator2 last2,
153 BinaryPredicate pred); // **C++14**
154
Howard Hinnant3e519522010-05-11 19:42:16155template <class ForwardIterator1, class ForwardIterator2>
Marshall Clow12f0a772018-01-16 15:48:27156 constexpr ForwardIterator1 // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16157 search(ForwardIterator1 first1, ForwardIterator1 last1,
158 ForwardIterator2 first2, ForwardIterator2 last2);
159
160template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
Marshall Clow12f0a772018-01-16 15:48:27161 constexpr ForwardIterator1 // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16162 search(ForwardIterator1 first1, ForwardIterator1 last1,
163 ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
164
165template <class ForwardIterator, class Size, class T>
Marshall Clow12f0a772018-01-16 15:48:27166 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16167 search_n(ForwardIterator first, ForwardIterator last, Size count, const T& value);
168
169template <class ForwardIterator, class Size, class T, class BinaryPredicate>
Marshall Clow12f0a772018-01-16 15:48:27170 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16171 search_n(ForwardIterator first, ForwardIterator last,
172 Size count, const T& value, BinaryPredicate pred);
173
174template <class InputIterator, class OutputIterator>
Louis Dionne13c90a52019-11-06 12:02:41175 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16176 copy(InputIterator first, InputIterator last, OutputIterator result);
177
178template<class InputIterator, class OutputIterator, class Predicate>
Louis Dionne13c90a52019-11-06 12:02:41179 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16180 copy_if(InputIterator first, InputIterator last,
181 OutputIterator result, Predicate pred);
182
183template<class InputIterator, class Size, class OutputIterator>
Louis Dionne13c90a52019-11-06 12:02:41184 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16185 copy_n(InputIterator first, Size n, OutputIterator result);
186
187template <class BidirectionalIterator1, class BidirectionalIterator2>
Louis Dionne13c90a52019-11-06 12:02:41188 constexpr BidirectionalIterator2 // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16189 copy_backward(BidirectionalIterator1 first, BidirectionalIterator1 last,
190 BidirectionalIterator2 result);
191
192template <class ForwardIterator1, class ForwardIterator2>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:18193 constexpr ForwardIterator2 // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16194 swap_ranges(ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2);
195
196template <class ForwardIterator1, class ForwardIterator2>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:18197 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16198 iter_swap(ForwardIterator1 a, ForwardIterator2 b);
199
200template <class InputIterator, class OutputIterator, class UnaryOperation>
Marshall Clow99894b62018-01-19 17:45:39201 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16202 transform(InputIterator first, InputIterator last, OutputIterator result, UnaryOperation op);
203
204template <class InputIterator1, class InputIterator2, class OutputIterator, class BinaryOperation>
Marshall Clow99894b62018-01-19 17:45:39205 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16206 transform(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2,
207 OutputIterator result, BinaryOperation binary_op);
208
209template <class ForwardIterator, class T>
Marshall Clow12c74232018-01-19 18:07:29210 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16211 replace(ForwardIterator first, ForwardIterator last, const T& old_value, const T& new_value);
212
213template <class ForwardIterator, class Predicate, class T>
Marshall Clow12c74232018-01-19 18:07:29214 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16215 replace_if(ForwardIterator first, ForwardIterator last, Predicate pred, const T& new_value);
216
217template <class InputIterator, class OutputIterator, class T>
Marshall Clow12c74232018-01-19 18:07:29218 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16219 replace_copy(InputIterator first, InputIterator last, OutputIterator result,
220 const T& old_value, const T& new_value);
221
222template <class InputIterator, class OutputIterator, class Predicate, class T>
Marshall Clow12c74232018-01-19 18:07:29223 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16224 replace_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred, const T& new_value);
225
226template <class ForwardIterator, class T>
Marshall Clow4bfb9312018-01-20 20:14:32227 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16228 fill(ForwardIterator first, ForwardIterator last, const T& value);
229
230template <class OutputIterator, class Size, class T>
Marshall Clow4bfb9312018-01-20 20:14:32231 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16232 fill_n(OutputIterator first, Size n, const T& value);
233
234template <class ForwardIterator, class Generator>
Marshall Clow4bfb9312018-01-20 20:14:32235 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16236 generate(ForwardIterator first, ForwardIterator last, Generator gen);
237
238template <class OutputIterator, class Size, class Generator>
Marshall Clow4bfb9312018-01-20 20:14:32239 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16240 generate_n(OutputIterator first, Size n, Generator gen);
241
242template <class ForwardIterator, class T>
Marshall Clowe8ea8292018-01-22 21:43:04243 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16244 remove(ForwardIterator first, ForwardIterator last, const T& value);
245
246template <class ForwardIterator, class Predicate>
Marshall Clowe8ea8292018-01-22 21:43:04247 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16248 remove_if(ForwardIterator first, ForwardIterator last, Predicate pred);
249
250template <class InputIterator, class OutputIterator, class T>
Marshall Clowe8ea8292018-01-22 21:43:04251 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16252 remove_copy(InputIterator first, InputIterator last, OutputIterator result, const T& value);
253
254template <class InputIterator, class OutputIterator, class Predicate>
Marshall Clowe8ea8292018-01-22 21:43:04255 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16256 remove_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred);
257
258template <class ForwardIterator>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:18259 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16260 unique(ForwardIterator first, ForwardIterator last);
261
262template <class ForwardIterator, class BinaryPredicate>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:18263 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16264 unique(ForwardIterator first, ForwardIterator last, BinaryPredicate pred);
265
266template <class InputIterator, class OutputIterator>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:18267 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16268 unique_copy(InputIterator first, InputIterator last, OutputIterator result);
269
270template <class InputIterator, class OutputIterator, class BinaryPredicate>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:18271 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16272 unique_copy(InputIterator first, InputIterator last, OutputIterator result, BinaryPredicate pred);
273
274template <class BidirectionalIterator>
Arthur O'Dwyerf851db32020-12-17 05:01:08275 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16276 reverse(BidirectionalIterator first, BidirectionalIterator last);
277
278template <class BidirectionalIterator, class OutputIterator>
Marshall Clowe8ea8292018-01-22 21:43:04279 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16280 reverse_copy(BidirectionalIterator first, BidirectionalIterator last, OutputIterator result);
281
282template <class ForwardIterator>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:18283 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16284 rotate(ForwardIterator first, ForwardIterator middle, ForwardIterator last);
285
286template <class ForwardIterator, class OutputIterator>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:18287 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16288 rotate_copy(ForwardIterator first, ForwardIterator middle, ForwardIterator last, OutputIterator result);
289
290template <class RandomAccessIterator>
291 void
Marshall Clow0f37a412017-03-23 13:43:37292 random_shuffle(RandomAccessIterator first, RandomAccessIterator last); // deprecated in C++14, removed in C++17
Howard Hinnant3e519522010-05-11 19:42:16293
294template <class RandomAccessIterator, class RandomNumberGenerator>
295 void
Marshall Clow06965c12014-03-03 06:14:19296 random_shuffle(RandomAccessIterator first, RandomAccessIterator last,
Marshall Clow0f37a412017-03-23 13:43:37297 RandomNumberGenerator& rand); // deprecated in C++14, removed in C++17
Howard Hinnant3e519522010-05-11 19:42:16298
Eric Fiseliere7154702016-08-28 22:14:37299template<class PopulationIterator, class SampleIterator,
300 class Distance, class UniformRandomBitGenerator>
301 SampleIterator sample(PopulationIterator first, PopulationIterator last,
302 SampleIterator out, Distance n,
303 UniformRandomBitGenerator&& g); // C++17
304
Howard Hinnantf9d540b2010-05-26 17:49:34305template<class RandomAccessIterator, class UniformRandomNumberGenerator>
306 void shuffle(RandomAccessIterator first, RandomAccessIterator last,
Howard Hinnantfb340102010-11-18 01:47:02307 UniformRandomNumberGenerator&& g);
Howard Hinnantf9d540b2010-05-26 17:49:34308
Arthur O'Dwyer3fbd3ea2020-12-26 06:39:03309template<class ForwardIterator>
310 constexpr ForwardIterator
311 shift_left(ForwardIterator first, ForwardIterator last,
312 typename iterator_traits<ForwardIterator>::difference_type n); // C++20
313
314template<class ForwardIterator>
315 constexpr ForwardIterator
316 shift_right(ForwardIterator first, ForwardIterator last,
317 typename iterator_traits<ForwardIterator>::difference_type n); // C++20
318
Howard Hinnant3e519522010-05-11 19:42:16319template <class InputIterator, class Predicate>
Marshall Clow49c76432018-01-15 16:16:32320 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16321 is_partitioned(InputIterator first, InputIterator last, Predicate pred);
322
323template <class ForwardIterator, class Predicate>
Arthur O'Dwyerf851db32020-12-17 05:01:08324 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16325 partition(ForwardIterator first, ForwardIterator last, Predicate pred);
326
327template <class InputIterator, class OutputIterator1,
328 class OutputIterator2, class Predicate>
Marshall Clow1b9a4ff2018-01-22 20:44:33329 constexpr pair<OutputIterator1, OutputIterator2> // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16330 partition_copy(InputIterator first, InputIterator last,
331 OutputIterator1 out_true, OutputIterator2 out_false,
332 Predicate pred);
333
334template <class ForwardIterator, class Predicate>
335 ForwardIterator
336 stable_partition(ForwardIterator first, ForwardIterator last, Predicate pred);
337
338template<class ForwardIterator, class Predicate>
Marshall Clowd57c03d2018-01-16 02:34:41339 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16340 partition_point(ForwardIterator first, ForwardIterator last, Predicate pred);
341
342template <class ForwardIterator>
Marshall Clow49c76432018-01-15 16:16:32343 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16344 is_sorted(ForwardIterator first, ForwardIterator last);
345
346template <class ForwardIterator, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:18347 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16348 is_sorted(ForwardIterator first, ForwardIterator last, Compare comp);
349
350template<class ForwardIterator>
Marshall Clow056f15e2018-01-15 19:40:34351 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16352 is_sorted_until(ForwardIterator first, ForwardIterator last);
353
354template <class ForwardIterator, class Compare>
Marshall Clow056f15e2018-01-15 19:40:34355 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16356 is_sorted_until(ForwardIterator first, ForwardIterator last, Compare comp);
357
358template <class RandomAccessIterator>
Arthur O'Dwyer493f1402020-12-20 20:21:42359 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16360 sort(RandomAccessIterator first, RandomAccessIterator last);
361
362template <class RandomAccessIterator, class Compare>
Arthur O'Dwyer493f1402020-12-20 20:21:42363 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16364 sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
365
366template <class RandomAccessIterator>
367 void
368 stable_sort(RandomAccessIterator first, RandomAccessIterator last);
369
370template <class RandomAccessIterator, class Compare>
371 void
372 stable_sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
373
374template <class RandomAccessIterator>
Arthur O'Dwyer5386aa22020-12-17 05:26:18375 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16376 partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last);
377
378template <class RandomAccessIterator, class Compare>
Arthur O'Dwyer5386aa22020-12-17 05:26:18379 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16380 partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last, Compare comp);
381
382template <class InputIterator, class RandomAccessIterator>
Arthur O'Dwyer5386aa22020-12-17 05:26:18383 constexpr RandomAccessIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16384 partial_sort_copy(InputIterator first, InputIterator last,
385 RandomAccessIterator result_first, RandomAccessIterator result_last);
386
387template <class InputIterator, class RandomAccessIterator, class Compare>
Arthur O'Dwyer5386aa22020-12-17 05:26:18388 constexpr RandomAccessIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16389 partial_sort_copy(InputIterator first, InputIterator last,
390 RandomAccessIterator result_first, RandomAccessIterator result_last, Compare comp);
391
392template <class RandomAccessIterator>
Arthur O'Dwyer5d956562021-02-04 23:12:52393 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16394 nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last);
395
396template <class RandomAccessIterator, class Compare>
Arthur O'Dwyer5d956562021-02-04 23:12:52397 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16398 nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last, Compare comp);
399
400template <class ForwardIterator, class T>
Marshall Clowd57c03d2018-01-16 02:34:41401 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16402 lower_bound(ForwardIterator first, ForwardIterator last, const T& value);
403
404template <class ForwardIterator, class T, class Compare>
Marshall Clowd57c03d2018-01-16 02:34:41405 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16406 lower_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
407
408template <class ForwardIterator, class T>
Marshall Clowd57c03d2018-01-16 02:34:41409 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16410 upper_bound(ForwardIterator first, ForwardIterator last, const T& value);
411
412template <class ForwardIterator, class T, class Compare>
Marshall Clowd57c03d2018-01-16 02:34:41413 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16414 upper_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
415
416template <class ForwardIterator, class T>
Marshall Clowd57c03d2018-01-16 02:34:41417 constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16418 equal_range(ForwardIterator first, ForwardIterator last, const T& value);
419
420template <class ForwardIterator, class T, class Compare>
Marshall Clowd57c03d2018-01-16 02:34:41421 constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16422 equal_range(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
423
424template <class ForwardIterator, class T>
Marshall Clowd57c03d2018-01-16 02:34:41425 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16426 binary_search(ForwardIterator first, ForwardIterator last, const T& value);
427
428template <class ForwardIterator, class T, class Compare>
Marshall Clow8da1a482018-01-22 23:10:40429 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16430 binary_search(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
431
432template <class InputIterator1, class InputIterator2, class OutputIterator>
Arthur O'Dwyer14098cf2020-12-04 18:47:12433 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16434 merge(InputIterator1 first1, InputIterator1 last1,
435 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
436
437template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
Arthur O'Dwyer14098cf2020-12-04 18:47:12438 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16439 merge(InputIterator1 first1, InputIterator1 last1,
440 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
441
442template <class BidirectionalIterator>
443 void
444 inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last);
445
446template <class BidirectionalIterator, class Compare>
447 void
448 inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last, Compare comp);
449
450template <class InputIterator1, class InputIterator2>
Marshall Clow8da1a482018-01-22 23:10:40451 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16452 includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2);
453
454template <class InputIterator1, class InputIterator2, class Compare>
Marshall Clow8da1a482018-01-22 23:10:40455 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16456 includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, Compare comp);
457
458template <class InputIterator1, class InputIterator2, class OutputIterator>
Arthur O'Dwyer14098cf2020-12-04 18:47:12459 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16460 set_union(InputIterator1 first1, InputIterator1 last1,
461 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
462
463template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
Arthur O'Dwyer14098cf2020-12-04 18:47:12464 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16465 set_union(InputIterator1 first1, InputIterator1 last1,
466 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
467
468template <class InputIterator1, class InputIterator2, class OutputIterator>
Marshall Clow8da1a482018-01-22 23:10:40469 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16470 set_intersection(InputIterator1 first1, InputIterator1 last1,
471 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
472
473template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
Marshall Clow8da1a482018-01-22 23:10:40474 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16475 set_intersection(InputIterator1 first1, InputIterator1 last1,
476 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
477
478template <class InputIterator1, class InputIterator2, class OutputIterator>
Arthur O'Dwyer14098cf2020-12-04 18:47:12479 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16480 set_difference(InputIterator1 first1, InputIterator1 last1,
481 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
482
483template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
Arthur O'Dwyer14098cf2020-12-04 18:47:12484 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16485 set_difference(InputIterator1 first1, InputIterator1 last1,
486 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
487
488template <class InputIterator1, class InputIterator2, class OutputIterator>
Arthur O'Dwyer14098cf2020-12-04 18:47:12489 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16490 set_symmetric_difference(InputIterator1 first1, InputIterator1 last1,
491 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
492
493template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
Arthur O'Dwyer14098cf2020-12-04 18:47:12494 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16495 set_symmetric_difference(InputIterator1 first1, InputIterator1 last1,
496 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
497
498template <class RandomAccessIterator>
Arthur O'Dwyer5386aa22020-12-17 05:26:18499 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16500 push_heap(RandomAccessIterator first, RandomAccessIterator last);
501
502template <class RandomAccessIterator, class Compare>
Arthur O'Dwyer5386aa22020-12-17 05:26:18503 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16504 push_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
505
506template <class RandomAccessIterator>
Arthur O'Dwyer5386aa22020-12-17 05:26:18507 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16508 pop_heap(RandomAccessIterator first, RandomAccessIterator last);
509
510template <class RandomAccessIterator, class Compare>
Arthur O'Dwyer5386aa22020-12-17 05:26:18511 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16512 pop_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
513
514template <class RandomAccessIterator>
Arthur O'Dwyer5386aa22020-12-17 05:26:18515 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16516 make_heap(RandomAccessIterator first, RandomAccessIterator last);
517
518template <class RandomAccessIterator, class Compare>
Arthur O'Dwyer5386aa22020-12-17 05:26:18519 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16520 make_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
521
522template <class RandomAccessIterator>
Arthur O'Dwyer5386aa22020-12-17 05:26:18523 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16524 sort_heap(RandomAccessIterator first, RandomAccessIterator last);
525
526template <class RandomAccessIterator, class Compare>
Arthur O'Dwyer5386aa22020-12-17 05:26:18527 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16528 sort_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
529
Howard Hinnantb3371f62010-08-22 00:02:43530template <class RandomAccessIterator>
Marshall Clow49c76432018-01-15 16:16:32531 constexpr bool // constexpr in C++20
Howard Hinnantb3371f62010-08-22 00:02:43532 is_heap(RandomAccessIterator first, RandomAccessiterator last);
Howard Hinnant3e519522010-05-11 19:42:16533
Howard Hinnantb3371f62010-08-22 00:02:43534template <class RandomAccessIterator, class Compare>
Marshall Clow49c76432018-01-15 16:16:32535 constexpr bool // constexpr in C++20
Howard Hinnantb3371f62010-08-22 00:02:43536 is_heap(RandomAccessIterator first, RandomAccessiterator last, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:16537
Howard Hinnantb3371f62010-08-22 00:02:43538template <class RandomAccessIterator>
Marshall Clow49c76432018-01-15 16:16:32539 constexpr RandomAccessIterator // constexpr in C++20
Howard Hinnantb3371f62010-08-22 00:02:43540 is_heap_until(RandomAccessIterator first, RandomAccessiterator last);
Howard Hinnant3e519522010-05-11 19:42:16541
Howard Hinnantb3371f62010-08-22 00:02:43542template <class RandomAccessIterator, class Compare>
Marshall Clow49c76432018-01-15 16:16:32543 constexpr RandomAccessIterator // constexpr in C++20
Howard Hinnantb3371f62010-08-22 00:02:43544 is_heap_until(RandomAccessIterator first, RandomAccessiterator last, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:16545
Howard Hinnant4eb27b72010-08-21 20:10:01546template <class ForwardIterator>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:18547 constexpr ForwardIterator // constexpr in C++14
548 min_element(ForwardIterator first, ForwardIterator last);
Howard Hinnant4eb27b72010-08-21 20:10:01549
550template <class ForwardIterator, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:18551 constexpr ForwardIterator // constexpr in C++14
552 min_element(ForwardIterator first, ForwardIterator last, Compare comp);
Howard Hinnant4eb27b72010-08-21 20:10:01553
Howard Hinnant3e519522010-05-11 19:42:16554template <class T>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:18555 constexpr const T& // constexpr in C++14
556 min(const T& a, const T& b);
Howard Hinnant3e519522010-05-11 19:42:16557
558template <class T, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:18559 constexpr const T& // constexpr in C++14
560 min(const T& a, const T& b, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:16561
Howard Hinnant4eb27b72010-08-21 20:10:01562template<class T>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:18563 constexpr T // constexpr in C++14
564 min(initializer_list<T> t);
Howard Hinnant4eb27b72010-08-21 20:10:01565
566template<class T, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:18567 constexpr T // constexpr in C++14
568 min(initializer_list<T> t, Compare comp);
Howard Hinnant4eb27b72010-08-21 20:10:01569
Marshall Clow146c14a2016-03-07 22:43:49570template<class T>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:18571 constexpr const T& clamp(const T& v, const T& lo, const T& hi); // C++17
Marshall Clow146c14a2016-03-07 22:43:49572
573template<class T, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:18574 constexpr const T& clamp(const T& v, const T& lo, const T& hi, Compare comp); // C++17
Marshall Clow146c14a2016-03-07 22:43:49575
Howard Hinnant4eb27b72010-08-21 20:10:01576template <class ForwardIterator>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:18577 constexpr ForwardIterator // constexpr in C++14
578 max_element(ForwardIterator first, ForwardIterator last);
Howard Hinnant4eb27b72010-08-21 20:10:01579
580template <class ForwardIterator, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:18581 constexpr ForwardIterator // constexpr in C++14
582 max_element(ForwardIterator first, ForwardIterator last, Compare comp);
Howard Hinnant4eb27b72010-08-21 20:10:01583
Howard Hinnant3e519522010-05-11 19:42:16584template <class T>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:18585 constexpr const T& // constexpr in C++14
586 max(const T& a, const T& b);
Howard Hinnant3e519522010-05-11 19:42:16587
588template <class T, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:18589 constexpr const T& // constexpr in C++14
590 max(const T& a, const T& b, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:16591
Howard Hinnant4eb27b72010-08-21 20:10:01592template<class T>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:18593 constexpr T // constexpr in C++14
594 max(initializer_list<T> t);
Howard Hinnant3e519522010-05-11 19:42:16595
Howard Hinnant4eb27b72010-08-21 20:10:01596template<class T, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:18597 constexpr T // constexpr in C++14
598 max(initializer_list<T> t, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:16599
Howard Hinnant4eb27b72010-08-21 20:10:01600template<class ForwardIterator>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:18601 constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++14
602 minmax_element(ForwardIterator first, ForwardIterator last);
Howard Hinnant3e519522010-05-11 19:42:16603
Howard Hinnant4eb27b72010-08-21 20:10:01604template<class ForwardIterator, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:18605 constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++14
606 minmax_element(ForwardIterator first, ForwardIterator last, Compare comp);
Howard Hinnant4eb27b72010-08-21 20:10:01607
608template<class T>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:18609 constexpr pair<const T&, const T&> // constexpr in C++14
610 minmax(const T& a, const T& b);
Howard Hinnant4eb27b72010-08-21 20:10:01611
612template<class T, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:18613 constexpr pair<const T&, const T&> // constexpr in C++14
614 minmax(const T& a, const T& b, Compare comp);
Howard Hinnant4eb27b72010-08-21 20:10:01615
616template<class T>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:18617 constexpr pair<T, T> // constexpr in C++14
618 minmax(initializer_list<T> t);
Howard Hinnant4eb27b72010-08-21 20:10:01619
620template<class T, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:18621 constexpr pair<T, T> // constexpr in C++14
622 minmax(initializer_list<T> t, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:16623
624template <class InputIterator1, class InputIterator2>
Marshall Clow1b9a4ff2018-01-22 20:44:33625 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16626 lexicographical_compare(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2);
627
628template <class InputIterator1, class InputIterator2, class Compare>
Marshall Clow1b9a4ff2018-01-22 20:44:33629 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16630 lexicographical_compare(InputIterator1 first1, InputIterator1 last1,
631 InputIterator2 first2, InputIterator2 last2, Compare comp);
632
633template <class BidirectionalIterator>
Arthur O'Dwyerf851db32020-12-17 05:01:08634 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16635 next_permutation(BidirectionalIterator first, BidirectionalIterator last);
636
637template <class BidirectionalIterator, class Compare>
Arthur O'Dwyerf851db32020-12-17 05:01:08638 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16639 next_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp);
640
641template <class BidirectionalIterator>
Arthur O'Dwyerf851db32020-12-17 05:01:08642 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16643 prev_permutation(BidirectionalIterator first, BidirectionalIterator last);
644
645template <class BidirectionalIterator, class Compare>
Arthur O'Dwyerf851db32020-12-17 05:01:08646 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:16647 prev_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp);
648
Konstantin Varlamov8d23b742022-01-11 06:49:37649namespace ranges {
650// [algorithms.results], algorithm result types
651template<class InputIterator, class OutputIterator>
652 struct in_out_result;
653}
654
Howard Hinnant3e519522010-05-11 19:42:16655} // std
656
657*/
658
Nikolas Klausercf54cb22022-01-03 00:24:09659#include <__bits> // __libcpp_clz
Howard Hinnant3e519522010-05-11 19:42:16660#include <__config>
Louis Dionne134723e2021-06-17 15:30:11661#include <__debug>
Howard Hinnanta1d07d52012-07-26 17:09:09662#include <cstddef>
Arthur O'Dwyerbfbd73f2021-05-19 15:57:04663#include <cstring>
664#include <functional>
665#include <initializer_list>
Arthur O'Dwyerbfbd73f2021-05-19 15:57:04666#include <iterator>
667#include <memory>
668#include <type_traits>
669#include <utility> // swap_ranges
Marshall Clowf56972e2018-09-12 19:41:40670#include <version>
Howard Hinnant5d1a7012013-08-14 18:00:20671
Louis Dionne134723e2021-06-17 15:30:11672#include <__algorithm/adjacent_find.h>
673#include <__algorithm/all_of.h>
674#include <__algorithm/any_of.h>
675#include <__algorithm/binary_search.h>
676#include <__algorithm/clamp.h>
677#include <__algorithm/comp.h>
678#include <__algorithm/comp_ref_type.h>
679#include <__algorithm/copy.h>
680#include <__algorithm/copy_backward.h>
681#include <__algorithm/copy_if.h>
682#include <__algorithm/copy_n.h>
683#include <__algorithm/count.h>
684#include <__algorithm/count_if.h>
685#include <__algorithm/equal.h>
686#include <__algorithm/equal_range.h>
Louis Dionne134723e2021-06-17 15:30:11687#include <__algorithm/fill.h>
Arthur O'Dwyer4d81a462022-01-07 14:45:05688#include <__algorithm/fill_n.h>
Louis Dionne134723e2021-06-17 15:30:11689#include <__algorithm/find.h>
690#include <__algorithm/find_end.h>
691#include <__algorithm/find_first_of.h>
692#include <__algorithm/find_if.h>
693#include <__algorithm/find_if_not.h>
694#include <__algorithm/for_each.h>
695#include <__algorithm/for_each_n.h>
Louis Dionne134723e2021-06-17 15:30:11696#include <__algorithm/generate.h>
Arthur O'Dwyer4d81a462022-01-07 14:45:05697#include <__algorithm/generate_n.h>
Louis Dionne134723e2021-06-17 15:30:11698#include <__algorithm/half_positive.h>
Nikolas Klauserd3729bb2022-01-14 01:55:51699#include <__algorithm/in_in_result.h>
Konstantin Varlamov8d23b742022-01-11 06:49:37700#include <__algorithm/in_out_result.h>
Louis Dionne134723e2021-06-17 15:30:11701#include <__algorithm/includes.h>
702#include <__algorithm/inplace_merge.h>
703#include <__algorithm/is_heap.h>
704#include <__algorithm/is_heap_until.h>
705#include <__algorithm/is_partitioned.h>
706#include <__algorithm/is_permutation.h>
707#include <__algorithm/is_sorted.h>
708#include <__algorithm/is_sorted_until.h>
Christopher Di Bella6adbc832021-06-05 02:47:47709#include <__algorithm/iter_swap.h>
Louis Dionne134723e2021-06-17 15:30:11710#include <__algorithm/lexicographical_compare.h>
711#include <__algorithm/lower_bound.h>
712#include <__algorithm/make_heap.h>
713#include <__algorithm/max.h>
714#include <__algorithm/max_element.h>
715#include <__algorithm/merge.h>
716#include <__algorithm/min.h>
717#include <__algorithm/min_element.h>
718#include <__algorithm/minmax.h>
719#include <__algorithm/minmax_element.h>
720#include <__algorithm/mismatch.h>
721#include <__algorithm/move.h>
722#include <__algorithm/move_backward.h>
723#include <__algorithm/next_permutation.h>
724#include <__algorithm/none_of.h>
725#include <__algorithm/nth_element.h>
726#include <__algorithm/partial_sort.h>
727#include <__algorithm/partial_sort_copy.h>
728#include <__algorithm/partition.h>
729#include <__algorithm/partition_copy.h>
730#include <__algorithm/partition_point.h>
731#include <__algorithm/pop_heap.h>
732#include <__algorithm/prev_permutation.h>
733#include <__algorithm/push_heap.h>
734#include <__algorithm/remove.h>
735#include <__algorithm/remove_copy.h>
736#include <__algorithm/remove_copy_if.h>
737#include <__algorithm/remove_if.h>
738#include <__algorithm/replace.h>
739#include <__algorithm/replace_copy.h>
740#include <__algorithm/replace_copy_if.h>
741#include <__algorithm/replace_if.h>
742#include <__algorithm/reverse.h>
743#include <__algorithm/reverse_copy.h>
744#include <__algorithm/rotate.h>
745#include <__algorithm/rotate_copy.h>
746#include <__algorithm/sample.h>
747#include <__algorithm/search.h>
748#include <__algorithm/search_n.h>
749#include <__algorithm/set_difference.h>
750#include <__algorithm/set_intersection.h>
751#include <__algorithm/set_symmetric_difference.h>
752#include <__algorithm/set_union.h>
753#include <__algorithm/shift_left.h>
754#include <__algorithm/shift_right.h>
755#include <__algorithm/shuffle.h>
756#include <__algorithm/sift_down.h>
757#include <__algorithm/sort.h>
758#include <__algorithm/sort_heap.h>
759#include <__algorithm/stable_partition.h>
760#include <__algorithm/stable_sort.h>
Christopher Di Bella6adbc832021-06-05 02:47:47761#include <__algorithm/swap_ranges.h>
Louis Dionne134723e2021-06-17 15:30:11762#include <__algorithm/transform.h>
Louis Dionne134723e2021-06-17 15:30:11763#include <__algorithm/unique.h>
Arthur O'Dwyer4d81a462022-01-07 14:45:05764#include <__algorithm/unique_copy.h>
Louis Dionne134723e2021-06-17 15:30:11765#include <__algorithm/unwrap_iter.h>
766#include <__algorithm/upper_bound.h>
Eric Fiselierc1bd9192014-08-10 23:53:08767
Howard Hinnant073458b2011-10-17 20:05:10768#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
Howard Hinnant3e519522010-05-11 19:42:16769#pragma GCC system_header
Howard Hinnant073458b2011-10-17 20:05:10770#endif
Howard Hinnant3e519522010-05-11 19:42:16771
Louis Dionne0a06eb92019-08-05 18:29:14772#if defined(_LIBCPP_HAS_PARALLEL_ALGORITHMS) && _LIBCPP_STD_VER >= 17
Louis Dionne95689242019-08-06 21:11:24773# include <__pstl_algorithm>
Louis Dionne0a06eb92019-08-05 18:29:14774#endif
775
Louis Dionne4cd6ca12021-04-20 16:03:32776#endif // _LIBCPP_ALGORITHM