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,
87 static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin)
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,
143 typedef iterator_traits<_RAIter> _TraitsType;
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)
282 typedef typename std::iterator_traits<_IIter>::value_type _IValueType;
283 typedef typename std::iterator_traits<_FIterator>::value_type _FValueType;
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,
322 static_cast<__gnu_parallel::_SequenceIndex>(__last - __begin)
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)
335 typedef typename std::iterator_traits<_IIter>::value_type _ValueType;
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,
399 static_cast<__gnu_parallel::_SequenceIndex>(__end1 - __begin1)
401 || static_cast<__gnu_parallel::_SequenceIndex>(__end2 - __begin2)
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)
417 typedef typename std::iterator_traits<_IIter1>::value_type _ValueType1;
418 typedef typename std::iterator_traits<_IIter2>::value_type _ValueType2;
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,
492 static_cast<__gnu_parallel::_SequenceIndex>(__end1 - __begin1)
494 || static_cast<__gnu_parallel::_SequenceIndex>(__end2 - __begin2)
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)
511 typedef typename std::iterator_traits<_IIter1>::value_type _ValueType1;
512 typedef typename std::iterator_traits<_IIter2>::value_type _ValueType2;
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,
586 static_cast<__gnu_parallel::_SequenceIndex>(__end1 - __begin1)
588 || static_cast<__gnu_parallel::_SequenceIndex>(__end2 - __begin2)
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)
605 typedef typename std::iterator_traits<_IIter1>::value_type _ValueType1;
606 typedef typename std::iterator_traits<_IIter2>::value_type _ValueType2;
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,
678 static_cast<__gnu_parallel::_SequenceIndex>(__end1 - __begin1)
680 || static_cast<__gnu_parallel::_SequenceIndex>(__end2 - __begin2)
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)
697 typedef typename std::iterator_traits<_IIter1>::value_type _ValueType1;
698 typedef typename std::iterator_traits<_IIter2>::value_type _ValueType2;
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,
744 typedef iterator_traits<_RAIter> _TraitsType;
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>
815 inline typename iterator_traits<_IIter>::difference_type
816 count(_IIter __begin, _IIter __end,
const _Tp& __value,
818 {
return _GLIBCXX_STD_A::count(__begin, __end, __value); }
821 template<
typename _RAIter,
typename _Tp>
822 typename iterator_traits<_RAIter>::difference_type
823 __count_switch(_RAIter __begin, _RAIter __end,
827 typedef iterator_traits<_RAIter> _TraitsType;
828 typedef typename _TraitsType::value_type _ValueType;
829 typedef typename _TraitsType::difference_type _DifferenceType;
833 static_cast<_SequenceIndex>(__end - __begin)
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>
854 inline typename iterator_traits<_IIter>::difference_type
855 __count_switch(_IIter __begin, _IIter __end,
const _Tp& __value,
861 template<
typename _IIter,
typename _Tp>
862 inline typename iterator_traits<_IIter>::difference_type
863 count(_IIter __begin, _IIter __end,
const _Tp& __value,
866 return __count_switch(__begin, __end, __value,
871 template<
typename _IIter,
typename _Tp>
872 inline typename iterator_traits<_IIter>::difference_type
873 count(_IIter __begin, _IIter __end,
const _Tp& __value)
875 return __count_switch(__begin, __end, __value,
881 template<
typename _IIter,
typename _Predicate>
882 inline typename iterator_traits<_IIter>::difference_type
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>
889 typename iterator_traits<_RAIter>::difference_type
890 __count_if_switch(_RAIter __begin, _RAIter __end,
894 typedef iterator_traits<_RAIter> _TraitsType;
895 typedef typename _TraitsType::value_type _ValueType;
896 typedef typename _TraitsType::difference_type _DifferenceType;
900 static_cast<_SequenceIndex>(__end - __begin)
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>
922 inline typename iterator_traits<_IIter>::difference_type
923 __count_if_switch(_IIter __begin, _IIter __end, _Predicate __pred,
925 {
return count_if(__begin, __end, __pred,
929 template<
typename _IIter,
typename _Predicate>
930 inline typename iterator_traits<_IIter>::difference_type
931 count_if(_IIter __begin, _IIter __end, _Predicate __pred,
934 return __count_if_switch(__begin, __end, __pred,
939 template<
typename _IIter,
typename _Predicate>
940 inline typename iterator_traits<_IIter>::difference_type
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,
954 {
return _GLIBCXX_STD_A::search(__begin1, __end1, __begin2, __end2); }
957 template<
typename _RAIter1,
typename _RAIter2>
959 __search_switch(_RAIter1 __begin1, _RAIter1 __end1,
960 _RAIter2 __begin2, _RAIter2 __end2,
963 typedef typename std::iterator_traits<_RAIter1>::value_type _ValueType1;
964 typedef typename std::iterator_traits<_RAIter2>::value_type _ValueType2;
967 static_cast<__gnu_parallel::_SequenceIndex>(__end1 - __begin1)
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,
1006 {
return _GLIBCXX_STD_A::search(
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,
1019 static_cast<__gnu_parallel::_SequenceIndex>(__end1 - __begin1)
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,
1053 template<
typename _FIterator,
typename _Integer,
typename _Tp>
1055 search_n(_FIterator __begin, _FIterator __end, _Integer __count,
1057 {
return _GLIBCXX_STD_A::search_n(__begin, __end, __count, __val); }
1060 template<
typename _FIterator,
typename _Integer,
typename _Tp,
1061 typename _BinaryPredicate>
1063 search_n(_FIterator __begin, _FIterator __end, _Integer __count,
1064 const _Tp& __val, _BinaryPredicate __binary_pred,
1066 {
return _GLIBCXX_STD_A::search_n(
1067 __begin, __end, __count, __val, __binary_pred); }
1070 template<
typename _FIterator,
typename _Integer,
typename _Tp>
1072 search_n(_FIterator __begin, _FIterator __end, _Integer __count,
1075 typedef typename iterator_traits<_FIterator>::value_type _ValueType;
1076 return __gnu_parallel::search_n(__begin, __end, __count, __val,
1081 template<
typename _RAIter,
typename _Integer,
1082 typename _Tp,
typename _BinaryPredicate>
1084 __search_n_switch(_RAIter __begin, _RAIter __end, _Integer __count,
1085 const _Tp& __val, _BinaryPredicate __binary_pred,
1089 static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin)
1094 __begin, __end, __ps.
begin(), __ps.
end(), __binary_pred);
1097 return _GLIBCXX_STD_A::search_n(__begin, __end, __count, __val,
1102 template<
typename _FIterator,
typename _Integer,
typename _Tp,
1103 typename _BinaryPredicate,
typename _IteratorTag>
1105 __search_n_switch(_FIterator __begin, _FIterator __end, _Integer __count,
1106 const _Tp& __val, _BinaryPredicate __binary_pred,
1108 {
return _GLIBCXX_STD_A::search_n(__begin, __end, __count, __val,
1112 template<
typename _FIterator,
typename _Integer,
typename _Tp,
1113 typename _BinaryPredicate>
1115 search_n(_FIterator __begin, _FIterator __end, _Integer __count,
1116 const _Tp& __val, _BinaryPredicate __binary_pred)
1118 return __search_n_switch(__begin, __end, __count, __val, __binary_pred,
1124 template<
typename _IIter,
typename _OutputIterator,
1125 typename _UnaryOperation>
1126 inline _OutputIterator
1127 transform(_IIter __begin, _IIter __end, _OutputIterator __result,
1129 {
return _GLIBCXX_STD_A::transform(__begin, __end, __result, __unary_op); }
1132 template<
typename _RAIter1,
typename _RAIter2,
1133 typename _UnaryOperation>
1135 __transform1_switch(_RAIter1 __begin, _RAIter1 __end,
1136 _RAIter2 __result, _UnaryOperation __unary_op,
1141 static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin)
1143 && __gnu_parallel::__is_parallel(__parallelism_tag)))
1145 bool __dummy =
true;
1148 _ItTrip __begin_pair(__begin, __result),
1149 __end_pair(__end, __result + (__end - __begin));
1153 __begin_pair, __end_pair, __unary_op, __functionality,
1155 __dummy, __dummy, -1, __parallelism_tag);
1159 return transform(__begin, __end, __result, __unary_op,
1164 template<
typename _RAIter1,
typename _RAIter2,
1165 typename _UnaryOperation,
typename _IteratorTag1,
1166 typename _IteratorTag2>
1168 __transform1_switch(_RAIter1 __begin, _RAIter1 __end,
1169 _RAIter2 __result, _UnaryOperation __unary_op,
1170 _IteratorTag1, _IteratorTag2)
1171 {
return transform(__begin, __end, __result, __unary_op,
1175 template<
typename _IIter,
typename _OutputIterator,
1176 typename _UnaryOperation>
1177 inline _OutputIterator
1178 transform(_IIter __begin, _IIter __end, _OutputIterator __result,
1179 _UnaryOperation __unary_op,
1182 return __transform1_switch(__begin, __end, __result, __unary_op,
1188 template<
typename _IIter,
typename _OutputIterator,
1189 typename _UnaryOperation>
1190 inline _OutputIterator
1191 transform(_IIter __begin, _IIter __end, _OutputIterator __result,
1192 _UnaryOperation __unary_op)
1194 return __transform1_switch(__begin, __end, __result, __unary_op,
1201 template<
typename _IIter1,
typename _IIter2,
1202 typename _OutputIterator,
typename _BinaryOperation>
1203 inline _OutputIterator
1204 transform(_IIter1 __begin1, _IIter1 __end1,
1205 _IIter2 __begin2, _OutputIterator __result,
1207 {
return _GLIBCXX_STD_A::transform(__begin1, __end1,
1208 __begin2, __result, __binary_op); }
1211 template<
typename _RAIter1,
typename _RAIter2,
1212 typename _RAIter3,
typename _BinaryOperation>
1214 __transform2_switch(_RAIter1 __begin1, _RAIter1 __end1,
1216 _RAIter3 __result, _BinaryOperation __binary_op,
1222 (__end1 - __begin1) >=
1224 && __gnu_parallel::__is_parallel(__parallelism_tag)))
1226 bool __dummy =
true;
1230 _ItTrip __begin_triple(__begin1, __begin2, __result),
1231 __end_triple(__end1, __begin2 + (__end1 - __begin1),
1232 __result + (__end1 - __begin1));
1236 __binary_op, __functionality,
1238 __dummy, __dummy, -1,
1243 return transform(__begin1, __end1, __begin2, __result, __binary_op,
1248 template<
typename _IIter1,
typename _IIter2,
1249 typename _OutputIterator,
typename _BinaryOperation,
1250 typename _Tag1,
typename _Tag2,
typename _Tag3>
1251 inline _OutputIterator
1252 __transform2_switch(_IIter1 __begin1, _IIter1 __end1,
1253 _IIter2 __begin2, _OutputIterator __result,
1254 _BinaryOperation __binary_op, _Tag1, _Tag2, _Tag3)
1255 {
return transform(__begin1, __end1, __begin2, __result, __binary_op,
1259 template<
typename _IIter1,
typename _IIter2,
1260 typename _OutputIterator,
typename _BinaryOperation>
1261 inline _OutputIterator
1262 transform(_IIter1 __begin1, _IIter1 __end1,
1263 _IIter2 __begin2, _OutputIterator __result,
1264 _BinaryOperation __binary_op,
1267 return __transform2_switch(
1268 __begin1, __end1, __begin2, __result, __binary_op,
1275 template<
typename _IIter1,
typename _IIter2,
1276 typename _OutputIterator,
typename _BinaryOperation>
1277 inline _OutputIterator
1278 transform(_IIter1 __begin1, _IIter1 __end1,
1279 _IIter2 __begin2, _OutputIterator __result,
1280 _BinaryOperation __binary_op)
1282 return __transform2_switch(
1283 __begin1, __end1, __begin2, __result, __binary_op,
1290 template<
typename _FIterator,
typename _Tp>
1292 replace(_FIterator __begin, _FIterator __end,
const _Tp& __old_value,
1294 { _GLIBCXX_STD_A::replace(__begin, __end, __old_value, __new_value); }
1297 template<
typename _FIterator,
typename _Tp,
typename _IteratorTag>
1299 __replace_switch(_FIterator __begin, _FIterator __end,
1300 const _Tp& __old_value,
const _Tp& __new_value,
1302 { replace(__begin, __end, __old_value, __new_value,
1306 template<
typename _RAIter,
typename _Tp>
1308 __replace_switch(_RAIter __begin, _RAIter __end,
1309 const _Tp& __old_value,
const _Tp& __new_value,
1314 replace(__begin, __end, __old_value, __new_value,
1319 template<
typename _FIterator,
typename _Tp>
1321 replace(_FIterator __begin, _FIterator __end,
const _Tp& __old_value,
1322 const _Tp& __new_value,
1325 __replace_switch(__begin, __end, __old_value, __new_value,
1330 template<
typename _FIterator,
typename _Tp>
1332 replace(_FIterator __begin, _FIterator __end,
const _Tp& __old_value,
1333 const _Tp& __new_value)
1335 __replace_switch(__begin, __end, __old_value, __new_value,
1341 template<
typename _FIterator,
typename _Predicate,
typename _Tp>
1343 replace_if(_FIterator __begin, _FIterator __end, _Predicate __pred,
1345 { _GLIBCXX_STD_A::replace_if(__begin, __end, __pred, __new_value); }
1348 template<
typename _FIterator,
typename _Predicate,
typename _Tp,
1349 typename _IteratorTag>
1351 __replace_if_switch(_FIterator __begin, _FIterator __end,
1352 _Predicate __pred,
const _Tp& __new_value, _IteratorTag)
1353 { replace_if(__begin, __end, __pred, __new_value,
1357 template<
typename _RAIter,
typename _Predicate,
typename _Tp>
1359 __replace_if_switch(_RAIter __begin, _RAIter __end,
1360 _Predicate __pred,
const _Tp& __new_value,
1365 static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin)
1367 && __gnu_parallel::__is_parallel(__parallelism_tag)))
1371 __replace_if_selector<_RAIter, _Predicate, _Tp>
1372 __functionality(__new_value);
1375 __begin, __end, __pred, __functionality,
1377 true, __dummy, -1, __parallelism_tag);
1380 replace_if(__begin, __end, __pred, __new_value,
1385 template<
typename _FIterator,
typename _Predicate,
typename _Tp>
1387 replace_if(_FIterator __begin, _FIterator __end,
1388 _Predicate __pred,
const _Tp& __new_value,
1391 __replace_if_switch(__begin, __end, __pred, __new_value,
1396 template<
typename _FIterator,
typename _Predicate,
typename _Tp>
1398 replace_if(_FIterator __begin, _FIterator __end,
1399 _Predicate __pred,
const _Tp& __new_value)
1401 __replace_if_switch(__begin, __end, __pred, __new_value,
1406 template<
typename _FIterator,
typename _Generator>
1408 generate(_FIterator __begin, _FIterator __end, _Generator __gen,
1410 { _GLIBCXX_STD_A::generate(__begin, __end, __gen); }
1413 template<
typename _FIterator,
typename _Generator,
typename _IteratorTag>
1415 __generate_switch(_FIterator __begin, _FIterator __end, _Generator __gen,
1420 template<
typename _RAIter,
typename _Generator>
1422 __generate_switch(_RAIter __begin, _RAIter __end,
1427 static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin)
1429 && __gnu_parallel::__is_parallel(__parallelism_tag)))
1436 __begin, __end, __gen, __functionality,
1438 true, __dummy, -1, __parallelism_tag);
1445 template<
typename _FIterator,
typename _Generator>
1447 generate(_FIterator __begin, _FIterator __end,
1450 __generate_switch(__begin, __end, __gen,
1455 template<
typename _FIterator,
typename _Generator>
1457 generate(_FIterator __begin, _FIterator __end, _Generator __gen)
1459 __generate_switch(__begin, __end, __gen,
1465 template<
typename _OutputIterator,
typename _Size,
typename _Generator>
1466 inline _OutputIterator
1467 generate_n(_OutputIterator __begin, _Size __n, _Generator __gen,
1469 {
return _GLIBCXX_STD_A::generate_n(__begin, __n, __gen); }
1472 template<
typename _OutputIterator,
typename _Size,
typename _Generator,
1473 typename _IteratorTag>
1474 inline _OutputIterator
1475 __generate_n_switch(_OutputIterator __begin, _Size __n, _Generator __gen,
1477 {
return generate_n(__begin, __n, __gen,
1481 template<
typename _RAIter,
typename _Size,
typename _Generator>
1483 __generate_n_switch(_RAIter __begin, _Size __n, _Generator __gen,
1492 template<
typename _OutputIterator,
typename _Size,
typename _Generator>
1493 inline _OutputIterator
1494 generate_n(_OutputIterator __begin, _Size __n, _Generator __gen,
1497 return __generate_n_switch(__begin, __n, __gen,
1502 template<
typename _OutputIterator,
typename _Size,
typename _Generator>
1503 inline _OutputIterator
1504 generate_n(_OutputIterator __begin, _Size __n, _Generator __gen)
1506 return __generate_n_switch(__begin, __n, __gen,
1512 template<
typename _RAIter>
1514 random_shuffle(_RAIter __begin, _RAIter __end,
1516 { _GLIBCXX_STD_A::random_shuffle(__begin, __end); }
1519 template<
typename _RAIter,
typename _RandomNumberGenerator>
1521 random_shuffle(_RAIter __begin, _RAIter __end,
1522 _RandomNumberGenerator& __rand,
1524 { _GLIBCXX_STD_A::random_shuffle(__begin, __end, __rand); }
1528 template<
typename _MustBeInt =
int>
1532 operator()(
int __limit)
1533 {
return rand() % __limit; }
1537 template<
typename _RAIter>
1539 random_shuffle(_RAIter __begin, _RAIter __end)
1543 __gnu_parallel::random_shuffle(__begin, __end, __r);
1547 template<
typename _RAIter,
typename _RandomNumberGenerator>
1549 random_shuffle(_RAIter __begin, _RAIter __end,
1550 #
if __cplusplus >= 201103L
1551 _RandomNumberGenerator&& __rand)
1553 _RandomNumberGenerator& __rand)
1556 if (__begin == __end)
1559 static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin)
1567 template<
typename _FIterator,
typename _Predicate>
1569 partition(_FIterator __begin, _FIterator __end,
1571 {
return _GLIBCXX_STD_A::partition(__begin, __end, __pred); }
1574 template<
typename _FIterator,
typename _Predicate,
typename _IteratorTag>
1576 __partition_switch(_FIterator __begin, _FIterator __end,
1577 _Predicate __pred, _IteratorTag)
1578 {
return partition(__begin, __end, __pred,
1582 template<
typename _RAIter,
typename _Predicate>
1584 __partition_switch(_RAIter __begin, _RAIter __end,
1585 _Predicate __pred, random_access_iterator_tag)
1588 static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin)
1591 typedef typename std::iterator_traits<_RAIter>::
1592 difference_type _DifferenceType;
1595 __gnu_parallel::__get_max_threads());
1596 return __begin + __middle;
1599 return partition(__begin, __end, __pred,
1604 template<
typename _FIterator,
typename _Predicate>
1606 partition(_FIterator __begin, _FIterator __end, _Predicate __pred)
1608 return __partition_switch(__begin, __end, __pred,
1615 template<
typename _RAIter>
1617 sort(_RAIter __begin, _RAIter __end,
1619 { _GLIBCXX_STD_A::sort(__begin, __end); }
1622 template<
typename _RAIter,
typename _Compare>
1624 sort(_RAIter __begin, _RAIter __end, _Compare __comp,
1626 { _GLIBCXX_STD_A::sort<_RAIter, _Compare>(__begin, __end,
1630 template<
typename _RAIter,
typename _Compare,
1633 sort(_RAIter __begin, _RAIter __end, _Compare __comp,
1636 typedef typename iterator_traits<_RAIter>::value_type _ValueType;
1638 if (__begin != __end)
1641 static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin) >=
1643 __gnu_parallel::__parallel_sort<false>(
1644 __begin, __end, __comp, __parallelism);
1651 template<
typename _RAIter>
1653 sort(_RAIter __begin, _RAIter __end)
1655 typedef typename iterator_traits<_RAIter>::value_type _ValueType;
1661 template<
typename _RAIter>
1663 sort(_RAIter __begin, _RAIter __end,
1666 typedef typename iterator_traits<_RAIter>::value_type _ValueType;
1671 template<
typename _RAIter>
1673 sort(_RAIter __begin, _RAIter __end,
1676 typedef typename iterator_traits<_RAIter>::value_type _ValueType;
1681 template<
typename _RAIter>
1683 sort(_RAIter __begin, _RAIter __end,
1686 typedef typename iterator_traits<_RAIter>::value_type _ValueType;
1691 template<
typename _RAIter>
1693 sort(_RAIter __begin, _RAIter __end,
1696 typedef typename iterator_traits<_RAIter>::value_type _ValueType;
1701 template<
typename _RAIter>
1703 sort(_RAIter __begin, _RAIter __end,
1706 typedef typename iterator_traits<_RAIter>::value_type _ValueType;
1711 template<
typename _RAIter>
1713 sort(_RAIter __begin, _RAIter __end,
1716 typedef typename iterator_traits<_RAIter>::value_type _ValueType;
1721 template<
typename _RAIter>
1723 sort(_RAIter __begin, _RAIter __end,
1726 typedef typename iterator_traits<_RAIter>::value_type _ValueType;
1731 template<
typename _RAIter,
typename _Compare>
1733 sort(_RAIter __begin, _RAIter __end, _Compare __comp)
1735 typedef typename iterator_traits<_RAIter>::value_type _ValueType;
1743 template<
typename _RAIter>
1745 stable_sort(_RAIter __begin, _RAIter __end,
1747 { _GLIBCXX_STD_A::stable_sort(__begin, __end); }
1750 template<
typename _RAIter,
typename _Compare>
1752 stable_sort(_RAIter __begin, _RAIter __end,
1754 { _GLIBCXX_STD_A::stable_sort<_RAIter, _Compare>(__begin, __end, __comp); }
1757 template<
typename _RAIter,
typename _Compare,
1760 stable_sort(_RAIter __begin, _RAIter __end,
1763 typedef iterator_traits<_RAIter> _TraitsType;
1764 typedef typename _TraitsType::value_type _ValueType;
1766 if (__begin != __end)
1769 static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin) >=
1771 __gnu_parallel::__parallel_sort<true>(__begin, __end,
1772 __comp, __parallelism);
1774 stable_sort(__begin, __end, __comp,
1780 template<
typename _RAIter>
1782 stable_sort(_RAIter __begin, _RAIter __end)
1784 typedef typename iterator_traits<_RAIter>::value_type _ValueType;
1790 template<
typename _RAIter>
1792 stable_sort(_RAIter __begin, _RAIter __end,
1795 typedef typename iterator_traits<_RAIter>::value_type _ValueType;
1800 template<
typename _RAIter>
1802 stable_sort(_RAIter __begin, _RAIter __end,
1805 typedef typename iterator_traits<_RAIter>::value_type _ValueType;
1810 template<
typename _RAIter>
1812 stable_sort(_RAIter __begin, _RAIter __end,
1815 typedef typename iterator_traits<_RAIter>::value_type _ValueType;
1820 template<
typename _RAIter>
1822 stable_sort(_RAIter __begin, _RAIter __end,
1825 typedef typename iterator_traits<_RAIter>::value_type _ValueType;
1830 template<
typename _RAIter>
1832 stable_sort(_RAIter __begin, _RAIter __end,
1835 typedef typename iterator_traits<_RAIter>::value_type _ValueType;
1840 template<
typename _RAIter,
typename _Compare>
1842 stable_sort(_RAIter __begin, _RAIter __end, _Compare __comp)
1849 template<
typename _IIter1,
typename _IIter2,
1850 typename _OutputIterator>
1851 inline _OutputIterator
1852 merge(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2,
1853 _IIter2 __end2, _OutputIterator __result,
1855 {
return _GLIBCXX_STD_A::merge(
1856 __begin1, __end1, __begin2, __end2, __result); }
1859 template<
typename _IIter1,
typename _IIter2,
1860 typename _OutputIterator,
typename _Compare>
1861 inline _OutputIterator
1862 merge(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2,
1863 _IIter2 __end2, _OutputIterator __result, _Compare __comp,
1865 {
return _GLIBCXX_STD_A::merge(
1866 __begin1, __end1, __begin2, __end2, __result, __comp); }
1869 template<
typename _IIter1,
typename _IIter2,
typename _OutputIterator,
1870 typename _Compare,
typename _IteratorTag1,
1871 typename _IteratorTag2,
typename _IteratorTag3>
1872 inline _OutputIterator
1873 __merge_switch(_IIter1 __begin1, _IIter1 __end1,
1874 _IIter2 __begin2, _IIter2 __end2,
1875 _OutputIterator __result, _Compare __comp,
1876 _IteratorTag1, _IteratorTag2, _IteratorTag3)
1877 {
return _GLIBCXX_STD_A::merge(__begin1, __end1, __begin2, __end2,
1878 __result, __comp); }
1881 template<
typename _IIter1,
typename _IIter2,
1882 typename _OutputIterator,
typename _Compare>
1884 __merge_switch(_IIter1 __begin1, _IIter1 __end1,
1885 _IIter2 __begin2, _IIter2 __end2,
1886 _OutputIterator __result, _Compare __comp,
1887 random_access_iterator_tag, random_access_iterator_tag,
1888 random_access_iterator_tag)
1891 (static_cast<__gnu_parallel::_SequenceIndex>(__end1 - __begin1)
1893 || static_cast<__gnu_parallel::_SequenceIndex>(__end2 - __begin2)
1896 __begin1, __end1, __begin2, __end2, __result,
1897 (__end1 - __begin1) + (__end2 - __begin2), __comp);
1900 __begin1, __end1, __begin2, __end2, __result,
1901 (__end1 - __begin1) + (__end2 - __begin2), __comp);
1905 template<
typename _IIter1,
typename _IIter2,
1906 typename _OutputIterator,
typename _Compare>
1907 inline _OutputIterator
1908 merge(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2,
1909 _IIter2 __end2, _OutputIterator __result, _Compare __comp)
1911 return __merge_switch(
1912 __begin1, __end1, __begin2, __end2, __result, __comp,
1919 template<
typename _IIter1,
typename _IIter2,
1920 typename _OutputIterator>
1921 inline _OutputIterator
1922 merge(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2,
1923 _IIter2 __end2, _OutputIterator __result)
1925 typedef typename std::iterator_traits<_IIter1>::value_type _ValueType1;
1926 typedef typename std::iterator_traits<_IIter2>::value_type _ValueType2;
1928 return __gnu_parallel::merge(__begin1, __end1, __begin2, __end2,
1933 template<
typename _RAIter>
1935 nth_element(_RAIter __begin, _RAIter __nth,
1937 {
return _GLIBCXX_STD_A::nth_element(__begin, __nth, __end); }
1940 template<
typename _RAIter,
typename _Compare>
1942 nth_element(_RAIter __begin, _RAIter __nth,
1943 _RAIter __end, _Compare __comp,
1945 {
return _GLIBCXX_STD_A::nth_element(__begin, __nth, __end, __comp); }
1948 template<
typename _RAIter,
typename _Compare>
1950 nth_element(_RAIter __begin, _RAIter __nth,
1951 _RAIter __end, _Compare __comp)
1954 static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin)
1958 nth_element(__begin, __nth, __end, __comp,
1963 template<
typename _RAIter>
1965 nth_element(_RAIter __begin, _RAIter __nth,
1968 typedef typename iterator_traits<_RAIter>::value_type _ValueType;
1969 __gnu_parallel::nth_element(__begin, __nth, __end,
1974 template<
typename _RAIter,
typename _Compare>
1976 partial_sort(_RAIter __begin, _RAIter __middle,
1977 _RAIter __end, _Compare __comp,
1979 { _GLIBCXX_STD_A::partial_sort(__begin, __middle, __end, __comp); }
1982 template<
typename _RAIter>
1984 partial_sort(_RAIter __begin, _RAIter __middle,
1986 { _GLIBCXX_STD_A::partial_sort(__begin, __middle, __end); }
1989 template<
typename _RAIter,
typename _Compare>
1991 partial_sort(_RAIter __begin, _RAIter __middle,
1992 _RAIter __end, _Compare __comp)
1995 static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin)
2000 partial_sort(__begin, __middle, __end, __comp,
2005 template<
typename _RAIter>
2007 partial_sort(_RAIter __begin, _RAIter __middle,
2010 typedef iterator_traits<_RAIter> _TraitsType;
2011 typedef typename _TraitsType::value_type _ValueType;
2012 __gnu_parallel::partial_sort(__begin, __middle, __end,
2017 template<
typename _FIterator>
2019 max_element(_FIterator __begin, _FIterator __end,
2021 {
return _GLIBCXX_STD_A::max_element(__begin, __end); }
2024 template<
typename _FIterator,
typename _Compare>
2026 max_element(_FIterator __begin, _FIterator __end, _Compare __comp,
2028 {
return _GLIBCXX_STD_A::max_element(__begin, __end, __comp); }
2031 template<
typename _FIterator,
typename _Compare,
typename _IteratorTag>
2033 __max_element_switch(_FIterator __begin, _FIterator __end,
2034 _Compare __comp, _IteratorTag)
2035 {
return max_element(__begin, __end, __comp,
2039 template<
typename _RAIter,
typename _Compare>
2041 __max_element_switch(_RAIter __begin, _RAIter __end,
2042 _Compare __comp, random_access_iterator_tag,
2046 static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin)
2048 && __gnu_parallel::__is_parallel(__parallelism_tag)))
2050 _RAIter __res(__begin);
2057 __res, __res, -1, __parallelism_tag);
2061 return max_element(__begin, __end, __comp,
2066 template<
typename _FIterator>
2068 max_element(_FIterator __begin, _FIterator __end,
2071 typedef typename iterator_traits<_FIterator>::value_type _ValueType;
2076 template<
typename _FIterator>
2078 max_element(_FIterator __begin, _FIterator __end)
2080 typedef typename iterator_traits<_FIterator>::value_type _ValueType;
2081 return __gnu_parallel::max_element(__begin, __end,
2086 template<
typename _FIterator,
typename _Compare>
2088 max_element(_FIterator __begin, _FIterator __end, _Compare __comp,
2091 return __max_element_switch(__begin, __end, __comp,
2096 template<
typename _FIterator,
typename _Compare>
2098 max_element(_FIterator __begin, _FIterator __end, _Compare __comp)
2100 return __max_element_switch(__begin, __end, __comp,
2106 template<
typename _FIterator>
2108 min_element(_FIterator __begin, _FIterator __end,
2110 {
return _GLIBCXX_STD_A::min_element(__begin, __end); }
2113 template<
typename _FIterator,
typename _Compare>
2115 min_element(_FIterator __begin, _FIterator __end, _Compare __comp,
2117 {
return _GLIBCXX_STD_A::min_element(__begin, __end, __comp); }
2120 template<
typename _FIterator,
typename _Compare,
typename _IteratorTag>
2122 __min_element_switch(_FIterator __begin, _FIterator __end,
2123 _Compare __comp, _IteratorTag)
2124 {
return min_element(__begin, __end, __comp,
2128 template<
typename _RAIter,
typename _Compare>
2130 __min_element_switch(_RAIter __begin, _RAIter __end,
2131 _Compare __comp, random_access_iterator_tag,
2135 static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin)
2137 && __gnu_parallel::__is_parallel(__parallelism_tag)))
2139 _RAIter __res(__begin);
2146 __res, __res, -1, __parallelism_tag);
2150 return min_element(__begin, __end, __comp,
2155 template<
typename _FIterator>
2157 min_element(_FIterator __begin, _FIterator __end,
2160 typedef typename iterator_traits<_FIterator>::value_type _ValueType;
2165 template<
typename _FIterator>
2167 min_element(_FIterator __begin, _FIterator __end)
2169 typedef typename iterator_traits<_FIterator>::value_type _ValueType;
2170 return __gnu_parallel::min_element(__begin, __end,
2175 template<
typename _FIterator,
typename _Compare>
2177 min_element(_FIterator __begin, _FIterator __end, _Compare __comp,
2180 return __min_element_switch(__begin, __end, __comp,
2185 template<
typename _FIterator,
typename _Compare>
2187 min_element(_FIterator __begin, _FIterator __end, _Compare __comp)
2189 return __min_element_switch(__begin, __end, __comp,
Parallel sorting algorithm switch. This file is a GNU parallel extension to the Standard C++ Library...
Reduction for finding the maximum element, using a comparator.
__RAIter1 __search_template(__RAIter1 __begin1, __RAIter1 __end1, __RAIter2 __begin2, __RAIter2 __end2, _Pred __pred)
Parallel std::search.
std::for_each() selector.
Forces sequential execution at compile time.
A triple of iterators. The usual iterator operations are applied to all three child iterators...
One of the math functors.
#define _GLIBCXX_PARALLEL_CONDITION(__c)
Determine at compile(?)-time if the parallel variant of an algorithm should be called.
Forces parallel sorting using balanced quicksort at compile time.
ISO C++ entities toplevel namespace is std.
Forces parallel sorting using multiway mergesort with exact splitting at compile time.
_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.
constexpr iterator_traits< _Iter >::iterator_category __iterator_category(const _Iter &)
Parallel implementation of std::random_shuffle(). This file is a GNU parallel extension to the Standa...
Parallel implementation of std::partition(), std::nth_element(), and std::partial_sort(). This file is a GNU parallel extension to the Standard C++ Library.
Similar to std::equal_to, but allows two different types.
_It _M_finish_iterator
_Iterator on last element processed; needed for some algorithms (e. g. std::transform()).
Parallelization of embarrassingly parallel execution by means of an OpenMP for loop with static sched...
Forces parallel sorting using unbalanced quicksort at compile time.
Parallel implementation base for std::search() and std::search_n(). This file is a GNU parallel exten...
_Parallelism
Run-time equivalents for the compile-time tags.
std::transform() __selector, two input sequences variant.
Functor wrapper for std::rand().
Forces parallel sorting using multiway mergesort at compile time.
_OutputIterator __parallel_unique_copy(_IIter __first, _IIter __last, _OutputIterator __result, _BinaryPredicate __binary_pred)
Parallel std::unique_copy(), w/__o explicit equality predicate.
A pair of iterators. The usual iterator operations are applied to both child iterators.
Sequence that conceptually consists of multiple copies of the same element. The copies are not stored...
Parallel implementation base for std::find(), std::equal() and related functions. This file is a GNU ...
Reduction for finding the maximum element, using a comparator.
std::pair< _RAIter1, _RAIter2 > __find_template(_RAIter1 __begin1, _RAIter1 __end1, _RAIter2 __begin2, _Pred __pred, _Selector __selector)
Parallel std::find, switch for different algorithms.
Similar to std::binder2nd, but giving the argument types explicitly.
_Function objects representing different tasks to be plugged into the parallel find algorithm...
std::iterator_traits< _RAIter >::difference_type __parallel_partition(_RAIter __begin, _RAIter __end, _Predicate __pred, _ThreadIndex __num_threads)
Parallel implementation of std::partition.
Reduction function doing nothing.
Parallelization of embarrassingly parallel execution by means of equal splitting. This file is a GNU ...
Sequential helper functions. This file is a GNU parallel extension to the Standard C++ Library...
uint64_t _SequenceIndex
Unsigned integer to index __elements. The total number of elements for each algorithm must fit into t...
GNU parallel code for public use.
Parallelization of embarrassingly parallel execution by means of work-stealing.
Parallel implementation of std::merge(). This file is a GNU parallel extension to the Standard C++ Li...
Functors representing different tasks to be plugged into the generic parallelization methods for emba...
Parallelization of embarrassingly parallel execution by means of an OpenMP for loop. This file is a GNU parallel extension to the Standard C++ Library.
static const _Settings & get()
Get the global settings.
void __parallel_nth_element(_RAIter __begin, _RAIter __nth, _RAIter __end, _Compare __comp)
Parallel implementation of std::nth_element().
Test predicate on two adjacent elements.
Recommends parallel execution using the default parallel algorithm.
_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.
iterator begin() const
Begin iterator.
void __parallel_partial_sort(_RAIter __begin, _RAIter __middle, _RAIter __end, _Compare __comp)
Parallel implementation of std::partial_sort().
iterator end() const
End iterator.
std::generate() selector.
Random-access iterators support a superset of bidirectional iterator operations.
void __parallel_random_shuffle(_RAIter __begin, _RAIter __end, _RandomNumberGenerator __rng=_RandomNumber())
Parallel random public call.
Helper iterator classes for the std::transform() functions. This file is a GNU parallel extension to ...
Forces parallel sorting using multiway mergesort with splitting by sampling at compile time...
Parallel implementations of set operations for random-access iterators. This file is a GNU parallel e...
One of the comparison functors.
Test predicate on several elements.
One of the comparison functors.
Parallel implementations of std::unique_copy(). This file is a GNU parallel extension to the Standard...
Selector that just returns the passed iterator.
Similar to std::less, but allows two different types.
Test predicate on a single element, used for std::find() and std::find_if ().
_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...
Recommends parallel execution at compile time, optionally using a user-specified number of threads...
void __sequential_random_shuffle(_RAIter __begin, _RAIter __end, _RandomNumberGenerator &__rng)
Sequential cache-efficient random shuffle.
Main interface for embarrassingly parallel functions.
std::transform() __selector, one input sequence variant.