37 #ifndef _GLIBCXX_PARALLEL_ALGO_H
38 #define _GLIBCXX_PARALLEL_ALGO_H 1
61 namespace std _GLIBCXX_VISIBILITY(default)
66 template<
typename _IIter,
typename _Function>
68 for_each(_IIter __begin, _IIter __end, _Function __f,
70 {
return _GLIBCXX_STD_A::for_each(__begin, __end, __f); }
73 template<
typename _IIter,
typename _Function,
typename _IteratorTag>
75 __for_each_switch(_IIter __begin, _IIter __end, _Function __f,
80 template<
typename _RAIter,
typename _Function>
82 __for_each_switch(_RAIter __begin, _RAIter __end,
89 && __gnu_parallel::__is_parallel(__parallelism_tag)))
96 __begin, __end, __f, __functionality,
105 template<
typename _Iterator,
typename _Function>
107 for_each(_Iterator __begin, _Iterator __end, _Function __f,
110 return __for_each_switch(__begin, __end, __f,
115 template<
typename _Iterator,
typename _Function>
117 for_each(_Iterator __begin, _Iterator __end, _Function __f)
119 return __for_each_switch(__begin, __end, __f,
124 template<
typename _IIter,
typename _Tp>
126 find(_IIter __begin, _IIter __end,
const _Tp& __val,
128 {
return _GLIBCXX_STD_A::find(__begin, __end, __val); }
131 template<
typename _IIter,
typename _Tp,
typename _IteratorTag>
133 __find_switch(_IIter __begin, _IIter __end,
const _Tp& __val,
135 {
return _GLIBCXX_STD_A::find(__begin, __end, __val); }
138 template<
typename _RAIter,
typename _Tp>
140 __find_switch(_RAIter __begin, _RAIter __end,
144 typedef typename _TraitsType::value_type _ValueType;
150 _ValueType,
const _Tp&,
bool>
153 __begin, __end, __begin, __comp,
157 return _GLIBCXX_STD_A::find(__begin, __end, __val);
161 template<
typename _IIter,
typename _Tp>
163 find(_IIter __begin, _IIter __end,
const _Tp& __val)
165 return __find_switch(__begin, __end, __val,
170 template<
typename _IIter,
typename _Predicate>
172 find_if(_IIter __begin, _IIter __end, _Predicate __pred,
174 {
return _GLIBCXX_STD_A::find_if(__begin, __end, __pred); }
177 template<
typename _IIter,
typename _Predicate,
typename _IteratorTag>
179 __find_if_switch(_IIter __begin, _IIter __end, _Predicate __pred,
181 {
return _GLIBCXX_STD_A::find_if(__begin, __end, __pred); }
184 template<
typename _RAIter,
typename _Predicate>
186 __find_if_switch(_RAIter __begin, _RAIter __end,
192 __find_if_selector()).first;
194 return _GLIBCXX_STD_A::find_if(__begin, __end, __pred);
198 template<
typename _IIter,
typename _Predicate>
200 find_if(_IIter __begin, _IIter __end, _Predicate __pred)
202 return __find_if_switch(__begin, __end, __pred,
207 template<
typename _IIter,
typename _FIterator>
209 find_first_of(_IIter __begin1, _IIter __end1,
210 _FIterator __begin2, _FIterator __end2,
213 return _GLIBCXX_STD_A::find_first_of(__begin1, __end1, __begin2, __end2);
217 template<
typename _IIter,
typename _FIterator,
218 typename _BinaryPredicate>
220 find_first_of(_IIter __begin1, _IIter __end1,
221 _FIterator __begin2, _FIterator __end2,
223 {
return _GLIBCXX_STD_A::find_first_of(
224 __begin1, __end1, __begin2, __end2, __comp); }
227 template<
typename _IIter,
typename _FIterator,
228 typename _IteratorTag1,
typename _IteratorTag2>
230 __find_first_of_switch(_IIter __begin1, _IIter __end1,
231 _FIterator __begin2, _FIterator __end2,
232 _IteratorTag1, _IteratorTag2)
233 {
return find_first_of(__begin1, __end1, __begin2, __end2,
237 template<
typename _RAIter,
typename _FIterator,
238 typename _BinaryPredicate,
typename _IteratorTag>
240 __find_first_of_switch(_RAIter __begin1,
242 _FIterator __begin2, _FIterator __end2,
249 <_FIterator>(__begin2, __end2)).first;
253 template<
typename _IIter,
typename _FIterator,
254 typename _BinaryPredicate,
typename _IteratorTag1,
255 typename _IteratorTag2>
257 __find_first_of_switch(_IIter __begin1, _IIter __end1,
258 _FIterator __begin2, _FIterator __end2,
259 _BinaryPredicate __comp, _IteratorTag1, _IteratorTag2)
260 {
return find_first_of(__begin1, __end1, __begin2, __end2, __comp,
264 template<
typename _IIter,
typename _FIterator,
265 typename _BinaryPredicate>
267 find_first_of(_IIter __begin1, _IIter __end1,
268 _FIterator __begin2, _FIterator __end2,
269 _BinaryPredicate __comp)
271 return __find_first_of_switch(__begin1, __end1, __begin2, __end2, __comp,
277 template<
typename _IIter,
typename _FIterator>
279 find_first_of(_IIter __begin1, _IIter __end1,
280 _FIterator __begin2, _FIterator __end2)
285 return __gnu_parallel::find_first_of(__begin1, __end1, __begin2, __end2,
290 template<
typename _IIter,
typename _OutputIterator>
291 inline _OutputIterator
292 unique_copy(_IIter __begin1, _IIter __end1, _OutputIterator __out,
294 {
return _GLIBCXX_STD_A::unique_copy(__begin1, __end1, __out); }
297 template<
typename _IIter,
typename _OutputIterator,
299 inline _OutputIterator
300 unique_copy(_IIter __begin1, _IIter __end1, _OutputIterator __out,
302 {
return _GLIBCXX_STD_A::unique_copy(__begin1, __end1, __out, __pred); }
305 template<
typename _IIter,
typename _OutputIterator,
306 typename _Predicate,
typename _IteratorTag1,
typename _IteratorTag2>
307 inline _OutputIterator
308 __unique_copy_switch(_IIter __begin, _IIter __last,
309 _OutputIterator __out, _Predicate __pred,
310 _IteratorTag1, _IteratorTag2)
311 {
return _GLIBCXX_STD_A::unique_copy(__begin, __last, __out, __pred); }
314 template<
typename _RAIter,
typename _RandomAccessOutputIterator,
316 _RandomAccessOutputIterator
317 __unique_copy_switch(_RAIter __begin, _RAIter __last,
318 _RandomAccessOutputIterator __out, _Predicate __pred,
325 __begin, __last, __out, __pred);
327 return _GLIBCXX_STD_A::unique_copy(__begin, __last, __out, __pred);
331 template<
typename _IIter,
typename _OutputIterator>
332 inline _OutputIterator
333 unique_copy(_IIter __begin1, _IIter __end1, _OutputIterator __out)
337 return __unique_copy_switch(
344 template<
typename _IIter,
typename _OutputIterator,
typename _Predicate>
345 inline _OutputIterator
346 unique_copy(_IIter __begin1, _IIter __end1, _OutputIterator __out,
349 return __unique_copy_switch(
350 __begin1, __end1, __out, __pred,
356 template<
typename _IIter1,
typename _IIter2,
357 typename _OutputIterator>
358 inline _OutputIterator
359 set_union(_IIter1 __begin1, _IIter1 __end1,
360 _IIter2 __begin2, _IIter2 __end2,
362 {
return _GLIBCXX_STD_A::set_union(
363 __begin1, __end1, __begin2, __end2, __out); }
366 template<
typename _IIter1,
typename _IIter2,
367 typename _OutputIterator,
typename _Predicate>
368 inline _OutputIterator
369 set_union(_IIter1 __begin1, _IIter1 __end1,
370 _IIter2 __begin2, _IIter2 __end2,
371 _OutputIterator __out, _Predicate __pred,
373 {
return _GLIBCXX_STD_A::set_union(__begin1, __end1,
374 __begin2, __end2, __out, __pred); }
377 template<
typename _IIter1,
typename _IIter2,
typename _Predicate,
378 typename _OutputIterator,
typename _IteratorTag1,
379 typename _IteratorTag2,
typename _IteratorTag3>
380 inline _OutputIterator
382 _IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2, _IIter2 __end2,
383 _OutputIterator __result, _Predicate __pred,
384 _IteratorTag1, _IteratorTag2, _IteratorTag3)
385 {
return _GLIBCXX_STD_A::set_union(__begin1, __end1,
386 __begin2, __end2, __result, __pred); }
389 template<
typename _RAIter1,
typename _RAIter2,
390 typename _Output_RAIter,
typename _Predicate>
392 __set_union_switch(_RAIter1 __begin1, _RAIter1 __end1,
393 _RAIter2 __begin2, _RAIter2 __end2,
394 _Output_RAIter __result, _Predicate __pred,
403 return __gnu_parallel::__parallel_set_union(
404 __begin1, __end1, __begin2, __end2, __result, __pred);
406 return _GLIBCXX_STD_A::set_union(__begin1, __end1,
407 __begin2, __end2, __result, __pred);
411 template<
typename _IIter1,
typename _IIter2,
412 typename _OutputIterator>
413 inline _OutputIterator
414 set_union(_IIter1 __begin1, _IIter1 __end1,
415 _IIter2 __begin2, _IIter2 __end2, _OutputIterator __out)
420 return __set_union_switch(
421 __begin1, __end1, __begin2, __end2, __out,
429 template<
typename _IIter1,
typename _IIter2,
430 typename _OutputIterator,
typename _Predicate>
431 inline _OutputIterator
432 set_union(_IIter1 __begin1, _IIter1 __end1,
433 _IIter2 __begin2, _IIter2 __end2,
434 _OutputIterator __out, _Predicate __pred)
436 return __set_union_switch(
437 __begin1, __end1, __begin2, __end2, __out, __pred,
444 template<
typename _IIter1,
typename _IIter2,
445 typename _OutputIterator>
446 inline _OutputIterator
447 set_intersection(_IIter1 __begin1, _IIter1 __end1,
448 _IIter2 __begin2, _IIter2 __end2,
450 {
return _GLIBCXX_STD_A::set_intersection(__begin1, __end1,
451 __begin2, __end2, __out); }
454 template<
typename _IIter1,
typename _IIter2,
455 typename _OutputIterator,
typename _Predicate>
456 inline _OutputIterator
457 set_intersection(_IIter1 __begin1, _IIter1 __end1,
458 _IIter2 __begin2, _IIter2 __end2,
459 _OutputIterator __out, _Predicate __pred,
461 {
return _GLIBCXX_STD_A::set_intersection(
462 __begin1, __end1, __begin2, __end2, __out, __pred); }
465 template<
typename _IIter1,
typename _IIter2,
466 typename _Predicate,
typename _OutputIterator,
467 typename _IteratorTag1,
typename _IteratorTag2,
468 typename _IteratorTag3>
469 inline _OutputIterator
470 __set_intersection_switch(_IIter1 __begin1, _IIter1 __end1,
471 _IIter2 __begin2, _IIter2 __end2,
472 _OutputIterator __result, _Predicate __pred,
473 _IteratorTag1, _IteratorTag2, _IteratorTag3)
474 {
return _GLIBCXX_STD_A::set_intersection(__begin1, __end1, __begin2,
475 __end2, __result, __pred); }
478 template<
typename _RAIter1,
typename _RAIter2,
479 typename _Output_RAIter,
typename _Predicate>
481 __set_intersection_switch(_RAIter1 __begin1,
485 _Output_RAIter __result,
496 return __gnu_parallel::__parallel_set_intersection(
497 __begin1, __end1, __begin2, __end2, __result, __pred);
499 return _GLIBCXX_STD_A::set_intersection(
500 __begin1, __end1, __begin2, __end2, __result, __pred);
504 template<
typename _IIter1,
typename _IIter2,
505 typename _OutputIterator>
506 inline _OutputIterator
507 set_intersection(_IIter1 __begin1, _IIter1 __end1,
508 _IIter2 __begin2, _IIter2 __end2,
509 _OutputIterator __out)
514 return __set_intersection_switch(
515 __begin1, __end1, __begin2, __end2, __out,
522 template<
typename _IIter1,
typename _IIter2,
523 typename _OutputIterator,
typename _Predicate>
524 inline _OutputIterator
525 set_intersection(_IIter1 __begin1, _IIter1 __end1,
526 _IIter2 __begin2, _IIter2 __end2,
527 _OutputIterator __out, _Predicate __pred)
529 return __set_intersection_switch(
530 __begin1, __end1, __begin2, __end2, __out, __pred,
537 template<
typename _IIter1,
typename _IIter2,
538 typename _OutputIterator>
539 inline _OutputIterator
540 set_symmetric_difference(_IIter1 __begin1, _IIter1 __end1,
541 _IIter2 __begin2, _IIter2 __end2,
542 _OutputIterator __out,
544 {
return _GLIBCXX_STD_A::set_symmetric_difference(
545 __begin1, __end1, __begin2, __end2, __out); }
548 template<
typename _IIter1,
typename _IIter2,
549 typename _OutputIterator,
typename _Predicate>
550 inline _OutputIterator
551 set_symmetric_difference(_IIter1 __begin1, _IIter1 __end1,
552 _IIter2 __begin2, _IIter2 __end2,
553 _OutputIterator __out, _Predicate __pred,
555 {
return _GLIBCXX_STD_A::set_symmetric_difference(
556 __begin1, __end1, __begin2, __end2, __out, __pred); }
559 template<
typename _IIter1,
typename _IIter2,
560 typename _Predicate,
typename _OutputIterator,
561 typename _IteratorTag1,
typename _IteratorTag2,
562 typename _IteratorTag3>
563 inline _OutputIterator
564 __set_symmetric_difference_switch(
565 _IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2, _IIter2 __end2,
566 _OutputIterator __result, _Predicate __pred,
567 _IteratorTag1, _IteratorTag2, _IteratorTag3)
568 {
return _GLIBCXX_STD_A::set_symmetric_difference(
569 __begin1, __end1, __begin2, __end2, __result, __pred); }
572 template<
typename _RAIter1,
typename _RAIter2,
573 typename _Output_RAIter,
typename _Predicate>
575 __set_symmetric_difference_switch(_RAIter1 __begin1,
579 _Output_RAIter __result,
590 return __gnu_parallel::__parallel_set_symmetric_difference(
591 __begin1, __end1, __begin2, __end2, __result, __pred);
593 return _GLIBCXX_STD_A::set_symmetric_difference(
594 __begin1, __end1, __begin2, __end2, __result, __pred);
598 template<
typename _IIter1,
typename _IIter2,
599 typename _OutputIterator>
600 inline _OutputIterator
601 set_symmetric_difference(_IIter1 __begin1, _IIter1 __end1,
602 _IIter2 __begin2, _IIter2 __end2,
603 _OutputIterator __out)
608 return __set_symmetric_difference_switch(
609 __begin1, __end1, __begin2, __end2, __out,
617 template<
typename _IIter1,
typename _IIter2,
618 typename _OutputIterator,
typename _Predicate>
619 inline _OutputIterator
620 set_symmetric_difference(_IIter1 __begin1, _IIter1 __end1,
621 _IIter2 __begin2, _IIter2 __end2,
622 _OutputIterator __out, _Predicate __pred)
624 return __set_symmetric_difference_switch(
625 __begin1, __end1, __begin2, __end2, __out, __pred,
632 template<
typename _IIter1,
typename _IIter2,
633 typename _OutputIterator>
634 inline _OutputIterator
635 set_difference(_IIter1 __begin1, _IIter1 __end1,
636 _IIter2 __begin2, _IIter2 __end2,
638 {
return _GLIBCXX_STD_A::set_difference(
639 __begin1,__end1, __begin2, __end2, __out); }
642 template<
typename _IIter1,
typename _IIter2,
643 typename _OutputIterator,
typename _Predicate>
644 inline _OutputIterator
645 set_difference(_IIter1 __begin1, _IIter1 __end1,
646 _IIter2 __begin2, _IIter2 __end2,
647 _OutputIterator __out, _Predicate __pred,
649 {
return _GLIBCXX_STD_A::set_difference(__begin1, __end1,
650 __begin2, __end2, __out, __pred); }
653 template<
typename _IIter1,
typename _IIter2,
typename _Predicate,
654 typename _OutputIterator,
typename _IteratorTag1,
655 typename _IteratorTag2,
typename _IteratorTag3>
656 inline _OutputIterator
657 __set_difference_switch(_IIter1 __begin1, _IIter1 __end1,
658 _IIter2 __begin2, _IIter2 __end2,
659 _OutputIterator __result, _Predicate __pred,
660 _IteratorTag1, _IteratorTag2, _IteratorTag3)
661 {
return _GLIBCXX_STD_A::set_difference(
662 __begin1, __end1, __begin2, __end2, __result, __pred); }
665 template<
typename _RAIter1,
typename _RAIter2,
666 typename _Output_RAIter,
typename _Predicate>
668 __set_difference_switch(_RAIter1 __begin1,
672 _Output_RAIter __result, _Predicate __pred,
682 return __gnu_parallel::__parallel_set_difference(
683 __begin1, __end1, __begin2, __end2, __result, __pred);
685 return _GLIBCXX_STD_A::set_difference(
686 __begin1, __end1, __begin2, __end2, __result, __pred);
690 template<
typename _IIter1,
typename _IIter2,
691 typename _OutputIterator>
692 inline _OutputIterator
693 set_difference(_IIter1 __begin1, _IIter1 __end1,
694 _IIter2 __begin2, _IIter2 __end2,
695 _OutputIterator __out)
700 return __set_difference_switch(
701 __begin1, __end1, __begin2, __end2, __out,
709 template<
typename _IIter1,
typename _IIter2,
710 typename _OutputIterator,
typename _Predicate>
711 inline _OutputIterator
712 set_difference(_IIter1 __begin1, _IIter1 __end1,
713 _IIter2 __begin2, _IIter2 __end2,
714 _OutputIterator __out, _Predicate __pred)
716 return __set_difference_switch(
717 __begin1, __end1, __begin2, __end2, __out, __pred,
724 template<
typename _FIterator>
726 adjacent_find(_FIterator __begin, _FIterator __end,
728 {
return _GLIBCXX_STD_A::adjacent_find(__begin, __end); }
731 template<
typename _FIterator,
typename _BinaryPredicate>
733 adjacent_find(_FIterator __begin, _FIterator __end,
734 _BinaryPredicate __binary_pred,
736 {
return _GLIBCXX_STD_A::adjacent_find(__begin, __end, __binary_pred); }
739 template<
typename _RAIter>
741 __adjacent_find_switch(_RAIter __begin, _RAIter __end,
745 typedef typename _TraitsType::value_type _ValueType;
754 if (__spot == (__end - 1))
764 template<
typename _FIterator,
typename _IteratorTag>
766 __adjacent_find_switch(_FIterator __begin, _FIterator __end,
771 template<
typename _FIterator>
773 adjacent_find(_FIterator __begin, _FIterator __end)
775 return __adjacent_find_switch(__begin, __end,
780 template<
typename _FIterator,
typename _BinaryPredicate,
781 typename _IteratorTag>
783 __adjacent_find_switch(_FIterator __begin, _FIterator __end,
784 _BinaryPredicate __pred, _IteratorTag)
785 {
return adjacent_find(__begin, __end, __pred,
789 template<
typename _RAIter,
typename _BinaryPredicate>
791 __adjacent_find_switch(_RAIter __begin, _RAIter __end,
797 __adjacent_find_selector()).first;
799 return adjacent_find(__begin, __end, __pred,
804 template<
typename _FIterator,
typename _BinaryPredicate>
806 adjacent_find(_FIterator __begin, _FIterator __end,
807 _BinaryPredicate __pred)
809 return __adjacent_find_switch(__begin, __end, __pred,
814 template<
typename _IIter,
typename _Tp>
816 count(_IIter __begin, _IIter __end,
const _Tp& __value,
818 {
return _GLIBCXX_STD_A::count(__begin, __end, __value); }
821 template<
typename _RAIter,
typename _Tp>
823 __count_switch(_RAIter __begin, _RAIter __end,
828 typedef typename _TraitsType::value_type _ValueType;
829 typedef typename _TraitsType::difference_type _DifferenceType;
835 && __gnu_parallel::__is_parallel(__parallelism_tag)))
839 _DifferenceType __res = 0;
842 __begin, __end, __value, __functionality,
848 return count(__begin, __end, __value,
853 template<
typename _IIter,
typename _Tp,
typename _IteratorTag>
855 __count_switch(_IIter __begin, _IIter __end,
const _Tp& __value,
861 template<
typename _IIter,
typename _Tp>
863 count(_IIter __begin, _IIter __end,
const _Tp& __value,
866 return __count_switch(__begin, __end, __value,
871 template<
typename _IIter,
typename _Tp>
873 count(_IIter __begin, _IIter __end,
const _Tp& __value)
875 return __count_switch(__begin, __end, __value,
881 template<
typename _IIter,
typename _Predicate>
883 count_if(_IIter __begin, _IIter __end, _Predicate __pred,
885 {
return _GLIBCXX_STD_A::count_if(__begin, __end, __pred); }
888 template<
typename _RAIter,
typename _Predicate>
890 __count_if_switch(_RAIter __begin, _RAIter __end,
895 typedef typename _TraitsType::value_type _ValueType;
896 typedef typename _TraitsType::difference_type _DifferenceType;
902 && __gnu_parallel::__is_parallel(__parallelism_tag)))
904 _DifferenceType __res = 0;
906 __count_if_selector<_RAIter, _DifferenceType>
910 __begin, __end, __pred, __functionality,
916 return count_if(__begin, __end, __pred,
921 template<
typename _IIter,
typename _Predicate,
typename _IteratorTag>
923 __count_if_switch(_IIter __begin, _IIter __end, _Predicate __pred,
925 {
return count_if(__begin, __end, __pred,
929 template<
typename _IIter,
typename _Predicate>
931 count_if(_IIter __begin, _IIter __end, _Predicate __pred,
934 return __count_if_switch(__begin, __end, __pred,
939 template<
typename _IIter,
typename _Predicate>
941 count_if(_IIter __begin, _IIter __end, _Predicate __pred)
943 return __count_if_switch(__begin, __end, __pred,
949 template<
typename _FIterator1,
typename _FIterator2>
951 search(_FIterator1 __begin1, _FIterator1 __end1,
952 _FIterator2 __begin2, _FIterator2 __end2,
957 template<
typename _RAIter1,
typename _RAIter2>
959 __search_switch(_RAIter1 __begin1, _RAIter1 __end1,
960 _RAIter2 __begin2, _RAIter2 __end2,
971 __begin1, __end1, __begin2, __end2,
974 return search(__begin1, __end1, __begin2, __end2,
979 template<
typename _FIterator1,
typename _FIterator2,
980 typename _IteratorTag1,
typename _IteratorTag2>
982 __search_switch(_FIterator1 __begin1, _FIterator1 __end1,
983 _FIterator2 __begin2, _FIterator2 __end2,
984 _IteratorTag1, _IteratorTag2)
985 {
return search(__begin1, __end1, __begin2, __end2,
989 template<
typename _FIterator1,
typename _FIterator2>
991 search(_FIterator1 __begin1, _FIterator1 __end1,
992 _FIterator2 __begin2, _FIterator2 __end2)
994 return __search_switch(__begin1, __end1, __begin2, __end2,
1000 template<
typename _FIterator1,
typename _FIterator2,
1001 typename _BinaryPredicate>
1003 search(_FIterator1 __begin1, _FIterator1 __end1,
1004 _FIterator2 __begin2, _FIterator2 __end2,
1007 __begin1, __end1, __begin2, __end2, __pred); }
1010 template<
typename _RAIter1,
typename _RAIter2,
1011 typename _BinaryPredicate>
1013 __search_switch(_RAIter1 __begin1, _RAIter1 __end1,
1014 _RAIter2 __begin2, _RAIter2 __end2,
1015 _BinaryPredicate __pred,
1022 __begin2, __end2, __pred);
1024 return search(__begin1, __end1, __begin2, __end2, __pred,
1029 template<
typename _FIterator1,
typename _FIterator2,
1030 typename _BinaryPredicate,
typename _IteratorTag1,
1031 typename _IteratorTag2>
1033 __search_switch(_FIterator1 __begin1, _FIterator1 __end1,
1034 _FIterator2 __begin2, _FIterator2 __end2,
1035 _BinaryPredicate __pred, _IteratorTag1, _IteratorTag2)
1036 {
return search(__begin1, __end1, __begin2, __end2, __pred,
1040 template<
typename _FIterator1,
typename _FIterator2,
1041 typename _BinaryPredicate>
1043 search(_FIterator1 __begin1, _FIterator1 __end1,
1044 _FIterator2 __begin2, _FIterator2 __end2,
1045 _BinaryPredicate __pred)
1047 return __search_switch(__begin1, __end1, __begin2, __end2, __pred,
1052 #if __cplusplus >= 201703L
1060 template<
typename _ForwardIterator,
typename _Searcher>
1061 inline _ForwardIterator
1062 search(_ForwardIterator __first, _ForwardIterator __last,
1063 const _Searcher& __searcher)
1064 {
return __searcher(__first, __last).first; }
1068 template<
typename _FIterator,
typename _Integer,
typename _Tp>
1070 search_n(_FIterator __begin, _FIterator __end, _Integer __count,
1072 {
return _GLIBCXX_STD_A::search_n(__begin, __end, __count, __val); }
1075 template<
typename _FIterator,
typename _Integer,
typename _Tp,
1076 typename _BinaryPredicate>
1078 search_n(_FIterator __begin, _FIterator __end, _Integer __count,
1079 const _Tp& __val, _BinaryPredicate __binary_pred,
1081 {
return _GLIBCXX_STD_A::search_n(
1082 __begin, __end, __count, __val, __binary_pred); }
1085 template<
typename _FIterator,
typename _Integer,
typename _Tp>
1087 search_n(_FIterator __begin, _FIterator __end, _Integer __count,
1090 typedef typename iterator_traits<_FIterator>::value_type _ValueType;
1091 return __gnu_parallel::search_n(__begin, __end, __count, __val,
1096 template<
typename _RAIter,
typename _Integer,
1097 typename _Tp,
typename _BinaryPredicate>
1099 __search_n_switch(_RAIter __begin, _RAIter __end, _Integer __count,
1100 const _Tp& __val, _BinaryPredicate __binary_pred,
1101 random_access_iterator_tag)
1109 __begin, __end, __ps.begin(), __ps.end(), __binary_pred);
1112 return _GLIBCXX_STD_A::search_n(__begin, __end, __count, __val,
1117 template<
typename _FIterator,
typename _Integer,
typename _Tp,
1118 typename _BinaryPredicate,
typename _IteratorTag>
1120 __search_n_switch(_FIterator __begin, _FIterator __end, _Integer __count,
1121 const _Tp& __val, _BinaryPredicate __binary_pred,
1123 {
return _GLIBCXX_STD_A::search_n(__begin, __end, __count, __val,
1127 template<
typename _FIterator,
typename _Integer,
typename _Tp,
1128 typename _BinaryPredicate>
1130 search_n(_FIterator __begin, _FIterator __end, _Integer __count,
1131 const _Tp& __val, _BinaryPredicate __binary_pred)
1133 return __search_n_switch(__begin, __end, __count, __val, __binary_pred,
1139 template<
typename _IIter,
typename _OutputIterator,
1140 typename _UnaryOperation>
1141 inline _OutputIterator
1142 transform(_IIter __begin, _IIter __end, _OutputIterator __result,
1144 {
return _GLIBCXX_STD_A::transform(__begin, __end, __result, __unary_op); }
1147 template<
typename _RAIter1,
typename _RAIter2,
1148 typename _UnaryOperation>
1150 __transform1_switch(_RAIter1 __begin, _RAIter1 __end,
1151 _RAIter2 __result, _UnaryOperation __unary_op,
1152 random_access_iterator_tag, random_access_iterator_tag,
1158 && __gnu_parallel::__is_parallel(__parallelism_tag)))
1160 bool __dummy =
true;
1162 _RAIter2, random_access_iterator_tag> _ItTrip;
1163 _ItTrip __begin_pair(__begin, __result),
1164 __end_pair(__end, __result + (__end - __begin));
1168 __begin_pair, __end_pair, __unary_op, __functionality,
1170 __dummy, __dummy, -1, __parallelism_tag);
1174 return transform(__begin, __end, __result, __unary_op,
1179 template<
typename _RAIter1,
typename _RAIter2,
1180 typename _UnaryOperation,
typename _IteratorTag1,
1181 typename _IteratorTag2>
1183 __transform1_switch(_RAIter1 __begin, _RAIter1 __end,
1184 _RAIter2 __result, _UnaryOperation __unary_op,
1185 _IteratorTag1, _IteratorTag2)
1186 {
return transform(__begin, __end, __result, __unary_op,
1190 template<
typename _IIter,
typename _OutputIterator,
1191 typename _UnaryOperation>
1192 inline _OutputIterator
1193 transform(_IIter __begin, _IIter __end, _OutputIterator __result,
1194 _UnaryOperation __unary_op,
1197 return __transform1_switch(__begin, __end, __result, __unary_op,
1203 template<
typename _IIter,
typename _OutputIterator,
1204 typename _UnaryOperation>
1205 inline _OutputIterator
1206 transform(_IIter __begin, _IIter __end, _OutputIterator __result,
1207 _UnaryOperation __unary_op)
1209 return __transform1_switch(__begin, __end, __result, __unary_op,
1216 template<
typename _IIter1,
typename _IIter2,
1217 typename _OutputIterator,
typename _BinaryOperation>
1218 inline _OutputIterator
1219 transform(_IIter1 __begin1, _IIter1 __end1,
1220 _IIter2 __begin2, _OutputIterator __result,
1222 {
return _GLIBCXX_STD_A::transform(__begin1, __end1,
1223 __begin2, __result, __binary_op); }
1226 template<
typename _RAIter1,
typename _RAIter2,
1227 typename _RAIter3,
typename _BinaryOperation>
1229 __transform2_switch(_RAIter1 __begin1, _RAIter1 __end1,
1231 _RAIter3 __result, _BinaryOperation __binary_op,
1232 random_access_iterator_tag, random_access_iterator_tag,
1233 random_access_iterator_tag,
1237 (__end1 - __begin1) >=
1239 && __gnu_parallel::__is_parallel(__parallelism_tag)))
1241 bool __dummy =
true;
1244 random_access_iterator_tag> _ItTrip;
1245 _ItTrip __begin_triple(__begin1, __begin2, __result),
1246 __end_triple(__end1, __begin2 + (__end1 - __begin1),
1247 __result + (__end1 - __begin1));
1251 __binary_op, __functionality,
1253 __dummy, __dummy, -1,
1258 return transform(__begin1, __end1, __begin2, __result, __binary_op,
1263 template<
typename _IIter1,
typename _IIter2,
1264 typename _OutputIterator,
typename _BinaryOperation,
1265 typename _Tag1,
typename _Tag2,
typename _Tag3>
1266 inline _OutputIterator
1267 __transform2_switch(_IIter1 __begin1, _IIter1 __end1,
1268 _IIter2 __begin2, _OutputIterator __result,
1269 _BinaryOperation __binary_op, _Tag1, _Tag2, _Tag3)
1270 {
return transform(__begin1, __end1, __begin2, __result, __binary_op,
1274 template<
typename _IIter1,
typename _IIter2,
1275 typename _OutputIterator,
typename _BinaryOperation>
1276 inline _OutputIterator
1277 transform(_IIter1 __begin1, _IIter1 __end1,
1278 _IIter2 __begin2, _OutputIterator __result,
1279 _BinaryOperation __binary_op,
1282 return __transform2_switch(
1283 __begin1, __end1, __begin2, __result, __binary_op,
1290 template<
typename _IIter1,
typename _IIter2,
1291 typename _OutputIterator,
typename _BinaryOperation>
1292 inline _OutputIterator
1293 transform(_IIter1 __begin1, _IIter1 __end1,
1294 _IIter2 __begin2, _OutputIterator __result,
1295 _BinaryOperation __binary_op)
1297 return __transform2_switch(
1298 __begin1, __end1, __begin2, __result, __binary_op,
1305 template<
typename _FIterator,
typename _Tp>
1307 replace(_FIterator __begin, _FIterator __end,
const _Tp& __old_value,
1309 { _GLIBCXX_STD_A::replace(__begin, __end, __old_value, __new_value); }
1312 template<
typename _FIterator,
typename _Tp,
typename _IteratorTag>
1314 __replace_switch(_FIterator __begin, _FIterator __end,
1315 const _Tp& __old_value,
const _Tp& __new_value,
1317 { replace(__begin, __end, __old_value, __new_value,
1321 template<
typename _RAIter,
typename _Tp>
1323 __replace_switch(_RAIter __begin, _RAIter __end,
1324 const _Tp& __old_value,
const _Tp& __new_value,
1325 random_access_iterator_tag,
1329 replace(__begin, __end, __old_value, __new_value,
1334 template<
typename _FIterator,
typename _Tp>
1336 replace(_FIterator __begin, _FIterator __end,
const _Tp& __old_value,
1337 const _Tp& __new_value,
1340 __replace_switch(__begin, __end, __old_value, __new_value,
1345 template<
typename _FIterator,
typename _Tp>
1347 replace(_FIterator __begin, _FIterator __end,
const _Tp& __old_value,
1348 const _Tp& __new_value)
1350 __replace_switch(__begin, __end, __old_value, __new_value,
1356 template<
typename _FIterator,
typename _Predicate,
typename _Tp>
1358 replace_if(_FIterator __begin, _FIterator __end, _Predicate __pred,
1360 { _GLIBCXX_STD_A::replace_if(__begin, __end, __pred, __new_value); }
1363 template<
typename _FIterator,
typename _Predicate,
typename _Tp,
1364 typename _IteratorTag>
1366 __replace_if_switch(_FIterator __begin, _FIterator __end,
1367 _Predicate __pred,
const _Tp& __new_value, _IteratorTag)
1368 { replace_if(__begin, __end, __pred, __new_value,
1372 template<
typename _RAIter,
typename _Predicate,
typename _Tp>
1374 __replace_if_switch(_RAIter __begin, _RAIter __end,
1375 _Predicate __pred,
const _Tp& __new_value,
1376 random_access_iterator_tag,
1382 && __gnu_parallel::__is_parallel(__parallelism_tag)))
1386 __replace_if_selector<_RAIter, _Predicate, _Tp>
1387 __functionality(__new_value);
1390 __begin, __end, __pred, __functionality,
1392 true, __dummy, -1, __parallelism_tag);
1395 replace_if(__begin, __end, __pred, __new_value,
1400 template<
typename _FIterator,
typename _Predicate,
typename _Tp>
1402 replace_if(_FIterator __begin, _FIterator __end,
1403 _Predicate __pred,
const _Tp& __new_value,
1406 __replace_if_switch(__begin, __end, __pred, __new_value,
1411 template<
typename _FIterator,
typename _Predicate,
typename _Tp>
1413 replace_if(_FIterator __begin, _FIterator __end,
1414 _Predicate __pred,
const _Tp& __new_value)
1416 __replace_if_switch(__begin, __end, __pred, __new_value,
1421 template<
typename _FIterator,
typename _Generator>
1423 generate(_FIterator __begin, _FIterator __end, _Generator __gen,
1425 { _GLIBCXX_STD_A::generate(__begin, __end, __gen); }
1428 template<
typename _FIterator,
typename _Generator,
typename _IteratorTag>
1430 __generate_switch(_FIterator __begin, _FIterator __end, _Generator __gen,
1435 template<
typename _RAIter,
typename _Generator>
1437 __generate_switch(_RAIter __begin, _RAIter __end,
1438 _Generator __gen, random_access_iterator_tag,
1444 && __gnu_parallel::__is_parallel(__parallelism_tag)))
1451 __begin, __end, __gen, __functionality,
1453 true, __dummy, -1, __parallelism_tag);
1460 template<
typename _FIterator,
typename _Generator>
1462 generate(_FIterator __begin, _FIterator __end,
1465 __generate_switch(__begin, __end, __gen,
1470 template<
typename _FIterator,
typename _Generator>
1472 generate(_FIterator __begin, _FIterator __end, _Generator __gen)
1474 __generate_switch(__begin, __end, __gen,
1480 template<
typename _OutputIterator,
typename _Size,
typename _Generator>
1481 inline _OutputIterator
1482 generate_n(_OutputIterator __begin, _Size __n, _Generator __gen,
1484 {
return _GLIBCXX_STD_A::generate_n(__begin, __n, __gen); }
1487 template<
typename _OutputIterator,
typename _Size,
typename _Generator,
1488 typename _IteratorTag>
1489 inline _OutputIterator
1490 __generate_n_switch(_OutputIterator __begin, _Size __n, _Generator __gen,
1492 {
return generate_n(__begin, __n, __gen,
1496 template<
typename _RAIter,
typename _Size,
typename _Generator>
1498 __generate_n_switch(_RAIter __begin, _Size __n, _Generator __gen,
1499 random_access_iterator_tag,
1507 template<
typename _OutputIterator,
typename _Size,
typename _Generator>
1508 inline _OutputIterator
1509 generate_n(_OutputIterator __begin, _Size __n, _Generator __gen,
1512 return __generate_n_switch(__begin, __n, __gen,
1517 template<
typename _OutputIterator,
typename _Size,
typename _Generator>
1518 inline _OutputIterator
1519 generate_n(_OutputIterator __begin, _Size __n, _Generator __gen)
1521 return __generate_n_switch(__begin, __n, __gen,
1527 template<
typename _RAIter>
1529 random_shuffle(_RAIter __begin, _RAIter __end,
1531 { _GLIBCXX_STD_A::random_shuffle(__begin, __end); }
1534 template<
typename _RAIter,
typename _RandomNumberGenerator>
1536 random_shuffle(_RAIter __begin, _RAIter __end,
1537 _RandomNumberGenerator& __rand,
1539 { _GLIBCXX_STD_A::random_shuffle(__begin, __end, __rand); }
1543 template<
typename _MustBeInt =
int>
1547 operator()(
int __limit)
1548 {
return rand() % __limit; }
1552 template<
typename _RAIter>
1554 random_shuffle(_RAIter __begin, _RAIter __end)
1558 __gnu_parallel::random_shuffle(__begin, __end, __r);
1562 template<
typename _RAIter,
typename _RandomNumberGenerator>
1564 random_shuffle(_RAIter __begin, _RAIter __end,
1565 #
if __cplusplus >= 201103L
1566 _RandomNumberGenerator&& __rand)
1568 _RandomNumberGenerator& __rand)
1571 if (__begin == __end)
1582 template<
typename _FIterator,
typename _Predicate>
1584 partition(_FIterator __begin, _FIterator __end,
1586 {
return _GLIBCXX_STD_A::partition(__begin, __end, __pred); }
1589 template<
typename _FIterator,
typename _Predicate,
typename _IteratorTag>
1591 __partition_switch(_FIterator __begin, _FIterator __end,
1592 _Predicate __pred, _IteratorTag)
1593 {
return partition(__begin, __end, __pred,
1597 template<
typename _RAIter,
typename _Predicate>
1599 __partition_switch(_RAIter __begin, _RAIter __end,
1600 _Predicate __pred, random_access_iterator_tag)
1607 difference_type _DifferenceType;
1610 __gnu_parallel::__get_max_threads());
1611 return __begin + __middle;
1614 return partition(__begin, __end, __pred,
1619 template<
typename _FIterator,
typename _Predicate>
1621 partition(_FIterator __begin, _FIterator __end, _Predicate __pred)
1623 return __partition_switch(__begin, __end, __pred,
1630 template<
typename _RAIter>
1632 sort(_RAIter __begin, _RAIter __end,
1634 { _GLIBCXX_STD_A::sort(__begin, __end); }
1637 template<
typename _RAIter,
typename _Compare>
1639 sort(_RAIter __begin, _RAIter __end, _Compare __comp,
1641 { _GLIBCXX_STD_A::sort<_RAIter, _Compare>(__begin, __end,
1645 template<
typename _RAIter,
typename _Compare,
1648 sort(_RAIter __begin, _RAIter __end, _Compare __comp,
1651 typedef typename iterator_traits<_RAIter>::value_type _ValueType;
1653 if (__begin != __end)
1658 __gnu_parallel::__parallel_sort<false>(
1659 __begin, __end, __comp, __parallelism);
1666 template<
typename _RAIter>
1668 sort(_RAIter __begin, _RAIter __end)
1670 typedef typename iterator_traits<_RAIter>::value_type _ValueType;
1676 template<
typename _RAIter>
1678 sort(_RAIter __begin, _RAIter __end,
1681 typedef typename iterator_traits<_RAIter>::value_type _ValueType;
1686 template<
typename _RAIter>
1688 sort(_RAIter __begin, _RAIter __end,
1691 typedef typename iterator_traits<_RAIter>::value_type _ValueType;
1696 template<
typename _RAIter>
1698 sort(_RAIter __begin, _RAIter __end,
1701 typedef typename iterator_traits<_RAIter>::value_type _ValueType;
1706 template<
typename _RAIter>
1708 sort(_RAIter __begin, _RAIter __end,
1711 typedef typename iterator_traits<_RAIter>::value_type _ValueType;
1716 template<
typename _RAIter>
1718 sort(_RAIter __begin, _RAIter __end,
1721 typedef typename iterator_traits<_RAIter>::value_type _ValueType;
1726 template<
typename _RAIter>
1728 sort(_RAIter __begin, _RAIter __end,
1731 typedef typename iterator_traits<_RAIter>::value_type _ValueType;
1736 template<
typename _RAIter>
1738 sort(_RAIter __begin, _RAIter __end,
1741 typedef typename iterator_traits<_RAIter>::value_type _ValueType;
1746 template<
typename _RAIter,
typename _Compare>
1748 sort(_RAIter __begin, _RAIter __end, _Compare __comp)
1750 typedef typename iterator_traits<_RAIter>::value_type _ValueType;
1758 template<
typename _RAIter>
1760 stable_sort(_RAIter __begin, _RAIter __end,
1762 { _GLIBCXX_STD_A::stable_sort(__begin, __end); }
1765 template<
typename _RAIter,
typename _Compare>
1767 stable_sort(_RAIter __begin, _RAIter __end,
1769 { _GLIBCXX_STD_A::stable_sort<_RAIter, _Compare>(__begin, __end, __comp); }
1772 template<
typename _RAIter,
typename _Compare,
1775 stable_sort(_RAIter __begin, _RAIter __end,
1778 typedef iterator_traits<_RAIter> _TraitsType;
1779 typedef typename _TraitsType::value_type _ValueType;
1781 if (__begin != __end)
1786 __gnu_parallel::__parallel_sort<true>(__begin, __end,
1787 __comp, __parallelism);
1789 stable_sort(__begin, __end, __comp,
1795 template<
typename _RAIter>
1797 stable_sort(_RAIter __begin, _RAIter __end)
1799 typedef typename iterator_traits<_RAIter>::value_type _ValueType;
1805 template<
typename _RAIter>
1807 stable_sort(_RAIter __begin, _RAIter __end,
1810 typedef typename iterator_traits<_RAIter>::value_type _ValueType;
1815 template<
typename _RAIter>
1817 stable_sort(_RAIter __begin, _RAIter __end,
1820 typedef typename iterator_traits<_RAIter>::value_type _ValueType;
1825 template<
typename _RAIter>
1827 stable_sort(_RAIter __begin, _RAIter __end,
1830 typedef typename iterator_traits<_RAIter>::value_type _ValueType;
1835 template<
typename _RAIter>
1837 stable_sort(_RAIter __begin, _RAIter __end,
1840 typedef typename iterator_traits<_RAIter>::value_type _ValueType;
1845 template<
typename _RAIter>
1847 stable_sort(_RAIter __begin, _RAIter __end,
1850 typedef typename iterator_traits<_RAIter>::value_type _ValueType;
1855 template<
typename _RAIter,
typename _Compare>
1857 stable_sort(_RAIter __begin, _RAIter __end, _Compare __comp)
1864 template<
typename _IIter1,
typename _IIter2,
1865 typename _OutputIterator>
1866 inline _OutputIterator
1867 merge(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2,
1868 _IIter2 __end2, _OutputIterator __result,
1870 {
return _GLIBCXX_STD_A::merge(
1871 __begin1, __end1, __begin2, __end2, __result); }
1874 template<
typename _IIter1,
typename _IIter2,
1875 typename _OutputIterator,
typename _Compare>
1876 inline _OutputIterator
1877 merge(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2,
1878 _IIter2 __end2, _OutputIterator __result, _Compare __comp,
1880 {
return _GLIBCXX_STD_A::merge(
1881 __begin1, __end1, __begin2, __end2, __result, __comp); }
1884 template<
typename _IIter1,
typename _IIter2,
typename _OutputIterator,
1885 typename _Compare,
typename _IteratorTag1,
1886 typename _IteratorTag2,
typename _IteratorTag3>
1887 inline _OutputIterator
1888 __merge_switch(_IIter1 __begin1, _IIter1 __end1,
1889 _IIter2 __begin2, _IIter2 __end2,
1890 _OutputIterator __result, _Compare __comp,
1891 _IteratorTag1, _IteratorTag2, _IteratorTag3)
1892 {
return _GLIBCXX_STD_A::merge(__begin1, __end1, __begin2, __end2,
1893 __result, __comp); }
1896 template<
typename _IIter1,
typename _IIter2,
1897 typename _OutputIterator,
typename _Compare>
1899 __merge_switch(_IIter1 __begin1, _IIter1 __end1,
1900 _IIter2 __begin2, _IIter2 __end2,
1901 _OutputIterator __result, _Compare __comp,
1902 random_access_iterator_tag, random_access_iterator_tag,
1903 random_access_iterator_tag)
1911 __begin1, __end1, __begin2, __end2, __result,
1912 (__end1 - __begin1) + (__end2 - __begin2), __comp);
1915 __begin1, __end1, __begin2, __end2, __result,
1916 (__end1 - __begin1) + (__end2 - __begin2), __comp);
1920 template<
typename _IIter1,
typename _IIter2,
1921 typename _OutputIterator,
typename _Compare>
1922 inline _OutputIterator
1923 merge(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2,
1924 _IIter2 __end2, _OutputIterator __result, _Compare __comp)
1926 return __merge_switch(
1927 __begin1, __end1, __begin2, __end2, __result, __comp,
1934 template<
typename _IIter1,
typename _IIter2,
1935 typename _OutputIterator>
1936 inline _OutputIterator
1937 merge(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2,
1938 _IIter2 __end2, _OutputIterator __result)
1943 return __gnu_parallel::merge(__begin1, __end1, __begin2, __end2,
1948 template<
typename _RAIter>
1950 nth_element(_RAIter __begin, _RAIter __nth,
1952 {
return _GLIBCXX_STD_A::nth_element(__begin, __nth, __end); }
1955 template<
typename _RAIter,
typename _Compare>
1957 nth_element(_RAIter __begin, _RAIter __nth,
1958 _RAIter __end, _Compare __comp,
1960 {
return _GLIBCXX_STD_A::nth_element(__begin, __nth, __end, __comp); }
1963 template<
typename _RAIter,
typename _Compare>
1965 nth_element(_RAIter __begin, _RAIter __nth,
1966 _RAIter __end, _Compare __comp)
1973 nth_element(__begin, __nth, __end, __comp,
1978 template<
typename _RAIter>
1980 nth_element(_RAIter __begin, _RAIter __nth,
1983 typedef typename iterator_traits<_RAIter>::value_type _ValueType;
1984 __gnu_parallel::nth_element(__begin, __nth, __end,
1989 template<
typename _RAIter,
typename _Compare>
1991 partial_sort(_RAIter __begin, _RAIter __middle,
1992 _RAIter __end, _Compare __comp,
1994 { _GLIBCXX_STD_A::partial_sort(__begin, __middle, __end, __comp); }
1997 template<
typename _RAIter>
1999 partial_sort(_RAIter __begin, _RAIter __middle,
2001 { _GLIBCXX_STD_A::partial_sort(__begin, __middle, __end); }
2004 template<
typename _RAIter,
typename _Compare>
2006 partial_sort(_RAIter __begin, _RAIter __middle,
2007 _RAIter __end, _Compare __comp)
2015 partial_sort(__begin, __middle, __end, __comp,
2020 template<
typename _RAIter>
2022 partial_sort(_RAIter __begin, _RAIter __middle,
2025 typedef iterator_traits<_RAIter> _TraitsType;
2026 typedef typename _TraitsType::value_type _ValueType;
2027 __gnu_parallel::partial_sort(__begin, __middle, __end,
2032 template<
typename _FIterator>
2034 max_element(_FIterator __begin, _FIterator __end,
2036 {
return _GLIBCXX_STD_A::max_element(__begin, __end); }
2039 template<
typename _FIterator,
typename _Compare>
2041 max_element(_FIterator __begin, _FIterator __end, _Compare __comp,
2043 {
return _GLIBCXX_STD_A::max_element(__begin, __end, __comp); }
2046 template<
typename _FIterator,
typename _Compare,
typename _IteratorTag>
2048 __max_element_switch(_FIterator __begin, _FIterator __end,
2049 _Compare __comp, _IteratorTag)
2050 {
return max_element(__begin, __end, __comp,
2054 template<
typename _RAIter,
typename _Compare>
2056 __max_element_switch(_RAIter __begin, _RAIter __end,
2057 _Compare __comp, random_access_iterator_tag,
2063 && __gnu_parallel::__is_parallel(__parallelism_tag)))
2065 _RAIter __res(__begin);
2072 __res, __res, -1, __parallelism_tag);
2076 return max_element(__begin, __end, __comp,
2081 template<
typename _FIterator>
2083 max_element(_FIterator __begin, _FIterator __end,
2086 typedef typename iterator_traits<_FIterator>::value_type _ValueType;
2091 template<
typename _FIterator>
2093 max_element(_FIterator __begin, _FIterator __end)
2095 typedef typename iterator_traits<_FIterator>::value_type _ValueType;
2096 return __gnu_parallel::max_element(__begin, __end,
2101 template<
typename _FIterator,
typename _Compare>
2103 max_element(_FIterator __begin, _FIterator __end, _Compare __comp,
2106 return __max_element_switch(__begin, __end, __comp,
2111 template<
typename _FIterator,
typename _Compare>
2113 max_element(_FIterator __begin, _FIterator __end, _Compare __comp)
2115 return __max_element_switch(__begin, __end, __comp,
2121 template<
typename _FIterator>
2123 min_element(_FIterator __begin, _FIterator __end,
2125 {
return _GLIBCXX_STD_A::min_element(__begin, __end); }
2128 template<
typename _FIterator,
typename _Compare>
2130 min_element(_FIterator __begin, _FIterator __end, _Compare __comp,
2132 {
return _GLIBCXX_STD_A::min_element(__begin, __end, __comp); }
2135 template<
typename _FIterator,
typename _Compare,
typename _IteratorTag>
2137 __min_element_switch(_FIterator __begin, _FIterator __end,
2138 _Compare __comp, _IteratorTag)
2139 {
return min_element(__begin, __end, __comp,
2143 template<
typename _RAIter,
typename _Compare>
2145 __min_element_switch(_RAIter __begin, _RAIter __end,
2146 _Compare __comp, random_access_iterator_tag,
2152 && __gnu_parallel::__is_parallel(__parallelism_tag)))
2154 _RAIter __res(__begin);
2161 __res, __res, -1, __parallelism_tag);
2165 return min_element(__begin, __end, __comp,
2170 template<
typename _FIterator>
2172 min_element(_FIterator __begin, _FIterator __end,
2175 typedef typename iterator_traits<_FIterator>::value_type _ValueType;
2180 template<
typename _FIterator>
2182 min_element(_FIterator __begin, _FIterator __end)
2184 typedef typename iterator_traits<_FIterator>::value_type _ValueType;
2185 return __gnu_parallel::min_element(__begin, __end,
2190 template<
typename _FIterator,
typename _Compare>
2192 min_element(_FIterator __begin, _FIterator __end, _Compare __comp,
2195 return __min_element_switch(__begin, __end, __comp,
2200 template<
typename _FIterator,
typename _Compare>
2202 min_element(_FIterator __begin, _FIterator __end, _Compare __comp)
2204 return __min_element_switch(__begin, __end, __comp,
2208 #if __cplusplus >= 201703L
2209 using _GLIBCXX_STD_A::for_each_n;
2210 using _GLIBCXX_STD_A::sample;
Sequential helper functions. This file is a GNU parallel extension to the Standard C++ Library.
Parallel implementation base for std::find(), std::equal() and related functions. This file is a GNU ...
_Function objects representing different tasks to be plugged into the parallel find algorithm....
Main interface for embarrassingly parallel functions.
Functors representing different tasks to be plugged into the generic parallelization methods for emba...
Helper iterator classes for the std::transform() functions. This file is a GNU parallel extension to ...
Parallel implementation of std::merge(). This file is a GNU parallel extension to the Standard C++ Li...
Parallelization of embarrassingly parallel execution by means of an OpenMP for loop....
Parallelization of embarrassingly parallel execution by means of an OpenMP for loop with static sched...
Parallelization of embarrassingly parallel execution by means of equal splitting. This file is a GNU ...
Parallel implementation of std::partition(), std::nth_element(), and std::partial_sort()....
Parallel implementation of std::random_shuffle(). This file is a GNU parallel extension to the Standa...
Parallel implementation base for std::search() and std::search_n(). This file is a GNU parallel exten...
Parallel implementations of set operations for random-access iterators. This file is a GNU parallel e...
#define _GLIBCXX_PARALLEL_CONDITION(__c)
Determine at compile(?)-time if the parallel variant of an algorithm should be called.
Parallel sorting algorithm switch. This file is a GNU parallel extension to the Standard C++ Library.
Parallel implementations of std::unique_copy(). This file is a GNU parallel extension to the Standard...
Parallelization of embarrassingly parallel execution by means of work-stealing.
constexpr iterator_traits< _Iter >::iterator_category __iterator_category(const _Iter &)
ISO C++ entities toplevel namespace is std.
_ForwardIterator search(_ForwardIterator __first, _ForwardIterator __last, const _Searcher &__searcher)
Search a sequence using a Searcher object.
GNU parallel code for public use.
_OutputIterator __merge_advance(_RAIter1 &__begin1, _RAIter1 __end1, _RAIter2 &__begin2, _RAIter2 __end2, _OutputIterator __target, _DifferenceTp __max_length, _Compare __comp)
Merge routine being able to merge only the __max_length smallest elements.
_UserOp __for_each_template_random_access(_IIter __begin, _IIter __end, _UserOp __user_op, _Functionality &__functionality, _Red __reduction, _Result __reduction_start, _Result &__output, typename std::iterator_traits< _IIter >::difference_type __bound, _Parallelism __parallelism_tag)
Chose the desired algorithm by evaluating __parallelism_tag.
void __parallel_nth_element(_RAIter __begin, _RAIter __nth, _RAIter __end, _Compare __comp)
Parallel implementation of std::nth_element().
_OutputIterator __parallel_unique_copy(_IIter __first, _IIter __last, _OutputIterator __result, _BinaryPredicate __binary_pred)
Parallel std::unique_copy(), w/__o explicit equality predicate.
uint64_t _SequenceIndex
Unsigned integer to index __elements. The total number of elements for each algorithm must fit into t...
void __parallel_random_shuffle(_RAIter __begin, _RAIter __end, _RandomNumberGenerator __rng=_RandomNumber())
Parallel random public call.
_Parallelism
Run-time equivalents for the compile-time tags.
std::pair< _RAIter1, _RAIter2 > __find_template(_RAIter1 __begin1, _RAIter1 __end1, _RAIter2 __begin2, _Pred __pred, _Selector __selector)
Parallel std::find, switch for different algorithms.
std::iterator_traits< _RAIter >::difference_type __parallel_partition(_RAIter __begin, _RAIter __end, _Predicate __pred, _ThreadIndex __num_threads)
Parallel implementation of std::partition.
void __sequential_random_shuffle(_RAIter __begin, _RAIter __end, _RandomNumberGenerator &__rng)
Sequential cache-efficient random shuffle.
void __parallel_partial_sort(_RAIter __begin, _RAIter __middle, _RAIter __end, _Compare __comp)
Parallel implementation of std::partial_sort().
_RAIter3 __parallel_merge_advance(_RAIter1 &__begin1, _RAIter1 __end1, _RAIter2 &__begin2, _RAIter2 __end2, _RAIter3 __target, typename std::iterator_traits< _RAIter1 >::difference_type __max_length, _Compare __comp)
Merge routine fallback to sequential in case the iterators of the two input sequences are of differen...
__RAIter1 __search_template(__RAIter1 __begin1, __RAIter1 __end1, __RAIter2 __begin2, __RAIter2 __end2, _Pred __pred)
Parallel std::search.
Traits class for iterators.
One of the math functors.
One of the comparison functors.
One of the comparison functors.
Random-access iterators support a superset of bidirectional iterator operations.
Functor wrapper for std::rand().
Similar to std::binder2nd, but giving the argument types explicitly.
Similar to std::equal_to, but allows two different types.
Similar to std::less, but allows two different types.
Sequence that conceptually consists of multiple copies of the same element. The copies are not stored...
Test predicate on a single element, used for std::find() and std::find_if ().
Test predicate on two adjacent elements.
Test predicate on several elements.
_It _M_finish_iterator
_Iterator on last element processed; needed for some algorithms (e. g. std::transform()).
std::for_each() selector.
std::generate() selector.
std::transform() __selector, one input sequence variant.
std::transform() __selector, two input sequences variant.
Selector that just returns the passed iterator.
Reduction function doing nothing.
Reduction for finding the maximum element, using a comparator.
Reduction for finding the maximum element, using a comparator.
A pair of iterators. The usual iterator operations are applied to both child iterators.
A triple of iterators. The usual iterator operations are applied to all three child iterators.
static const _Settings & get()
Get the global settings.
Forces sequential execution at compile time.
Recommends parallel execution at compile time, optionally using a user-specified number of threads.
Recommends parallel execution using the default parallel algorithm.
Forces parallel sorting using multiway mergesort at compile time.
Forces parallel sorting using multiway mergesort with exact splitting at compile time.
Forces parallel sorting using multiway mergesort with splitting by sampling at compile time.
Forces parallel sorting using unbalanced quicksort at compile time.
Forces parallel sorting using balanced quicksort at compile time.