…lines 1–162 unchanged (162 lines)
163 if (!_spilledSortedSegments.empty()) {
164 // We've exceeded the memory limit and spilled some data to disk, which means that there
165 // might still be data in _accumulatedValues that was incorporated into the algorithm, but
166 // not enough to hit the limit and spill again. So that we don't miss those values, we force
167 // the algorithm to spill again here so that all of the data is on disk when we sort it.
168 spill();
169
170 std::function<int(const Value&, const Value&)> comparator =
171 [valueComparator = ValueComparator()](const Value& lhs, const Value& rhs) -> int {
172 return valueComparator.compare(lhs, rhs);
173 };
174
175 // Initializes _sorterIterator as a MergeIterator that merge sorts the spilled sorted
176 // segments of data together so that values can be iterated through in sorted order.
…lines 177–223 unchanged (47 lines)