AkRanges: mark FilterIterator as an InputIterator
Normally the AkRanges' BaseIterator inherits the iterator category from the source iterator, which is RandomAccessIterator for most Qt containers. In case of our FilterIterator, however, we reduce it to a simple InputIterator. Not only because we don't implement correctly all of the required RandomAccessIterator semantics (which we could do), but it would actually have negative performance impact with STL algorithms like std::find(), since some of the operations would be costly to perform on the FilterIterator (e.g. last-first would require to loop over the entire container). This was actually discovered by ASAN detecting heap-buffer-overflow in AkRangesTest::testNone() as the loop tried to dereference past-the-end iterator.
parent
31578c12
Please register or sign in to comment