Skip to content

Correct and simplify OrpostingIterator constructor

Stefan Brüns requested to merge work/correct_orpostingiterator into master

After QVector::erase(it) the end iterator would no longer point to the actual vector end.

The range between between end() and the original end would typically contain duplicates of the last vector element, as preceding elements are moved to the front on each erase() call, but this is just an artifact of the typical implementation and the behavior is actually undefined.

Even the typical implementation can cause erratic behvior, as next() might be called several times on the last iterator.

For Qt debug builds, erase() will check if the iterator is inside the the valid range and will error out.

The code can be made corrrect and at the same time simplified by moving the nullptr cleanup out of the docId initialization loop.

Signed-off-by: Stefan Brüns stefan.bruens@rwth-aachen.de

Merge request reports