16 #ifndef STXXL_CONTAINERS_PQ_MERGERS_HEADER
17 #define STXXL_CONTAINERS_PQ_MERGERS_HEADER
29 namespace priority_queue_local {
40 template <
class InputIterator,
class OutputIterator,
class CompareType>
42 InputIterator& source0,
43 InputIterator& source1,
44 OutputIterator target,
48 OutputIterator done = target + length;
50 while (target != done)
52 if (cmp(*source0, *source1))
72 template <
class InputIterator,
class OutputIterator,
class CompareType>
74 InputIterator& source0,
75 InputIterator& source1,
76 InputIterator& source2,
77 OutputIterator target,
81 OutputIterator done = target + length;
83 if (cmp(*source1, *source0)) {
84 if (cmp(*source2, *source1)) {
88 if (cmp(*source0, *source2)) {
96 if (cmp(*source2, *source1)) {
97 if (cmp(*source2, *source0)) {
108 #define Merge3Case(a, b, c) \
110 if (target == done) \
112 *target = *source ## a; \
115 if (cmp(*source ## b, *source ## a)) \
116 goto s ## a ## b ## c; \
117 if (cmp(*source ## c, *source ## a)) \
118 goto s ## b ## a ## c; \
119 goto s ## b ## c ## a;
140 template <
class InputIterator,
class OutputIterator,
class CompareType>
142 InputIterator& source0,
143 InputIterator& source1,
144 InputIterator& source2,
145 InputIterator& source3,
146 OutputIterator target,
unsigned_type length, CompareType& cmp)
148 OutputIterator done = target + length;
150 #define StartMerge4(a, b, c, d) \
151 if ((!cmp(*source ## a, *source ## b)) && (!cmp(*source ## b, *source ## c)) && (!cmp(*source ## c, *source ## d))) \
152 goto s ## a ## b ## c ## d;
189 #define Merge4Case(a, b, c, d) \
190 s ## a ## b ## c ## d : \
191 if (target == done) \
193 *target = *source ## a; \
196 if (cmp(*source ## c, *source ## a)) \
198 if (cmp(*source ## b, *source ## a)) \
199 goto s ## a ## b ## c ## d; \
201 goto s ## b ## a ## c ## d; \
205 if (cmp(*source ## d, *source ## a)) \
206 goto s ## b ## c ## a ## d; \
208 goto s ## b ## c ## d ## a; \
251 #endif // !STXXL_CONTAINERS_PQ_MERGERS_HEADER
#define StartMerge4(a, b, c, d)
void merge4_iterator(InputIterator &source0, InputIterator &source1, InputIterator &source2, InputIterator &source3, OutputIterator target, unsigned_type length, CompareType &cmp)
void merge_iterator(InputIterator &source0, InputIterator &source1, OutputIterator target, unsigned_type length, CompareType &cmp)
void merge3_iterator(InputIterator &source0, InputIterator &source1, InputIterator &source2, OutputIterator target, unsigned_type length, CompareType &cmp)
#define STXXL_BEGIN_NAMESPACE
choose_int_types< my_pointer_size >::unsigned_type unsigned_type
#define Merge4Case(a, b, c, d)
#define Merge3Case(a, b, c)
#define STXXL_END_NAMESPACE