| 14 | class MergingIterator : public Iterator { |
| 15 | public: |
| 16 | MergingIterator(const Comparator* comparator, Iterator** children, int n) |
| 17 | : comparator_(comparator), |
| 18 | children_(new IteratorWrapper[n]), |
| 19 | n_(n), |
| 20 | current_(nullptr), |
| 21 | direction_(kForward) { |
| 22 | for (int i = 0; i < n; i++) { |
| 23 | children_[i].Set(children[i]); |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | ~MergingIterator() override { delete[] children_; } |
| 28 |