32 #ifndef _GLIBCXX_PARALLEL_MERGE_H 33 #define _GLIBCXX_PARALLEL_MERGE_H 1 53 template<
typename _RAIter1,
typename _RAIter2,
54 typename _OutputIterator,
typename _DifferenceTp,
58 _RAIter2& __begin2, _RAIter2 __end2,
59 _OutputIterator __target,
60 _DifferenceTp __max_length, _Compare __comp)
62 typedef _DifferenceTp _DifferenceType;
63 while (__begin1 != __end1 && __begin2 != __end2 && __max_length > 0)
66 if (__comp(*__begin2, *__begin1))
67 *__target++ = *__begin2++;
69 *__target++ = *__begin1++;
73 if (__begin1 != __end1)
75 __target = std::copy(__begin1, __begin1 + __max_length, __target);
76 __begin1 += __max_length;
80 __target = std::copy(__begin2, __begin2 + __max_length, __target);
81 __begin2 += __max_length;
101 template<
typename _RAIter1,
typename _RAIter2,
102 typename _OutputIterator,
typename _DifferenceTp,
106 _RAIter2& __begin2, _RAIter2 __end2,
107 _OutputIterator __target,
108 _DifferenceTp __max_length, _Compare __comp)
110 typedef _DifferenceTp _DifferenceType;
111 typedef typename std::iterator_traits<_RAIter1>::value_type
113 typedef typename std::iterator_traits<_RAIter2>::value_type
116 #if _GLIBCXX_PARALLEL_ASSERTIONS 117 _GLIBCXX_PARALLEL_ASSERT(__max_length >= 0);
120 while (__begin1 != __end1 && __begin2 != __end2 && __max_length > 0)
122 _RAIter1 __next1 = __begin1 + 1;
123 _RAIter2 __next2 = __begin2 + 1;
124 _ValueType1 __element1 = *__begin1;
125 _ValueType2 __element2 = *__begin2;
127 if (__comp(__element2, __element1))
129 __element1 = __element2;
135 *__target = __element1;
140 if (__begin1 != __end1)
142 __target = std::copy(__begin1, __begin1 + __max_length, __target);
143 __begin1 += __max_length;
147 __target = std::copy(__begin2, __begin2 + __max_length, __target);
148 __begin2 += __max_length;
167 template<
typename _RAIter1,
typename _RAIter2,
168 typename _OutputIterator,
typename _DifferenceTp,
170 inline _OutputIterator
172 _RAIter2& __begin2, _RAIter2 __end2,
173 _OutputIterator __target, _DifferenceTp __max_length,
179 __target, __max_length, __comp);
192 template<
typename _RAIter1,
typename _RAIter2,
193 typename _RAIter3,
typename _Compare>
199 _RAIter2 __end2, _RAIter3 __target,
typename 200 std::iterator_traits<_RAIter1>::
201 difference_type __max_length, _Compare __comp)
203 __max_length, __comp); }
220 template<
typename _RAIter1,
typename _RAIter3,
224 _RAIter1& __begin2, _RAIter1 __end2,
225 _RAIter3 __target,
typename 226 std::iterator_traits<_RAIter1>::
227 difference_type __max_length, _Compare __comp)
230 std::iterator_traits<_RAIter1>::value_type _ValueType;
231 typedef typename std::iterator_traits<_RAIter1>::
232 difference_type _DifferenceType1 ;
233 typedef typename std::iterator_traits<_RAIter3>::
234 difference_type _DifferenceType3;
244 _Compare, _DifferenceType1>, __max_length, __comp,
245 omp_get_max_threads());
void multiway_merge_exact_splitting(_RAIterIterator __seqs_begin, _RAIterIterator __seqs_end, _DifferenceType __length, _DifferenceType __total_length, _Compare __comp, std::vector< std::pair< _DifferenceType, _DifferenceType > > *__pieces)
Exact splitting for parallel multiway-merge routine.
A pair of iterators. The usual iterator operations are applied to both child iterators.
_OutputIterator __merge_advance_movc(_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.
_RAIter3 parallel_multiway_merge(_RAIterIterator __seqs_begin, _RAIterIterator __seqs_end, _RAIter3 __target, _Splitter __splitter, _DifferenceTp __length, _Compare __comp, _ThreadIndex __num_threads)
Parallel multi-way merge routine.
GNU parallel code for public use.
Includes the original header files concerned with iterators except for stream iterators. This file is a GNU parallel extension to the Standard C++ Library.
_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.
_OutputIterator __merge_advance_usual(_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.
constexpr pair< typename __decay_and_strip< _T1 >::__type, typename __decay_and_strip< _T2 >::__type > make_pair(_T1 &&__x, _T2 &&__y)
A convenience wrapper for creating a pair from two objects.
Struct holding two objects of arbitrary type.
_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...
#define _GLIBCXX_CALL(__n)
Macro to produce log message when entering a function.