12 #ifndef THRILL_CORE_BUFFERED_MULTIWAY_MERGE_HEADER 13 #define THRILL_CORE_BUFFERED_MULTIWAY_MERGE_HEADER 24 template <
typename ValueType,
typename ReaderIterator,
typename Comparator>
28 using Reader =
typename std::iterator_traits<ReaderIterator>::value_type;
31 false, ValueType, Comparator>;
34 const Comparator& comp)
36 num_inputs_(static_cast<unsigned>(readers_end - readers_begin)),
50 lt_.insert_start(
nullptr, t,
true);
63 const ValueType&
Top() {
68 unsigned top =
lt_.min_source();
73 lt_.delete_min_insert(&
current_[top].second,
false);
78 lt_.delete_min_insert(
nullptr,
true);
92 std::vector<std::pair<bool, ValueType> >
current_;
107 template <
typename ValueType,
typename ReaderIterator,
typename Comparator>
109 ReaderIterator seqs_begin, ReaderIterator seqs_end,
110 const Comparator& comp) {
112 assert(seqs_end - seqs_begin >= 1);
114 ValueType, ReaderIterator,
115 Comparator>(seqs_begin, seqs_end, comp);
121 #endif // !THRILL_CORE_BUFFERED_MULTIWAY_MERGE_HEADER
tlx::LoserTree< false, ValueType, Comparator > LoserTreeType
BufferedMultiwayMergeTree(ReaderIterator readers_begin, ReaderIterator readers_end, const Comparator &comp)
auto make_buffered_multiway_merge_tree(ReaderIterator seqs_begin, ReaderIterator seqs_end, const Comparator &comp)
Sequential multi-way merging switch for a file writer as output.
std::vector< std::pair< bool, ValueType > > current_
current values in each input (exist flag, value)
typename std::iterator_traits< ReaderIterator >::value_type Reader