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