]>
Commit | Line | Data |
---|---|---|
1 | // <algorithm> Forward declarations -*- C++ -*- | |
2 | ||
3 | // Copyright (C) 2007-2025 Free Software Foundation, Inc. | |
4 | // | |
5 | // This file is part of the GNU ISO C++ Library. This library is free | |
6 | // software; you can redistribute it and/or modify it under the | |
7 | // terms of the GNU General Public License as published by the | |
8 | // Free Software Foundation; either version 3, or (at your option) | |
9 | // any later version. | |
10 | ||
11 | // This library is distributed in the hope that it will be useful, | |
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | // GNU General Public License for more details. | |
15 | ||
16 | // Under Section 7 of GPL version 3, you are granted additional | |
17 | // permissions described in the GCC Runtime Library Exception, version | |
18 | // 3.1, as published by the Free Software Foundation. | |
19 | ||
20 | // You should have received a copy of the GNU General Public License and | |
21 | // a copy of the GCC Runtime Library Exception along with this program; | |
22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see | |
23 | // <http://www.gnu.org/licenses/>. | |
24 | ||
25 | /** @file bits/algorithmfwd.h | |
26 | * This is an internal header file, included by other library headers. | |
27 | * Do not attempt to use it directly. @headername{algorithm} | |
28 | */ | |
29 | ||
30 | #ifndef _GLIBCXX_ALGORITHMFWD_H | |
31 | #define _GLIBCXX_ALGORITHMFWD_H 1 | |
32 | ||
33 | #ifdef _GLIBCXX_SYSHDR | |
34 | #pragma GCC system_header | |
35 | #endif | |
36 | ||
37 | #include <bits/c++config.h> | |
38 | #include <bits/stl_pair.h> | |
39 | #include <bits/stl_iterator_base_types.h> | |
40 | #if __cplusplus >= 201103L | |
41 | #include <initializer_list> | |
42 | #endif | |
43 | ||
44 | #pragma GCC diagnostic push | |
45 | #pragma GCC diagnostic ignored "-Wc++11-extensions" | |
46 | ||
47 | namespace std _GLIBCXX_VISIBILITY(default) | |
48 | { | |
49 | _GLIBCXX_BEGIN_NAMESPACE_VERSION | |
50 | ||
51 | /* | |
52 | adjacent_find | |
53 | all_of (C++11) | |
54 | any_of (C++11) | |
55 | binary_search | |
56 | clamp (C++17) | |
57 | copy | |
58 | copy_backward | |
59 | copy_if (C++11) | |
60 | copy_n (C++11) | |
61 | count | |
62 | count_if | |
63 | equal | |
64 | equal_range | |
65 | fill | |
66 | fill_n | |
67 | find | |
68 | find_end | |
69 | find_first_of | |
70 | find_if | |
71 | find_if_not (C++11) | |
72 | for_each | |
73 | generate | |
74 | generate_n | |
75 | includes | |
76 | inplace_merge | |
77 | is_heap (C++11) | |
78 | is_heap_until (C++11) | |
79 | is_partitioned (C++11) | |
80 | is_sorted (C++11) | |
81 | is_sorted_until (C++11) | |
82 | iter_swap | |
83 | lexicographical_compare | |
84 | lower_bound | |
85 | make_heap | |
86 | max | |
87 | max_element | |
88 | merge | |
89 | min | |
90 | min_element | |
91 | minmax (C++11) | |
92 | minmax_element (C++11) | |
93 | mismatch | |
94 | next_permutation | |
95 | none_of (C++11) | |
96 | nth_element | |
97 | partial_sort | |
98 | partial_sort_copy | |
99 | partition | |
100 | partition_copy (C++11) | |
101 | partition_point (C++11) | |
102 | pop_heap | |
103 | prev_permutation | |
104 | push_heap | |
105 | random_shuffle | |
106 | remove | |
107 | remove_copy | |
108 | remove_copy_if | |
109 | remove_if | |
110 | replace | |
111 | replace_copy | |
112 | replace_copy_if | |
113 | replace_if | |
114 | reverse | |
115 | reverse_copy | |
116 | rotate | |
117 | rotate_copy | |
118 | search | |
119 | search_n | |
120 | set_difference | |
121 | set_intersection | |
122 | set_symmetric_difference | |
123 | set_union | |
124 | shuffle (C++11) | |
125 | sort | |
126 | sort_heap | |
127 | stable_partition | |
128 | stable_sort | |
129 | swap | |
130 | swap_ranges | |
131 | transform | |
132 | unique | |
133 | unique_copy | |
134 | upper_bound | |
135 | */ | |
136 | ||
137 | /** | |
138 | * @defgroup algorithms Algorithms | |
139 | * | |
140 | * Components for performing algorithmic operations. Includes | |
141 | * non-modifying sequence, modifying (mutating) sequence, sorting, | |
142 | * searching, merge, partition, heap, set, minima, maxima, and | |
143 | * permutation operations. | |
144 | */ | |
145 | ||
146 | /** | |
147 | * @defgroup mutating_algorithms Mutating | |
148 | * @ingroup algorithms | |
149 | */ | |
150 | ||
151 | /** | |
152 | * @defgroup non_mutating_algorithms Non-Mutating | |
153 | * @ingroup algorithms | |
154 | */ | |
155 | ||
156 | /** | |
157 | * @defgroup sorting_algorithms Sorting | |
158 | * @ingroup algorithms | |
159 | */ | |
160 | ||
161 | /** | |
162 | * @defgroup set_algorithms Set Operations | |
163 | * @ingroup sorting_algorithms | |
164 | * | |
165 | * These algorithms are common set operations performed on sequences | |
166 | * that are already sorted. The number of comparisons will be | |
167 | * linear. | |
168 | */ | |
169 | ||
170 | /** | |
171 | * @defgroup binary_search_algorithms Binary Search | |
172 | * @ingroup sorting_algorithms | |
173 | * | |
174 | * These algorithms are variations of a classic binary search, and | |
175 | * all assume that the sequence being searched is already sorted. | |
176 | * | |
177 | * The number of comparisons will be logarithmic (and as few as | |
178 | * possible). The number of steps through the sequence will be | |
179 | * logarithmic for random-access iterators (e.g., pointers), and | |
180 | * linear otherwise. | |
181 | * | |
182 | * The LWG has passed Defect Report 270, which notes: <em>The | |
183 | * proposed resolution reinterprets binary search. Instead of | |
184 | * thinking about searching for a value in a sorted range, we view | |
185 | * that as an important special case of a more general algorithm: | |
186 | * searching for the partition point in a partitioned range. We | |
187 | * also add a guarantee that the old wording did not: we ensure that | |
188 | * the upper bound is no earlier than the lower bound, that the pair | |
189 | * returned by equal_range is a valid range, and that the first part | |
190 | * of that pair is the lower bound.</em> | |
191 | * | |
192 | * The actual effect of the first sentence is that a comparison | |
193 | * functor passed by the user doesn't necessarily need to induce a | |
194 | * strict weak ordering relation. Rather, it partitions the range. | |
195 | */ | |
196 | ||
197 | // adjacent_find | |
198 | ||
199 | #if __cplusplus >= 201103L | |
200 | template<typename _IIter, typename _Predicate> | |
201 | _GLIBCXX20_CONSTEXPR | |
202 | bool | |
203 | all_of(_IIter, _IIter, _Predicate); | |
204 | ||
205 | template<typename _IIter, typename _Predicate> | |
206 | _GLIBCXX20_CONSTEXPR | |
207 | bool | |
208 | any_of(_IIter, _IIter, _Predicate); | |
209 | #endif | |
210 | ||
211 | template<typename _FIter, typename _Tp _GLIBCXX26_ALGO_DEF_VAL_T(_FIter)> | |
212 | _GLIBCXX20_CONSTEXPR | |
213 | bool | |
214 | binary_search(_FIter, _FIter, const _Tp&); | |
215 | ||
216 | template<typename _FIter, typename _Tp _GLIBCXX26_ALGO_DEF_VAL_T(_FIter), | |
217 | typename _Compare> | |
218 | _GLIBCXX20_CONSTEXPR | |
219 | bool | |
220 | binary_search(_FIter, _FIter, const _Tp&, _Compare); | |
221 | ||
222 | #if __cplusplus > 201402L | |
223 | template<typename _Tp> | |
224 | _GLIBCXX14_CONSTEXPR | |
225 | const _Tp& | |
226 | clamp(const _Tp&, const _Tp&, const _Tp&); | |
227 | ||
228 | template<typename _Tp, typename _Compare> | |
229 | _GLIBCXX14_CONSTEXPR | |
230 | const _Tp& | |
231 | clamp(const _Tp&, const _Tp&, const _Tp&, _Compare); | |
232 | #endif | |
233 | ||
234 | template<typename _IIter, typename _OIter> | |
235 | _GLIBCXX20_CONSTEXPR | |
236 | _OIter | |
237 | copy(_IIter, _IIter, _OIter); | |
238 | ||
239 | template<typename _BIter1, typename _BIter2> | |
240 | _GLIBCXX20_CONSTEXPR | |
241 | _BIter2 | |
242 | copy_backward(_BIter1, _BIter1, _BIter2); | |
243 | ||
244 | #if __cplusplus >= 201103L | |
245 | template<typename _IIter, typename _OIter, typename _Predicate> | |
246 | _GLIBCXX20_CONSTEXPR | |
247 | _OIter | |
248 | copy_if(_IIter, _IIter, _OIter, _Predicate); | |
249 | ||
250 | template<typename _IIter, typename _Size, typename _OIter> | |
251 | _GLIBCXX20_CONSTEXPR | |
252 | _OIter | |
253 | copy_n(_IIter, _Size, _OIter); | |
254 | #endif | |
255 | ||
256 | // count | |
257 | // count_if | |
258 | ||
259 | template<typename _FIter, typename _Tp _GLIBCXX26_ALGO_DEF_VAL_T(_FIter)> | |
260 | _GLIBCXX20_CONSTEXPR | |
261 | pair<_FIter, _FIter> | |
262 | equal_range(_FIter, _FIter, const _Tp&); | |
263 | ||
264 | template<typename _FIter, typename _Tp _GLIBCXX26_ALGO_DEF_VAL_T(_FIter), | |
265 | typename _Compare> | |
266 | _GLIBCXX20_CONSTEXPR | |
267 | pair<_FIter, _FIter> | |
268 | equal_range(_FIter, _FIter, const _Tp&, _Compare); | |
269 | ||
270 | template<typename _FIter, typename _Tp _GLIBCXX26_ALGO_DEF_VAL_T(_FIter)> | |
271 | _GLIBCXX20_CONSTEXPR | |
272 | void | |
273 | fill(_FIter, _FIter, const _Tp&); | |
274 | ||
275 | template<typename _OIter, typename _Size, | |
276 | typename _Tp _GLIBCXX26_ALGO_DEF_VAL_T(_OIter)> | |
277 | _GLIBCXX20_CONSTEXPR | |
278 | _OIter | |
279 | fill_n(_OIter, _Size, const _Tp&); | |
280 | ||
281 | // find | |
282 | ||
283 | template<typename _FIter1, typename _FIter2> | |
284 | _GLIBCXX20_CONSTEXPR | |
285 | _FIter1 | |
286 | find_end(_FIter1, _FIter1, _FIter2, _FIter2); | |
287 | ||
288 | template<typename _FIter1, typename _FIter2, typename _BinaryPredicate> | |
289 | _GLIBCXX20_CONSTEXPR | |
290 | _FIter1 | |
291 | find_end(_FIter1, _FIter1, _FIter2, _FIter2, _BinaryPredicate); | |
292 | ||
293 | // find_first_of | |
294 | // find_if | |
295 | ||
296 | #if __cplusplus >= 201103L | |
297 | template<typename _IIter, typename _Predicate> | |
298 | _GLIBCXX20_CONSTEXPR | |
299 | _IIter | |
300 | find_if_not(_IIter, _IIter, _Predicate); | |
301 | #endif | |
302 | ||
303 | // for_each | |
304 | // generate | |
305 | // generate_n | |
306 | ||
307 | template<typename _IIter1, typename _IIter2> | |
308 | _GLIBCXX20_CONSTEXPR | |
309 | bool | |
310 | includes(_IIter1, _IIter1, _IIter2, _IIter2); | |
311 | ||
312 | template<typename _IIter1, typename _IIter2, typename _Compare> | |
313 | _GLIBCXX20_CONSTEXPR | |
314 | bool | |
315 | includes(_IIter1, _IIter1, _IIter2, _IIter2, _Compare); | |
316 | ||
317 | template<typename _BIter> | |
318 | _GLIBCXX26_CONSTEXPR | |
319 | void | |
320 | inplace_merge(_BIter, _BIter, _BIter); | |
321 | ||
322 | template<typename _BIter, typename _Compare> | |
323 | _GLIBCXX26_CONSTEXPR | |
324 | void | |
325 | inplace_merge(_BIter, _BIter, _BIter, _Compare); | |
326 | ||
327 | #if __cplusplus >= 201103L | |
328 | template<typename _RAIter> | |
329 | _GLIBCXX20_CONSTEXPR | |
330 | bool | |
331 | is_heap(_RAIter, _RAIter); | |
332 | ||
333 | template<typename _RAIter, typename _Compare> | |
334 | _GLIBCXX20_CONSTEXPR | |
335 | bool | |
336 | is_heap(_RAIter, _RAIter, _Compare); | |
337 | ||
338 | template<typename _RAIter> | |
339 | _GLIBCXX20_CONSTEXPR | |
340 | _RAIter | |
341 | is_heap_until(_RAIter, _RAIter); | |
342 | ||
343 | template<typename _RAIter, typename _Compare> | |
344 | _GLIBCXX20_CONSTEXPR | |
345 | _RAIter | |
346 | is_heap_until(_RAIter, _RAIter, _Compare); | |
347 | ||
348 | template<typename _IIter, typename _Predicate> | |
349 | _GLIBCXX20_CONSTEXPR | |
350 | bool | |
351 | is_partitioned(_IIter, _IIter, _Predicate); | |
352 | ||
353 | template<typename _FIter1, typename _FIter2> | |
354 | _GLIBCXX20_CONSTEXPR | |
355 | bool | |
356 | is_permutation(_FIter1, _FIter1, _FIter2); | |
357 | ||
358 | template<typename _FIter1, typename _FIter2, | |
359 | typename _BinaryPredicate> | |
360 | _GLIBCXX20_CONSTEXPR | |
361 | bool | |
362 | is_permutation(_FIter1, _FIter1, _FIter2, _BinaryPredicate); | |
363 | ||
364 | template<typename _FIter> | |
365 | _GLIBCXX20_CONSTEXPR | |
366 | bool | |
367 | is_sorted(_FIter, _FIter); | |
368 | ||
369 | template<typename _FIter, typename _Compare> | |
370 | _GLIBCXX20_CONSTEXPR | |
371 | bool | |
372 | is_sorted(_FIter, _FIter, _Compare); | |
373 | ||
374 | template<typename _FIter> | |
375 | _GLIBCXX20_CONSTEXPR | |
376 | _FIter | |
377 | is_sorted_until(_FIter, _FIter); | |
378 | ||
379 | template<typename _FIter, typename _Compare> | |
380 | _GLIBCXX20_CONSTEXPR | |
381 | _FIter | |
382 | is_sorted_until(_FIter, _FIter, _Compare); | |
383 | #endif | |
384 | ||
385 | template<typename _FIter1, typename _FIter2> | |
386 | _GLIBCXX20_CONSTEXPR | |
387 | void | |
388 | iter_swap(_FIter1, _FIter2); | |
389 | ||
390 | template<typename _FIter, typename _Tp _GLIBCXX26_ALGO_DEF_VAL_T(_FIter)> | |
391 | _GLIBCXX20_CONSTEXPR | |
392 | _FIter | |
393 | lower_bound(_FIter, _FIter, const _Tp&); | |
394 | ||
395 | template<typename _FIter, typename _Tp _GLIBCXX26_ALGO_DEF_VAL_T(_FIter), | |
396 | typename _Compare> | |
397 | _GLIBCXX20_CONSTEXPR | |
398 | _FIter | |
399 | lower_bound(_FIter, _FIter, const _Tp&, _Compare); | |
400 | ||
401 | template<typename _RAIter> | |
402 | _GLIBCXX20_CONSTEXPR | |
403 | void | |
404 | make_heap(_RAIter, _RAIter); | |
405 | ||
406 | template<typename _RAIter, typename _Compare> | |
407 | _GLIBCXX20_CONSTEXPR | |
408 | void | |
409 | make_heap(_RAIter, _RAIter, _Compare); | |
410 | ||
411 | template<typename _Tp> | |
412 | _GLIBCXX14_CONSTEXPR | |
413 | const _Tp& | |
414 | max(const _Tp&, const _Tp&); | |
415 | ||
416 | template<typename _Tp, typename _Compare> | |
417 | _GLIBCXX14_CONSTEXPR | |
418 | const _Tp& | |
419 | max(const _Tp&, const _Tp&, _Compare); | |
420 | ||
421 | // max_element | |
422 | // merge | |
423 | ||
424 | template<typename _Tp> | |
425 | _GLIBCXX14_CONSTEXPR | |
426 | const _Tp& | |
427 | min(const _Tp&, const _Tp&); | |
428 | ||
429 | template<typename _Tp, typename _Compare> | |
430 | _GLIBCXX14_CONSTEXPR | |
431 | const _Tp& | |
432 | min(const _Tp&, const _Tp&, _Compare); | |
433 | ||
434 | // min_element | |
435 | ||
436 | #if __cplusplus >= 201103L | |
437 | template<typename _Tp> | |
438 | _GLIBCXX14_CONSTEXPR | |
439 | pair<const _Tp&, const _Tp&> | |
440 | minmax(const _Tp&, const _Tp&); | |
441 | ||
442 | template<typename _Tp, typename _Compare> | |
443 | _GLIBCXX14_CONSTEXPR | |
444 | pair<const _Tp&, const _Tp&> | |
445 | minmax(const _Tp&, const _Tp&, _Compare); | |
446 | ||
447 | template<typename _FIter> | |
448 | _GLIBCXX14_CONSTEXPR | |
449 | pair<_FIter, _FIter> | |
450 | minmax_element(_FIter, _FIter); | |
451 | ||
452 | template<typename _FIter, typename _Compare> | |
453 | _GLIBCXX14_CONSTEXPR | |
454 | pair<_FIter, _FIter> | |
455 | minmax_element(_FIter, _FIter, _Compare); | |
456 | ||
457 | template<typename _Tp> | |
458 | _GLIBCXX14_CONSTEXPR | |
459 | _Tp | |
460 | min(initializer_list<_Tp>); | |
461 | ||
462 | template<typename _Tp, typename _Compare> | |
463 | _GLIBCXX14_CONSTEXPR | |
464 | _Tp | |
465 | min(initializer_list<_Tp>, _Compare); | |
466 | ||
467 | template<typename _Tp> | |
468 | _GLIBCXX14_CONSTEXPR | |
469 | _Tp | |
470 | max(initializer_list<_Tp>); | |
471 | ||
472 | template<typename _Tp, typename _Compare> | |
473 | _GLIBCXX14_CONSTEXPR | |
474 | _Tp | |
475 | max(initializer_list<_Tp>, _Compare); | |
476 | ||
477 | template<typename _Tp> | |
478 | _GLIBCXX14_CONSTEXPR | |
479 | pair<_Tp, _Tp> | |
480 | minmax(initializer_list<_Tp>); | |
481 | ||
482 | template<typename _Tp, typename _Compare> | |
483 | _GLIBCXX14_CONSTEXPR | |
484 | pair<_Tp, _Tp> | |
485 | minmax(initializer_list<_Tp>, _Compare); | |
486 | #endif | |
487 | ||
488 | // mismatch | |
489 | ||
490 | template<typename _BIter> | |
491 | _GLIBCXX20_CONSTEXPR | |
492 | bool | |
493 | next_permutation(_BIter, _BIter); | |
494 | ||
495 | template<typename _BIter, typename _Compare> | |
496 | _GLIBCXX20_CONSTEXPR | |
497 | bool | |
498 | next_permutation(_BIter, _BIter, _Compare); | |
499 | ||
500 | #if __cplusplus >= 201103L | |
501 | template<typename _IIter, typename _Predicate> | |
502 | _GLIBCXX20_CONSTEXPR | |
503 | bool | |
504 | none_of(_IIter, _IIter, _Predicate); | |
505 | #endif | |
506 | ||
507 | // nth_element | |
508 | // partial_sort | |
509 | ||
510 | template<typename _IIter, typename _RAIter> | |
511 | _GLIBCXX20_CONSTEXPR | |
512 | _RAIter | |
513 | partial_sort_copy(_IIter, _IIter, _RAIter, _RAIter); | |
514 | ||
515 | template<typename _IIter, typename _RAIter, typename _Compare> | |
516 | _GLIBCXX20_CONSTEXPR | |
517 | _RAIter | |
518 | partial_sort_copy(_IIter, _IIter, _RAIter, _RAIter, _Compare); | |
519 | ||
520 | // partition | |
521 | ||
522 | #if __cplusplus >= 201103L | |
523 | template<typename _IIter, typename _OIter1, | |
524 | typename _OIter2, typename _Predicate> | |
525 | _GLIBCXX20_CONSTEXPR | |
526 | pair<_OIter1, _OIter2> | |
527 | partition_copy(_IIter, _IIter, _OIter1, _OIter2, _Predicate); | |
528 | ||
529 | template<typename _FIter, typename _Predicate> | |
530 | _GLIBCXX20_CONSTEXPR | |
531 | _FIter | |
532 | partition_point(_FIter, _FIter, _Predicate); | |
533 | #endif | |
534 | ||
535 | template<typename _RAIter> | |
536 | _GLIBCXX20_CONSTEXPR | |
537 | void | |
538 | pop_heap(_RAIter, _RAIter); | |
539 | ||
540 | template<typename _RAIter, typename _Compare> | |
541 | _GLIBCXX20_CONSTEXPR | |
542 | void | |
543 | pop_heap(_RAIter, _RAIter, _Compare); | |
544 | ||
545 | template<typename _BIter> | |
546 | _GLIBCXX20_CONSTEXPR | |
547 | bool | |
548 | prev_permutation(_BIter, _BIter); | |
549 | ||
550 | template<typename _BIter, typename _Compare> | |
551 | _GLIBCXX20_CONSTEXPR | |
552 | bool | |
553 | prev_permutation(_BIter, _BIter, _Compare); | |
554 | ||
555 | template<typename _RAIter> | |
556 | _GLIBCXX20_CONSTEXPR | |
557 | void | |
558 | push_heap(_RAIter, _RAIter); | |
559 | ||
560 | template<typename _RAIter, typename _Compare> | |
561 | _GLIBCXX20_CONSTEXPR | |
562 | void | |
563 | push_heap(_RAIter, _RAIter, _Compare); | |
564 | ||
565 | // random_shuffle | |
566 | ||
567 | template<typename _FIter, typename _Tp _GLIBCXX26_ALGO_DEF_VAL_T(_FIter)> | |
568 | _GLIBCXX20_CONSTEXPR | |
569 | _FIter | |
570 | remove(_FIter, _FIter, const _Tp&); | |
571 | ||
572 | template<typename _FIter, typename _Predicate> | |
573 | _GLIBCXX20_CONSTEXPR | |
574 | _FIter | |
575 | remove_if(_FIter, _FIter, _Predicate); | |
576 | ||
577 | template<typename _IIter, typename _OIter, | |
578 | typename _Tp _GLIBCXX26_ALGO_DEF_VAL_T(_IIter)> | |
579 | _GLIBCXX20_CONSTEXPR | |
580 | _OIter | |
581 | remove_copy(_IIter, _IIter, _OIter, const _Tp&); | |
582 | ||
583 | template<typename _IIter, typename _OIter, typename _Predicate> | |
584 | _GLIBCXX20_CONSTEXPR | |
585 | _OIter | |
586 | remove_copy_if(_IIter, _IIter, _OIter, _Predicate); | |
587 | ||
588 | // replace | |
589 | ||
590 | template<typename _IIter, typename _OIter, typename _Tp> | |
591 | _GLIBCXX20_CONSTEXPR | |
592 | _OIter | |
593 | replace_copy(_IIter, _IIter, _OIter, const _Tp&, const _Tp&); | |
594 | ||
595 | template<typename _Iter, typename _OIter, typename _Predicate, | |
596 | typename _Tp _GLIBCXX26_ALGO_DEF_VAL_T(_OIter)> | |
597 | _GLIBCXX20_CONSTEXPR | |
598 | _OIter | |
599 | replace_copy_if(_Iter, _Iter, _OIter, _Predicate, const _Tp&); | |
600 | ||
601 | // replace_if | |
602 | ||
603 | template<typename _BIter> | |
604 | _GLIBCXX20_CONSTEXPR | |
605 | void | |
606 | reverse(_BIter, _BIter); | |
607 | ||
608 | template<typename _BIter, typename _OIter> | |
609 | _GLIBCXX20_CONSTEXPR | |
610 | _OIter | |
611 | reverse_copy(_BIter, _BIter, _OIter); | |
612 | ||
613 | _GLIBCXX_BEGIN_INLINE_ABI_NAMESPACE(_V2) | |
614 | ||
615 | template<typename _FIter> | |
616 | _GLIBCXX20_CONSTEXPR | |
617 | _FIter | |
618 | rotate(_FIter, _FIter, _FIter); | |
619 | ||
620 | _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2) | |
621 | ||
622 | template<typename _FIter, typename _OIter> | |
623 | _GLIBCXX20_CONSTEXPR | |
624 | _OIter | |
625 | rotate_copy(_FIter, _FIter, _FIter, _OIter); | |
626 | ||
627 | // search | |
628 | // search_n | |
629 | // set_difference | |
630 | // set_intersection | |
631 | // set_symmetric_difference | |
632 | // set_union | |
633 | ||
634 | #if __cplusplus >= 201103L | |
635 | template<typename _RAIter, typename _UGenerator> | |
636 | void | |
637 | shuffle(_RAIter, _RAIter, _UGenerator&&); | |
638 | #endif | |
639 | ||
640 | template<typename _RAIter> | |
641 | _GLIBCXX20_CONSTEXPR | |
642 | void | |
643 | sort_heap(_RAIter, _RAIter); | |
644 | ||
645 | template<typename _RAIter, typename _Compare> | |
646 | _GLIBCXX20_CONSTEXPR | |
647 | void | |
648 | sort_heap(_RAIter, _RAIter, _Compare); | |
649 | ||
650 | #if _GLIBCXX_HOSTED | |
651 | template<typename _BIter, typename _Predicate> | |
652 | _GLIBCXX26_CONSTEXPR | |
653 | _BIter | |
654 | stable_partition(_BIter, _BIter, _Predicate); | |
655 | #endif | |
656 | ||
657 | #if __cplusplus < 201103L | |
658 | // For C++11 swap() is declared in <type_traits>. | |
659 | ||
660 | template<typename _Tp, size_t _Nm> | |
661 | _GLIBCXX20_CONSTEXPR | |
662 | inline void | |
663 | swap(_Tp& __a, _Tp& __b); | |
664 | ||
665 | template<typename _Tp, size_t _Nm> | |
666 | _GLIBCXX20_CONSTEXPR | |
667 | inline void | |
668 | swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm]); | |
669 | #endif | |
670 | ||
671 | template<typename _FIter1, typename _FIter2> | |
672 | _GLIBCXX20_CONSTEXPR | |
673 | _FIter2 | |
674 | swap_ranges(_FIter1, _FIter1, _FIter2); | |
675 | ||
676 | // transform | |
677 | ||
678 | template<typename _FIter> | |
679 | _GLIBCXX20_CONSTEXPR | |
680 | _FIter | |
681 | unique(_FIter, _FIter); | |
682 | ||
683 | template<typename _FIter, typename _BinaryPredicate> | |
684 | _GLIBCXX20_CONSTEXPR | |
685 | _FIter | |
686 | unique(_FIter, _FIter, _BinaryPredicate); | |
687 | ||
688 | // unique_copy | |
689 | ||
690 | template<typename _FIter, typename _Tp _GLIBCXX26_ALGO_DEF_VAL_T(_FIter)> | |
691 | _GLIBCXX20_CONSTEXPR | |
692 | _FIter | |
693 | upper_bound(_FIter, _FIter, const _Tp&); | |
694 | ||
695 | template<typename _FIter, typename _Tp _GLIBCXX26_ALGO_DEF_VAL_T(_FIter), | |
696 | typename _Compare> | |
697 | _GLIBCXX20_CONSTEXPR | |
698 | _FIter | |
699 | upper_bound(_FIter, _FIter, const _Tp&, _Compare); | |
700 | ||
701 | _GLIBCXX_BEGIN_NAMESPACE_ALGO | |
702 | ||
703 | template<typename _FIter> | |
704 | _GLIBCXX20_CONSTEXPR | |
705 | _FIter | |
706 | adjacent_find(_FIter, _FIter); | |
707 | ||
708 | template<typename _FIter, typename _BinaryPredicate> | |
709 | _GLIBCXX20_CONSTEXPR | |
710 | _FIter | |
711 | adjacent_find(_FIter, _FIter, _BinaryPredicate); | |
712 | ||
713 | template<typename _IIter, typename _Tp _GLIBCXX26_ALGO_DEF_VAL_T(_IIter)> | |
714 | _GLIBCXX20_CONSTEXPR | |
715 | typename iterator_traits<_IIter>::difference_type | |
716 | count(_IIter, _IIter, const _Tp&); | |
717 | ||
718 | template<typename _IIter, typename _Predicate> | |
719 | _GLIBCXX20_CONSTEXPR | |
720 | typename iterator_traits<_IIter>::difference_type | |
721 | count_if(_IIter, _IIter, _Predicate); | |
722 | ||
723 | template<typename _IIter1, typename _IIter2> | |
724 | _GLIBCXX20_CONSTEXPR | |
725 | bool | |
726 | equal(_IIter1, _IIter1, _IIter2); | |
727 | ||
728 | template<typename _IIter1, typename _IIter2, typename _BinaryPredicate> | |
729 | _GLIBCXX20_CONSTEXPR | |
730 | bool | |
731 | equal(_IIter1, _IIter1, _IIter2, _BinaryPredicate); | |
732 | ||
733 | template<typename _IIter, typename _Tp _GLIBCXX26_ALGO_DEF_VAL_T(_IIter)> | |
734 | _GLIBCXX20_CONSTEXPR | |
735 | _IIter | |
736 | find(_IIter, _IIter, const _Tp&); | |
737 | ||
738 | template<typename _FIter1, typename _FIter2> | |
739 | _GLIBCXX20_CONSTEXPR | |
740 | _FIter1 | |
741 | find_first_of(_FIter1, _FIter1, _FIter2, _FIter2); | |
742 | ||
743 | template<typename _FIter1, typename _FIter2, typename _BinaryPredicate> | |
744 | _GLIBCXX20_CONSTEXPR | |
745 | _FIter1 | |
746 | find_first_of(_FIter1, _FIter1, _FIter2, _FIter2, _BinaryPredicate); | |
747 | ||
748 | template<typename _IIter, typename _Predicate> | |
749 | _GLIBCXX20_CONSTEXPR | |
750 | _IIter | |
751 | find_if(_IIter, _IIter, _Predicate); | |
752 | ||
753 | template<typename _IIter, typename _Funct> | |
754 | _GLIBCXX20_CONSTEXPR | |
755 | _Funct | |
756 | for_each(_IIter, _IIter, _Funct); | |
757 | ||
758 | template<typename _FIter, typename _Generator> | |
759 | _GLIBCXX20_CONSTEXPR | |
760 | void | |
761 | generate(_FIter, _FIter, _Generator); | |
762 | ||
763 | template<typename _OIter, typename _Size, typename _Generator> | |
764 | _GLIBCXX20_CONSTEXPR | |
765 | _OIter | |
766 | generate_n(_OIter, _Size, _Generator); | |
767 | ||
768 | template<typename _IIter1, typename _IIter2> | |
769 | _GLIBCXX20_CONSTEXPR | |
770 | bool | |
771 | lexicographical_compare(_IIter1, _IIter1, _IIter2, _IIter2); | |
772 | ||
773 | template<typename _IIter1, typename _IIter2, typename _Compare> | |
774 | _GLIBCXX20_CONSTEXPR | |
775 | bool | |
776 | lexicographical_compare(_IIter1, _IIter1, _IIter2, _IIter2, _Compare); | |
777 | ||
778 | template<typename _FIter> | |
779 | _GLIBCXX14_CONSTEXPR | |
780 | _FIter | |
781 | max_element(_FIter, _FIter); | |
782 | ||
783 | template<typename _FIter, typename _Compare> | |
784 | _GLIBCXX14_CONSTEXPR | |
785 | _FIter | |
786 | max_element(_FIter, _FIter, _Compare); | |
787 | ||
788 | template<typename _IIter1, typename _IIter2, typename _OIter> | |
789 | _GLIBCXX20_CONSTEXPR | |
790 | _OIter | |
791 | merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter); | |
792 | ||
793 | template<typename _IIter1, typename _IIter2, typename _OIter, | |
794 | typename _Compare> | |
795 | _GLIBCXX20_CONSTEXPR | |
796 | _OIter | |
797 | merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare); | |
798 | ||
799 | template<typename _FIter> | |
800 | _GLIBCXX14_CONSTEXPR | |
801 | _FIter | |
802 | min_element(_FIter, _FIter); | |
803 | ||
804 | template<typename _FIter, typename _Compare> | |
805 | _GLIBCXX14_CONSTEXPR | |
806 | _FIter | |
807 | min_element(_FIter, _FIter, _Compare); | |
808 | ||
809 | template<typename _IIter1, typename _IIter2> | |
810 | _GLIBCXX20_CONSTEXPR | |
811 | pair<_IIter1, _IIter2> | |
812 | mismatch(_IIter1, _IIter1, _IIter2); | |
813 | ||
814 | template<typename _IIter1, typename _IIter2, typename _BinaryPredicate> | |
815 | _GLIBCXX20_CONSTEXPR | |
816 | pair<_IIter1, _IIter2> | |
817 | mismatch(_IIter1, _IIter1, _IIter2, _BinaryPredicate); | |
818 | ||
819 | template<typename _RAIter> | |
820 | _GLIBCXX20_CONSTEXPR | |
821 | void | |
822 | nth_element(_RAIter, _RAIter, _RAIter); | |
823 | ||
824 | template<typename _RAIter, typename _Compare> | |
825 | _GLIBCXX20_CONSTEXPR | |
826 | void | |
827 | nth_element(_RAIter, _RAIter, _RAIter, _Compare); | |
828 | ||
829 | template<typename _RAIter> | |
830 | _GLIBCXX20_CONSTEXPR | |
831 | void | |
832 | partial_sort(_RAIter, _RAIter, _RAIter); | |
833 | ||
834 | template<typename _RAIter, typename _Compare> | |
835 | _GLIBCXX20_CONSTEXPR | |
836 | void | |
837 | partial_sort(_RAIter, _RAIter, _RAIter, _Compare); | |
838 | ||
839 | template<typename _BIter, typename _Predicate> | |
840 | _GLIBCXX20_CONSTEXPR | |
841 | _BIter | |
842 | partition(_BIter, _BIter, _Predicate); | |
843 | ||
844 | #if _GLIBCXX_HOSTED | |
845 | template<typename _RAIter> | |
846 | _GLIBCXX14_DEPRECATED_SUGGEST("std::shuffle") | |
847 | void | |
848 | random_shuffle(_RAIter, _RAIter); | |
849 | ||
850 | template<typename _RAIter, typename _Generator> | |
851 | _GLIBCXX14_DEPRECATED_SUGGEST("std::shuffle") | |
852 | void | |
853 | random_shuffle(_RAIter, _RAIter, | |
854 | #if __cplusplus >= 201103L | |
855 | _Generator&&); | |
856 | #else | |
857 | _Generator&); | |
858 | #endif | |
859 | #endif // HOSTED | |
860 | ||
861 | template<typename _FIter, typename _Tp _GLIBCXX26_ALGO_DEF_VAL_T(_FIter)> | |
862 | _GLIBCXX20_CONSTEXPR | |
863 | void | |
864 | replace(_FIter, _FIter, const _Tp&, const _Tp&); | |
865 | ||
866 | template<typename _FIter, typename _Predicate, | |
867 | typename _Tp _GLIBCXX26_ALGO_DEF_VAL_T(_FIter)> | |
868 | _GLIBCXX20_CONSTEXPR | |
869 | void | |
870 | replace_if(_FIter, _FIter, _Predicate, const _Tp&); | |
871 | ||
872 | template<typename _FIter1, typename _FIter2> | |
873 | _GLIBCXX20_CONSTEXPR | |
874 | _FIter1 | |
875 | search(_FIter1, _FIter1, _FIter2, _FIter2); | |
876 | ||
877 | template<typename _FIter1, typename _FIter2, typename _BinaryPredicate> | |
878 | _GLIBCXX20_CONSTEXPR | |
879 | _FIter1 | |
880 | search(_FIter1, _FIter1, _FIter2, _FIter2, _BinaryPredicate); | |
881 | ||
882 | template<typename _FIter, typename _Size, | |
883 | typename _Tp _GLIBCXX26_ALGO_DEF_VAL_T(_FIter)> | |
884 | _GLIBCXX20_CONSTEXPR | |
885 | _FIter | |
886 | search_n(_FIter, _FIter, _Size, const _Tp&); | |
887 | ||
888 | template<typename _FIter, typename _Size, | |
889 | typename _Tp _GLIBCXX26_ALGO_DEF_VAL_T(_FIter), | |
890 | typename _BinaryPredicate> | |
891 | _GLIBCXX20_CONSTEXPR | |
892 | _FIter | |
893 | search_n(_FIter, _FIter, _Size, const _Tp&, _BinaryPredicate); | |
894 | ||
895 | template<typename _IIter1, typename _IIter2, typename _OIter> | |
896 | _GLIBCXX20_CONSTEXPR | |
897 | _OIter | |
898 | set_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter); | |
899 | ||
900 | template<typename _IIter1, typename _IIter2, typename _OIter, | |
901 | typename _Compare> | |
902 | _GLIBCXX20_CONSTEXPR | |
903 | _OIter | |
904 | set_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare); | |
905 | ||
906 | template<typename _IIter1, typename _IIter2, typename _OIter> | |
907 | _GLIBCXX20_CONSTEXPR | |
908 | _OIter | |
909 | set_intersection(_IIter1, _IIter1, _IIter2, _IIter2, _OIter); | |
910 | ||
911 | template<typename _IIter1, typename _IIter2, typename _OIter, | |
912 | typename _Compare> | |
913 | _GLIBCXX20_CONSTEXPR | |
914 | _OIter | |
915 | set_intersection(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare); | |
916 | ||
917 | template<typename _IIter1, typename _IIter2, typename _OIter> | |
918 | _GLIBCXX20_CONSTEXPR | |
919 | _OIter | |
920 | set_symmetric_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter); | |
921 | ||
922 | template<typename _IIter1, typename _IIter2, typename _OIter, | |
923 | typename _Compare> | |
924 | _GLIBCXX20_CONSTEXPR | |
925 | _OIter | |
926 | set_symmetric_difference(_IIter1, _IIter1, _IIter2, _IIter2, | |
927 | _OIter, _Compare); | |
928 | ||
929 | template<typename _IIter1, typename _IIter2, typename _OIter> | |
930 | _GLIBCXX20_CONSTEXPR | |
931 | _OIter | |
932 | set_union(_IIter1, _IIter1, _IIter2, _IIter2, _OIter); | |
933 | ||
934 | template<typename _IIter1, typename _IIter2, typename _OIter, | |
935 | typename _Compare> | |
936 | _GLIBCXX20_CONSTEXPR | |
937 | _OIter | |
938 | set_union(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare); | |
939 | ||
940 | template<typename _RAIter> | |
941 | _GLIBCXX20_CONSTEXPR | |
942 | void | |
943 | sort(_RAIter, _RAIter); | |
944 | ||
945 | template<typename _RAIter, typename _Compare> | |
946 | _GLIBCXX20_CONSTEXPR | |
947 | void | |
948 | sort(_RAIter, _RAIter, _Compare); | |
949 | ||
950 | template<typename _RAIter> | |
951 | _GLIBCXX26_CONSTEXPR | |
952 | void | |
953 | stable_sort(_RAIter, _RAIter); | |
954 | ||
955 | template<typename _RAIter, typename _Compare> | |
956 | _GLIBCXX26_CONSTEXPR | |
957 | void | |
958 | stable_sort(_RAIter, _RAIter, _Compare); | |
959 | ||
960 | template<typename _IIter, typename _OIter, typename _UnaryOperation> | |
961 | _GLIBCXX20_CONSTEXPR | |
962 | _OIter | |
963 | transform(_IIter, _IIter, _OIter, _UnaryOperation); | |
964 | ||
965 | template<typename _IIter1, typename _IIter2, typename _OIter, | |
966 | typename _BinaryOperation> | |
967 | _GLIBCXX20_CONSTEXPR | |
968 | _OIter | |
969 | transform(_IIter1, _IIter1, _IIter2, _OIter, _BinaryOperation); | |
970 | ||
971 | template<typename _IIter, typename _OIter> | |
972 | _GLIBCXX20_CONSTEXPR | |
973 | _OIter | |
974 | unique_copy(_IIter, _IIter, _OIter); | |
975 | ||
976 | template<typename _IIter, typename _OIter, typename _BinaryPredicate> | |
977 | _GLIBCXX20_CONSTEXPR | |
978 | _OIter | |
979 | unique_copy(_IIter, _IIter, _OIter, _BinaryPredicate); | |
980 | ||
981 | _GLIBCXX_END_NAMESPACE_ALGO | |
982 | _GLIBCXX_END_NAMESPACE_VERSION | |
983 | } // namespace std | |
984 | ||
985 | #pragma GCC diagnostic pop | |
986 | ||
987 | #ifdef _GLIBCXX_PARALLEL | |
988 | # include <parallel/algorithmfwd.h> | |
989 | #endif | |
990 | ||
991 | #endif | |
992 |